neeno166214dI generally end up over engineering everything so the code is general enough to accommodate any future features. I do this in every single project I work on. After a few hours of trying to come up with a good solution I realize I'm just wasting time, so I scrap everything and go with the simplest solution. Sometimes it's easier and faster to write simple code and if the requirements change, just rewrite it.
sladuled727113dI usually try to predict if the client will want to also have B, C and maybe even D along with the A..
If the answer is yes, most probably I'll put in some time to rewrite everything as it'll be easier to implement B, C and D in the cleaner code without extra spagetti voodoo..
Of course, I explain & discuss this with the boss.. sometimes we go straight to rewriting, sometimes it's implement A right away so the client is not pissy, but start on rewriting and impelemnting A, B, C & D as soon as you finish with old A..
If you're in the position to make such decisions alone, check if things can easily be added/changed in the old code.. if not, I think it's worth rewriting for the long run benefits.