3 ms·
This week I worked on the code of a customer that was passing an object into a command / service hierarchy and extracting some attributes of that object in the
by pmontra 4y ago
This week I worked on the code of a customer that was passing an object into a command / service hierarchy and extracting some attributes of that object in the lowest level of the hierarchy, where a method is doing the real job. Unfortunately the new feature I worked on needed most of the methods of that hierarchy but didn't have that object because it doesn't have more than half of the data needed to build it. So, passing individual attributes as arguments instead of the object would have been the right implementation and the assumptions the code was based on were wrong for this new use case.
I derived a class from the first level of the hierarchy with only the methods I needed, redefined as empty the ones that were using the attributes I didn't have and ended up with code that passed tests. No time to refactor all the code into the correct abstraction. Time to understand how the class hierarchy worked: too much. Was it overengineered? Yes. I prefer simple straightforward code with few files to navigate to understand how it works.
- karmakurtisaani 4y agoAh, the good old time constraint driven programming. The worst of them all.
- throwaway290 4y agoTCDD can be OK if you control the scope. "We must deliver a functional thing in 2 weeks, it may be small and advance us 2% towards the goal but it must be done in 2 weeks and it must work. Now let's see what we can do well in that timeframe..."
- pmontra 4y agoWell, in this case it was Wednesday and I'll be working for another customer on Thursday and Friday (they know it) so that feature must be completed by Wednesday night. They accept that the quality of a feature worked on for one day will be less than the quality of a feature worked on for two or three days. Costs.
- ChrisMarshallNY 4y ago> I prefer simple straightforward code with few files to navigate to understand how it works. My files tend to be fairly large. I'll often have classes, structs, enums, or even protocols, that do a lot. I use // MARK: comments to provide a "poor man's ToC," to the code editor.