Computerworld
Quick Menu
Search



Ads by TechWords

See your link here


Subscribe to our e-mail newsletters
For more info on a specific newsletter, click the title. Details will be displayed in a new window.
Application/Web Development
Computerworld Daily News (First Look and Wrap-Up)
Computerworld Blogs Newsletter
The Weekly Top 10
More E-Mail Newsletters 
Computerworld 2007Subscribe to Computerworld
40 years of the most authoritative source of news and information for IT leaders.

Opinion: Code swapping and taking time writing software

July 31, 2008 (Industry Standard) There's never time enough to do it right the first time, but there's always time to do it over again, or so the old adage goes.

The last couple of projects I've worked on have ended up including the rewriting of the code in another language after the initial launch. In one case it was for performance reasons. In another case it was because the bulk of the company's code was in a particular language, but it was quicker and easier to do from scratch using a different language.

In today's "just get it out there" culture, we often seem to make design decisions based on short-term expediency in order to get a product out the door, while failing to consider the longer term ramifications. This often leads to substantial lost productivity both in trying to diagnose and patch problems, and then rewriting the code where necessary. Sometimes, this can also lead to pain for the users.

For example, Twitter's scaling issues and potential problems with the Ruby on Rails framework are well known. While Ruby on Rails is exceptional when it comes to building Web tools quickly, Twitter is a victim of its own tremendous success, as they clearly didn't plan for the kind of scaling they now require. They are apparently considering rewriting portions of the code to improve performance.

The folks at reddit transformed their site from Lisp to Python, resulting in less code that ran faster and was far easier to read and maintain.

Of course there is a possible upside to rewriting your code that I've often noticed. When you go through your code for the second time you always get to improve it, cleaning up the messy stuff you put in the first time just to get it to work, and you get to clean up the performance issues you've already seen.

My last project had a very messy piece of JavaScript code that passed arrays back and forth with a piece of PHP code, in order to allow the Web page to be rewritten on the fly. When I rewrote the PHP code using Java Server Pages (JSP) instead, I was able to clean up the JavaScript substantially, improving the performance and making it easier to support in the future. Which is wonderful, but it extended the time and cost of the project by about 50% over the time and cost of doing it right the first time.

But when do you stop rewriting the code? Neil Gunton calls this "Rewrite Mania" -- the tendency of engineers to always want to make things better. Sometimes good is good enough. Rewriting code also has the bothersome side effect of introducing new and unexpected bugs.


Reprinted with permission from

For more news on the Internet Economy, visit The Industry Standard.
Story Copyright 2008 The Industry Standard. All rights reserved.

What People Are Saying

XenServer FREE trial
XenServer FREE trial
Citrix XenServer is the simplest and most effective way to virtualize and provision servers. XenServer combines comprehensive server virtualization capabilities with unparalleled scalability, performance, economics, and ease-of-use. Based on the open source Xen hypervisor, XenServer delivers fast performance, easy management, and advanced features such as live migration.

Request free trial now

White Papers
Intercept Spam & Viruses With MessageLabs
MessageLabs is offering a complimentary 30 day trial of its managed Anti-virus and Anti-spam security solutions. MessageLabs guarantees complete protection against all know and unknown email threats. By providing 24 hour support, your business can increase productivity and decrease risk. Register for a complimentary trial and receive a free datasheet.
Download this white paper now! 
White Papers
Read up on the latest ideas and technologies from companies that sell hardware, software and services.
The 2008 ERP in Manufacturing Benchmark Report Summary
IronPort Web Reputation Filters Tech Note
Designed to Manage Lean Principles
View more whitepapers