5 ms·
Any code base that doesn't use the advanced features of it's language(s) are always better in my experience. Heavy usage of e.g. meta-programming in Python or p
by bittermandel 2y ago
Any code base that doesn't use the advanced features of it's language(s) are always better in my experience. Heavy usage of e.g. meta-programming in Python or perhaps uber's fx (dependency injection) in Go makes projects infinitely harder to get into.
- jamestimmins 2y agoSuch a great point. I audibly groan when I come across Python meta-programming. While not an advanced feature, I have a similar response when I see lots of decorators in Python. They quickly become a debugging nightmare.
- sebstefan 2y agoI can see a few cases where that depends... Really simple languages: Ruling out meta-programming is really going to limit you in Lua for example. Just being able to do `mySocket:close()` instead of `Socket.close(mySocket)` involves meta-programming. Older languages: For C++ the "simple" features are going to include raw pointers and macros. Maybe it's not so bad to allow smart pointers and templates to avoid those
- wruza 2y agoBoth of these examples are examples of an under-programmed core though. Lua is notorious for lacking batteries, so everyone has to reinvent their own. There’s literally no serious Lua program without some sort of classes, but they still resist adding them into lauxlib.
- BiteCode_dev 2y agoDepends who is providing it. Django and pydantic meta programming usually make the code easier to deal with. In shop written meta programming usually sucks.
- tommypalm 2y agoI worked at GOV.UK for a few years on what was effectively specialised CMSs all written in Rails. Mostly basic CRUD stuff. A contractor came along and built the most insane CMS I've ever seen. I found out later it was flavor of the Java Repository Pattern using dependency injection. It became so difficult to work with that the last thing I worked on there was to delete it and rebuild it using standard Rails patterns. The KISS philosophy exists for a reason and that includes over-using advanced language features just to show off.
- nijave 2y agoBesides just KISS, a lot of messes I've seen have been implementing patterns outside the framework or implementing complex patterns that didn't add value. Besides KISS (or maybe as an extensive), try to keep framework-based codebases as close to the official documented setup as possible. You automatically get to s of free, high-quality documentation available on the Internet.
- andrei_says_ 2y agoProps for gov.uk! I’ve looked at its documentation and design system and see both as peak user experience and clarity.
- RangerScience 2y agoI've had a consistent experience in Rails where I think for a day or two I've got a legitimate use case for one the whacky things you can do... and then as I work the problem more, it turns out: nope, the simple stuff is still the Right Way. Someday, Ruby shenanigans, someday... PS - Being able to pull the shenanigans is super useful during the dev process, usually to skip some yak shaving during exploration, so it's nice to have anyway.
- Mikhail_Edoshin 2y agoHaving just removed a metaclass from my Python code I totally agree.
- rvdginste 2y agoI think one should not use advanced language features just because, but I also think one should not avoid using advanced language features where it is useful. Why would the code base be worse when advanced language features are used?
- lanstin 2y agoBecause unless you hire steadily more intelligent developers you will be headed towards a mass of code that is hard and scary to change.
- peelle 2y agoI disagree with this, but I understand where it's coming from. I think you have a form of whiplash from things like: - Novices overusing the new shiny. - Java/C++/etc Jr programmers overusing design patterns. - Perl programmers solving everything with regexes. - Small startups with GraphQL, or any other large enterprise tool. - Metaprogramming, Maco's, Dependency injection, Recursion, etc when a simpler solution is a better fit. IMHO, a "best codebase" will be just a bit more advanced than I am, with good resources for me to grok it. I want to be able to learn from it. I also don't want to be so far out of my depth that I can't make a reasonable contribution.
- arp242 2y agoA pinch of salt can really liven up a dish. Not every dish needs it, but when used appropriately it's almost magic in how much difference it can make. A lot of salt always make everything disgusting.
- tracerbulletx 2y agoHuh? Salt is one of the most important foundational elements of basically all cooking.
- pphysch 2y agoIt would be cool if newer (imperative) languages had a clear protocol to delimit the simple core of the language from the advanced, library-building features. Like Rust has `unsafe` blocks, imagine a `advanced` or `metaprogramming` block that is required in order to use advanced metaprogramming features. Then you could tell a junior to implement $MUNDANE_INTEGRATION without use of `advanced`, and that constraint could be statically verified in PRs, etc. It seems like it would vastly simplify language evolution. The core language can have rigid limits on changes and follow the Zen of Python or whatever, while the `advanced` language extensions can be a bit looser. Features could graduate from advanced to core without breaking anything. You get a single powerful+expressive language with a "porcelain interface" without necessarily giving juniors ammo to shoot themselves in the foot.
- teleforce 2y agoI think D language fits your very descriptions. You have GC by default that's Python like and intuitive programming constructs. Since for the most part D compilation is much faster than C++ and Rust compilation as long as you stick to the core non-CTFE. Heck you can use D as a compiled scripting language with REPL using rdmd [1]. Then if you want to go gung-ho, you can use the other advance features like D's excellent template meta programming, CTFE, bit banging in-line assembly, etc. D has so many advanced features that can be explored later on, even modern C++ is playing catch up with D in every releases. Nowadays D compiler also support C natively [2] and GDC compiler is included inside the venerable GCC eco-system. There are university that teach software development and engineering class with D due to its managed, on-demand and gradual complexity, not like "in your face" complexity of the big kahuna programming language like C++ and Rust [3]. Like other compiled languages you can build real-time system even firmware device drivers in D unlike Python. [1] https://dlang.org/areas-of-d-usage.html#academia https://dlang.org/areas-of-d-usage.html#academia [2] Adding ANSI C11 C compiler to D so it can import and compile C files directly: https://news.ycombinator.com/item?id=27102584 https://news.ycombinator.com/item?id=27102584 [3] Teaching Software Engineering in DLang [pdf]: https://news.ycombinator.com/item?id=37620298 https://news.ycombinator.com/item?id=37620298
- burutthrow1234 2y agoI worked with someone who insisted on using fx for DI in go. It's so antithetical to the entire Go philosophy, I don't even think it's an "advanced feature". It's just bringing Java cruft to a language where it isn't necessary and making everything worse.