I am hearing this more and more "Who cares? It's going away soon, just hack in a solution!" Guess what? Nothing goes away soon. Unless the replacement is fully written and ready to ship and the users have no choice but to upgrade then it is going to be around.
What is your response when this dilemma is posed to you?
I try my best to avoid hacks. I want to use the best possible coding practices when possible. So, when are they not possible? Let's say one of your apps has been internationalized and localized. You are working on an second company app that has not been. It might drive you crazy to add yet another hard coded string to that app but doing it right and starting the whole internationalization / localization process is not going to pay off in this situation.
Maybe you are on an app that has styles mixed in to the HMTL instead of being in CSS files. Not hard to create a CSS file right? Nope but it might create large changes to the build / distribution process thus doing that towards the end of a release cycle might not be the best idea.
Maybe you end up in some Java code that only uses Vectors where is should be using List and ArrayList with generics. If the collections are localized then I would probably fix them.
I find it depressing when the development staff has given up and goes into hack mode because everything is about to be replaced with a new design. I know code outlives your every expectation.
I was working at a company three years ago that was converting from Java via WebStart in the browser to C# with WPF. For some reason the CEO hated Java even though it was half their income with the other half being the C++ version of the product. Java ran on Windows, Mac and Linux. I worked on the C# product too and left for other reasons than the switch. I don't mind C# although I did not feel it was the best solution here. They pretty much only wanted hack fixes to the Java stuff.
Three years later and guess what? Yep, the Java code is still running in the field. It is taking much longer to replace than originally thought. They have moved it to Java 7 to keep up with Oracle and bug fixes.
I have seen this happen way too often. With the web it is easier to kill something. If you replace all the JavaScript on your server the next time the user hits your web page they get the new code. They don't get the choice to continue to use the old stuff. Mobile is close. Most folks update their apps unless you toss in some new crazy permissions like read all my contacts when you are a simple game. Desktop is a bit harder. Using WebStart allowed us to force the upgrade. On the Mac you get update notifications which is nice. On the PC you pretty much get patch notifications from Microsoft and then it is up to the vendor to write their own. Adobe likes to patch stuff.
As a professional programmer I like to treat all my code the same, like it will live for a long time. I don't want to fall into the hack in in trap. Design it, write it, test it then check it in. I refactor things when method and variable names are getting confusing or no longer reflect what they do. I move things into new objects when the line count in current objects gets out of hand or where a new object or base class just makes sense.
No comments:
Post a Comment