Krishna Kumar is a software development manager from New Hampshire. He writes on topics related to software development, programming, project management, and business management. Krishna is a DZone MVB and is not an employee of DZone and has posted 41 posts at DZone. You can read more from them at their website. View Full User Profile

The Rusting Of Software

06.06.2012
| 2928 views |
  • submit to reddit

One project I have been working on recently is a code upgrade of an existing enterprise web application. It is not a re-engineering effort, but instead only consists of necessary code changes to get the application working with the latest versions of the system software. The application had been in use for several years, and the existing development effort was concentrated on new features and maintenance, and the customer only prioritized the shift as they recognized many infrastructure issues.

The project was an illustration of how good code written in the past can become terrible even if no one has touched it. As Lewis Carroll wrote through the mouth of the Red Queen, “it takes all the running you can do, to keep in the same place”. Here are some thoughts:

  1. If you have the ability to choose a particular programming language and platform (your expertise being equal in the choices available), you would most likely make a different decision at different times. A choice made with good reasons years ago may seem bad today.
  2. How some of the relative strengths of different languages change over time and others don’t. When it was a released, C# was a joke, an impostor to Java. Today, with Java’s stagnation, it is light years ahead. But when it comes to third party software (especially open source), Java still has considerable strength.
  3. The progress of languages and availability of external packages and utilities makes new code look entirely different from older code, even though they are both written in the same language.
  4. The increase in test-driven development (along with the network-driven popularity of some frameworks) has also driven changes in the organization of code, something that had to be previously driven by disciplined adherence to standards. In other words, falling into the pit of success.
  5. How many millions of man-years have been wasted on writing code for complex frameworks designed by bureaucrats? Not to mention money spent on earning silly certifications to prove yourself competent in them. (You know what I am referring to!)
  6. Convention over configuration. A simple concept that makes for incredible productivity.
  7. In the short-term (as measured in months), it is probably less relevant. But when an application use spans years, the gains from better hardware makes a mockery of many code-level decisions for performance optimization. In the long run, it is always better to write better, decoupled code than have to write code that has to work around hacks.

The great moments in refactoring existing code are when you can simply delete vast chunks because they are superfluous or because you can drop in some external library to do the same work. But most changes require a scalpel instead of an ax. The typical approach is to build “scaffolding” by writing test cases that work against the existing code and then change the code as necessary while continuing to pass the test cases. This ensures that the upgraded product not only contains good code, but has been verified to exhibit the same behavior.

Published at DZone with permission of Krishna Kumar, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Fahmeed Nawaz replied on Tue, 2012/06/12 - 11:04am

hi,can anyone tell me does it mean that mongodb service is available when the method of DBTCPConnector.isOpen() return true.Is it a useful method to judge connections is ok or not.thank you.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.