4 ms·
I can relate to this. There is a real risk in freezing up when you attempt for your first writing of code to be the fully architected solution. I would still g
by munger 13y ago
I can relate to this. There is a real risk in freezing up when you attempt for your first writing of code to be the fully architected solution.
I would still go one step further and at least apply the strategy pattern/polymorphism when you have a large if/else/case block going beyond 2 or 3 conditions in a controller or model or something. (assuming MVC web apps)
The fact is you can write out some ugly code directly in a controller where it might get some code working fast and prevent the freeze up of your output, but once working you should immediately move it to the appropriate place like a model or library, and apply a basic OO strategy pattern (perhaps not with factory/interfaces etc until needed later) where appropriate to cut down on spaghetti/nested conditionals.
This really does not take much more time than stopping at working code that is ugly, and is a good middle ground where it is not painful to return to later.
There is still no good excuse for "taking a dump in the corner" of your code base just to get a marginal gain in output.