Worst practices are viral for the wrong reasons (2014)
haskellforall.com
haskellforall.com
Developers who solve problems with less code and less complexity, and check to see if libraries already in use have the functionality they need before adopting new ones, those developers are less visible in the codebase, and it isn't obvious that others should see them as leaders and role models.
Imagine how absurd this position would be if there was an equivalent with the less/greater than operators...
'===' is a single operator in JS, just as '==' is. It's only superfluous in terms of character count (which barely matters at all), as opposed to token count or actual complexity.
I'd argue that in the important metrics, '==' is actually more superfluous, in that it has a broader scope of functionality than '==='. When you use '==' to do an equality check you're essentially invoking something that does the check, but also does a bunch of implicit type conversion and checking between types, none of which you actually care about at all.
I'm also not a fan of 'defensive programming', I think people fuck a lot of perfectly good code up trying to read the tea leaves about how other devs are going to poorly interact with it in the future. But using '===' is like saying "I just want to check equality". It's not adding something for the sake of defense (other than the single character), it's removing something useless for the sake of removing something useless. Which is a good thing for maintainability and bug prevention yada yada, but it also feels nice to do as a dev.
That's why you see very few people arguing against '===' as a best practice, because incentives are mostly aligned in this case. It's not really like a lot of the other examples where something is seen as a 'best practice' in spite of being something that devs hate doing.
There is probably some important correlation between my engagememt at code review time and the quality of our software.
Perhaps the so-called "new technologies" were created out of boredom as well.
Are they? Is it?
I'm starting to think this actually describes most of professional accomplishment and career, at least in software. People can't see negative space, so to speak, and they don't bother to imagine it.
Write or debug something in a fraction of a time another engineer would be able to? Well, we can't observe both universes, so it must have just been easy. Make something super stable and easily understandable that doesn't require any attention or maintenance and becomes crucial to a company's success? Without noise, people will just forget about it or assume it was straightforward.
The space of things that doesn't happen is infinitely bigger than the outcome we end up seeing. This makes a lot of our judgments completely off base.
As someone else pointed out: People have trouble seeing negative space.
However, a big problem is the opacity of engineering, especially software engineering. It can be hard to tell the quality of code from the outside, and the less technical you are, the harder it is to see. There are signs of course, such as the number of bugs, but it can be hard to tell the difference between style and quality.
You don't need to. Let the results speak for themselves.
Perhaps that's why they're so efficient...
One of the comments to the linked article also mentions the principal-agent problem, though not by name; an interesting and tricky one, and likely indeed can happen in a software development setting.
Perhaps this is just an artifact of my own personal experience though, all my professional experience has been at dedicated software shops with highly competent engineering teams. I realize that's not the case everywhere.
Does anyone have any specific examples of worst practices explicitly being disseminated under the guise of best practices? Is this something that you tend to see happen only within organizations, or across the internet as a whole?
The requirement was to ingest a CSV, transform it, and put it in a database somewhere. The solution was three microservices.
The first read the data piece by piece (unit of work) and passed it to the second via HTTP. This was slow so it was threaded.
The second provided an abstract class which was extended to facilitate string transformations. Each was accompanied by a unit test. Similarly, the result was passed along to the third service via HTTP. This was also threaded.
The third put the data into a third-party queue which wrote into a database.
It took nearly a half of a day for the process to complete. I rewrote it as an SQL script which read the CSV into the database directly, used SQL functions for the transformations and then stored its result. It took a few minutes to complete. But, this wasn't a best practice or popular, and what would the team work on?
> any specific examples of worst practices explicitly being disseminated under the guise of best practices?
OOP.
The actor model envisioned by Alan Kay was promising, but the brand we saw in Java and C++ in the late 90's and early naughties was pretty bad. There's a reason we moved away from inheritance in favour of composition, a reason why OOP languages took a clue from statically typed FP languages and grew generics 20 years later than them, a reason why they eventually grew first class functions… and don't get me started on performance sensitive software which could have benefited from a bit of data orientation.
Don't get me wrong, classes have their uses. Grouping related data together is very handy, as well as the namespacing. And sometimes, even inheritance has its uses. But as a whole it's just the wrong way to look at things. A program's job is to move & transform data, and instead of focusing on that data OOP encourages you to think of an inevitably contrived model of the world.
I've heard people say, "React is fast. It has an intermediate layer to optimize changes to the HTML. You get much better performance with it." Of course, we know that effectively manipulating the DOM via plain JavaScript is the best you'll get. (And you can achieve great performance with well written jQuery too.)
With an infinite amount of hand-tuning by experts, yes. In practice to know what parts of the DOM to update based on what changes and maintain that mapping correctly as your system evolves, you have to either use React or use/build something equivalent to it.
So, there is no such thing as a perfect software/library being done.
cough PyTorch cough
- "We made the code twice as fast with this clever optimization" - Translation: we solved the issue badly with bad technology, thus making the simplest operations gratingly slow, our performance is 100x worse than the theoretical best possible. Now we made it only 50x worse, a triumphant achievement. This will still allow us to make several more triumphant gains, and end up with finally with something that's only 5x slower than best case.
- We used a brand-name, hip library for a very specific use case - In order to solve the issue quickly, while avoiding having to understand the problem domain, we outsourced one of our core differentiators to some npm package. We made the first release in a quarter of the time, compared to doing it properly. Management was happy, because progress was fast. It kinda sucks, and there's no way to improve on it without actually investing the time and of building it ourselves. Which we won't do, but will replace library X with it's successor come a few years, making a blogpost about the stupidity of X's implementors, and praising library Y. This is a lazier parallel of the previous point, with the actual developing competencies outsourced.
I managed a number of production systems with both and it always worked beautifully.
That said, licensing confusion always made it difficult for anyone to repackage and distribute it (until 2007) and djb was not known for being easy to work with. So that probably also hurt adoption.
* bad code requires more maintainers than good code
* it's hard to find people to work on it — partly because the code is bad, and partly because whatever process that _led to_ bad code is probably still around
Most likely I think it’s just easier to write a good API for code that isn’t handling edge cases properly.