3 ms·
As with anything ‘it depends’ - if you’re writing CRUD enterprise code that at most will see several hundred objects at a time, but will have to be understood b
by lazide 4y ago
As with anything ‘it depends’ - if you’re writing CRUD enterprise code that at most will see several hundred objects at a time, but will have to be understood by 100s of cut rate contractors over it’s lifetime? Go for obvious and hard to screw up, over the most efficient algorithm.
Of course someone will misappropriate it and use it as the core of some terribly thought out data handling app with billions of items, but at least anyone with a clue will be able to figure out why it’s terrible later.
And if no one with a clue is around, then not like there was any better outcome going to happen except by sheer luck anyway.
- cesaref 4y agoRight, and my point is that maintenance is a massive cost which is boring, and often overlooked when talking about the 'cost' of code. Slow code causing excessive CPU load or requiring multiple application servers is one cost, but maintenance is another, and the skill is to understand when it's appropriate for what. My default would be to generate maintainable code first, and worry about performance when it matters, but a knee-jerk 'linked lists are slow so avoid' approach is almost always the wrong way of approaching it. Choose the correct data structure and algorithm for maintainability, then optimise if it's too slow should be the default in my opinion.