JOB REFERRALS
    ON THIS PAGE
    ARCHIVES
    CATEGORIES
    BLOGROLL
    LINKS
    SEARCH
    MY BOOKS
    DISCLAIMER
 
 Sunday, October 30, 2005
Porting legacy code

Matt Davey poses an interesting question:

The problem:
  • C++ Corba legacy codebase (5+ years old, 1 million lines)
  • No unit tests
  • Little test data
  • Limited knowledge transfer from the original development team.
  • A flake environment to run the application in.
The requirement:
  • Port the C++ result accumulation and session management code to Java
Do you:
  1. Write C+ unit tests to understand the current system, then write Java equivalent code using TDD
  2. Write Java tests using TDD based on your understanding of the C++ code
  3. Hope you understand the C++ code, and JFDI in Java
  4. Give up and go home
  5. Get the original development team to do the work
Ah, I love the smell of legacy code in the morning. :-)

My answer: depends. (Typical.) Here's what I mean:

  • Option 1 is clearly the "best" answer if the goal is to produce code that will most accurately match what the current C++ code is doing, but also represents the greatest time and energy commitment, as well as making the fundamental assumption that what the C++ code does today is correct in the first place.
  • Option 2 is the approach to take if the time crunch is a bit tighter and/or if the C++ unit tests can't be sold to management ("You're just going to throw them away anyway!"), particularly if the team working on the port has many or all of the original C++ devs. It also allows for the inevitable "You know, we always wanted to change how that code worked, so why don't we...." requirements changes.
  • Option 3 is probably appropriate in those shops where WHISKEY (Why the Hell Isn't Somebody Koding Everything Yet) is considered an acceptable development methodology, but the lack of unit tests for the Java port will catch up to you someday (as it always does).
  • Option 4 is probably best if the company you work for is seriously considering Option 3. :-)
  • Option 5 is only viable if the original development team is available (not going to happen if you outsourced it, by the way), able to work on it (meaning they've flipped the switch to Java at both a syntactic and semantic level), and isn't otherwise engaged on another project (which is probably the dealbreaker).
Matt also left out a few options:
  • 6. Let management believe in the whizzy-bang code conversion wizard that such-and-such company is trying to sell them on that "guarantees" 99% code translation and compatibility
  • 7. Let management outsource the port, and let them worry about it
  • 8. Give it all up and start from scratch--who needs that system anyway? It's not like anybody ever really used it, right?

Porting legacy code is one of the least-favorite projects of any software developer, but what few developers seem to realize is that they're also the least-favorite of management, too: it's a project that has no discernible ROI beyond that of "getting us out of the Stone Age". You might argue that the code becomes more maintainable if it's written in whatever-the-latest-technology-flavor-is-today, but the truth of the matter is, today's hot language is tomorrow's legacy language, subject to being rewritten in tommorrow's hot language. (Any programmer who's been writing code for more than five years probably already knows this, and any programmer who's been writing code for more than 10 years almost certainly knows this.)

Companies have been on this hamster wheel for far too long. Having gone through several transitions, particularly the C++-to-COM/CORBA-to-Java/EJB transitions over the last decade--and they're starting to resist if not outright reject the idea. Instead, they're preferring to find ways to create interoperable solutions rather than ported solutions--hence the huge interest in Web services when they first came out (and the interest in CORBA when it first came out, and the interest in middleware products in general like Tuxedo when they first came out, and so on). Integration still remains the "hard problem" of our industry, one that none of the new languages or platforms seem to want to address until they have to. Witness, for example, Sun's reluctance to really adopt any sort of external-facing technology into Java until they had to (meaning the Java Connector Architecture; their adoption of CORBA was half-hearted at best and a PR move at worst). .NET suffers the same problem, though fortunately Microsoft was wise enogh to realize that shipping .NET without a good Win32/COM interop story was going to kill it before it left the gate. C++ at least had the advantage of being call-compatible with C (if you declared the prototypes correctly), and so could automatically interop against the operating system's libraries pretty easily. In fact, it could be argued that C has long been the de-facto call-level compatibility interoperability standard (Python has C bindings, Ruby has C bindings, Java reluctantly, it seems, support C bindings through JNI, and so on), but of course that only works to a given platform/OS, since C offers so little by way of standardization and the operating systems have never been able to create a portable OS layer beyond the simple stuff; POSIX was arguably the closest they came, and many's the POSIX programmer who will tell you just how successful THAT was.

My point? I hereby declare a rule that any new language developed should think first about its interoperability bindings, and developers contemplating the adoption of a new language must flesh out, in concrete form, how they will integrate the hot new language into their existing architecture, or else they can't use it. (Yes, this applies equally to Ruby, Java, .NET, C++, and all the rest, even FORTRAN--no exceptions.) If you can't describe how it'll integrate into your current stuff, then you're just fascinated with the bright shiny new toy and need to grow up. It doesn't really matter to me how it integrates--through a database, through files on a filesystem, through a message-passing interface like JMS, or through a call-level interface, just have SOME kind of plan for hooking your new <technology X> project into the rest of the enterprise. (And yes, those answers are there for each of those languages/platforms; the test is not whether such answers exist, but how they map into your existing infrastructure.)

What's more, I hereby rededicate this blog to finding interoperabilty solutions across the technology spectrum--got an interop problem you're not sure how to solve? Email me and (with your permission) I'll post the response--sort of an "Ann Landers" for interop geeks. :-)

By the way, this conundrum can be genericized pretty easily using generics/templates:

enum Q
{
  No, Bad, Little, Flakey, Untouchable
};
enum technology
{
  C, C++, Java, C#, C++/CLI, VB 6, VB 7, VB 8, FORTRAN, COBOL, Smalltalk, Lisp, ...
};

Problem<technology X, technology Y, type T extends AbstractTest, enum Q>:
{
  • <X> legacy codebase (<int N where N > 1> years old, <int L where L > 1000> lines)
  • No <type T> tests
  • <Q> test data
  • <Q> knowledge transfer from the original development team
  • <Q> environment to run the application in.
} returning requirement:
  • Port the <X> project to <Y>
(I thought about doing it in Schema, but this seemed geekier... and easier, given all the angle-brackets XSD would require. ;-) )


.NET | C++ | Development Processes | Java/J2EE | Ruby | XML Services

Sunday, October 30, 2005 1:17:33 PM (Pacific Daylight Time, UTC-07:00)
Comments [19]  |  Related posts:
From the "Team-Building Exercise" Department
From the "Gosh, You Wanted Me to Quote You?" Department...
From the "You Must Be Trolling for Hits" Department...
Blog change? Ads? What gives?
Object.hashCode implementation
Of Zealotry, Idiocy, and Etiquette...
Tracked by:
"Legacy code conundrum" (Raj's Blog) [Trackback]
http://www.google.com/search?q=vapcqrml [Pingback]
http://enablingbiz.com/enable/fioricetonline.htm [Pingback]
http://planetmind.net/ann/hydrocodone.htm [Pingback]
http://rrresorts.com/stats/reports/orderxanax.htm [Pingback]
http://taylorstreetstudio.com/newblog/hydrocodoneonline.htm [Pingback]
http://meridainsider.com/albums/buyphentermineonline.htm [Pingback]
http://vinceherman.com/blog/tramadolbuy.htm [Pingback]
http://meridainsider.com/albums/genericcialisonline.htm [Pingback]
http://www.tbihome.org/cgi-bin/mindmenders/mindmenders.pl?read=6356 [Pingback]
http://aguyinnewyork.com/archives/2005/meridia.htm [Pingback]
http://stylishwebs.com/ads/images/tramadolonline.htm [Pingback]
http://jamiejanover.com/ubb/alprazolamonline.htm [Pingback]
http://meridainsider.com/albums/buybuyvalium.htm [Pingback]
http://angliangardener.co.uk/furniture/valium.htm [Pingback]
http://conec.com/tmp/phentermineprescription.htm [Pingback]
http://cogiscan.com/pdf/img/buybuyvalium.htm [Pingback]
http://icebox.com/catalog/images/adipex.htm [Pingback]
http://princegeorges.org/archives/2005/alprazolam.htm [Pingback]
http://net-commish.com/images/ambien.htm [Pingback]
http://diggerhistory.info/forum/images/smiles/valiumxanax.htm [Pingback]
http://suburbanblight.net/archives/images/aboutphentermine.htm [Pingback]
http://content-maven.com/articles/imgs/phentermine.htm [Pingback]
http://www.factordesign.com/user_edit/img2/prescription-phentermine.htm [Pingback]
http://www.promisesproject.org/counter/database/propecia.htm [Pingback]
http://acccn.com.au/db_backup/buyhydrocodoneonline.htm [Pingback]
http://www.galisteoinn.com/12all/admin/images/buy-soma.htm [Pingback]
http://www.promisesproject.org/counter/database/phentermine.htm [Pingback]
http://paigemaguire.com/albums/cost-low-phentermine.htm [Pingback]
http://www.mnisose.org/wwwboard/messages/16251.html [Pingback]
http://www.olhausenbilliards.com/images/accessorieslarge/phentermineorder.htm [Pingback]
http://creativespaceonline.com/images/uploads/.sessions/wwwphentermine.htm [Pingback]
http://www.sc27.org/SC27Crew/posts/2750.html [Pingback]
http://www.neonshop.com/neon-l/techdex.cgi?read=2831 [Pingback]
http://www.sc27.org/SC27Crew/posts/2751.html [Pingback]
http://eclectics.com/guestbooks/templates/diazepam.htm [Pingback]
http://bizcarta.com/Discovery2005/orderphentermineonline.htm [Pingback]
http://dginteractive.com/cgi-bin/webbbs_config.pl?noframes;read=509 [Pingback]
http://www.laughingenglish.com/activity.php?pkey=195 [Pingback]
http://bizcarta.com/Discovery2005/meridia.htm [Pingback]
http://musicsound.tv/skin1/ativan.htm [Pingback]
http://www.wpctv.com/aspBoardDetail.asp?Id=2170 [Pingback]
http://finalexit.org/ergo-store/feed/hoodia.htm [Pingback]
http://bizcarta.com/Discovery2005/phentermine-buy-online.htm [Pingback]
http://onc-rpc.com/forums/rpc/posts/10998.html [Pingback]
http://www.foolforlove.biz/talk/messages/213.shtml [Pingback]
http://www.foolforlove.biz/talk/messages/215.shtml [Pingback]
http://nydolls.org/images/albums/lexapro.htm [Pingback]
http://www.meetingmrright.com/boards/messages/11276.shtml [Pingback]
http://aitr.org/ev/images/tramadol.htm [Pingback]
http://cbnindia.org/1cubed/images/phentermineadipex.htm [Pingback]
http://albinocode.com/phpml/attachments/buy-phentermine-online.htm [Pingback]
http://balticonpodcast.org/wordpress/wp-content/themes/classic/soma.htm [Pingback]
http://aitr.org/ev/images/adipex.htm [Pingback]
http://cbnindia.org/1cubed/images/fitness.htm [Pingback]
http://albinocode.com/phpml/attachments/prozac.htm [Pingback]
http://spacecasestv.com/bboard/attachments/alprazolam.htm [Pingback]
http://finalexit.org/ergo-store/feed/cialis.htm [Pingback]
http://aitr.org/ev/images/ultram.htm [Pingback]
http://www.k-praxis.com/archives/blogging/alprazolam.htm [Pingback]
http://www.cdverkauf.com/banner/nexium.htm [Pingback]
http://www.google.com/search?q=yadggsbb [Pingback]
http://www.google.com/search?q=racxdsot [Pingback]
http://www.google.com/search?q=ksxayovn [Pingback]
http://www.google.com/search?q=obkehzdo [Pingback]
http://www.olhausenbilliards.com/images/accessorieslarge/tramadolonline.htm [Pingback]
http://jeunesdumaroc.com/gallerie/xanax-valium.htm [Pingback]
http://sdmrm.org/calendar/soma.htm [Pingback]
http://jeunesdumaroc.com/gallerie/vicodin.htm [Pingback]
http://autismillinois.com/directory/valium-xanax.htm [Pingback]
http://www.allknightaccess.com/betatesting/transcode/buycialisonline.htm [Pingback]
http://kingstoune.com/myblog/share/about-phentermine.htm [Pingback]
http://nugraphic.com/docs/hydrocodone.htm [Pingback]
http://photoblog.habibis.net/archives/animals/fitness.htm [Pingback]
http://kipaddotta.com/Web_store/Pgpfiles/diazepam.htm [Pingback]
http://rayhane.com/blog/ecrire/images/paxil.htm [Pingback]
http://photoblog.habibis.net/archives/animals/medicalbilling.htm [Pingback]
http://kipaddotta.com/Web_store/Pgpfiles/fioricet.htm [Pingback]
http://jeunesdumaroc.com/gallerie/ultram.htm [Pingback]
http://www.primas.at/images/bla/buytramadol.htm [Pingback]
http://bbiverson.com/fmimages/alprazolam-online.htm [Pingback]
http://jeunesdumaroc.com/gallerie/phentermine.htm [Pingback]
http://photoblog.habibis.net/archives/animals/zyrtec.htm [Pingback]
http://myplugins.info/itfixit/cache/ultram.htm [Pingback]
http://mutagenix.org/forums/images/avatars/ultram.htm [Pingback]
http://www.progamerhosting.com/templates/images/zoloft.htm [Pingback]
http://articlesubmitterpro.com/blog/maillist/valium.htm [Pingback]
"http://9nl-information.info/35721720/index.html" (http://9nl-information.info/3... [Pingback]
"http://9nt-information.info/91360262/index.html" (http://9nt-information.info/9... [Pingback]
"http://9nd-information.info/05935895/lacys-rib-house.html" (http://9nd-informat... [Pingback]
"http://9nw-information.info/69460660/ubu-personalized-products.html" (http://9n... [Pingback]
"http://9nd-information.info/24694387/the-stenbuck-company.html" (http://9nd-inf... [Pingback]
"http://9na-information.info/00940663/religious-literature.html" (http://9na-inf... [Pingback]
"http://9nt-information.info/31864993/index.html" (http://9nt-information.info/3... [Pingback]
"http://9nb-information.info/17391426/index.html" (http://9nb-information.info/1... [Pingback]
Sunday, October 30, 2005 2:03:57 PM (Pacific Daylight Time, UTC-07:00)
What about

-writing a java wrapper to the legacy stuff

-writing the junit tests against the wrapper. these become the normative specification of behaviour.

-transiting from wrapper from pure java over time, using the unit tests to verify the quality of the transition

The problem with this is that the tests may force the existing architecture to remain, and that may not be the best approach.
Steve Loughran
Tuesday, November 08, 2005 1:14:44 PM (Pacific Standard Time, UTC-08:00)
Man, what timing. I just wrote up how we were doing something similar on my blog a couple of days before this. We are using acceptance test frameworks such as Fit, Fitnesse, and Selenium (which we tied together into one package) to get the business logic tied down. This is a good way to do it if you have existing users who know how the existing system works or should work. This works best with a web application right now, but there is no reason why you couldn't run this against any type of application since there are Fitnesse fixtures for .NET and Java Swing already.

Here is the blog entry link:
http://jroller.com/page/csterwa/20051027
Friday, March 02, 2007 10:13:49 AM (Pacific Standard Time, UTC-08:00)
generic wellbutrin
Friday, March 02, 2007 10:14:16 AM (Pacific Standard Time, UTC-08:00)
generic soma
Friday, March 02, 2007 10:14:37 AM (Pacific Standard Time, UTC-08:00)
generic ultram
Friday, March 02, 2007 10:15:00 AM (Pacific Standard Time, UTC-08:00)
brand watson soma
Friday, March 02, 2007 10:15:23 AM (Pacific Standard Time, UTC-08:00)
brand and generic ultram
Friday, March 02, 2007 10:15:53 AM (Pacific Standard Time, UTC-08:00)
acyclovir prescription
Friday, March 02, 2007 10:16:17 AM (Pacific Standard Time, UTC-08:00)
generic paxil
Friday, March 02, 2007 10:16:41 AM (Pacific Standard Time, UTC-08:00)
brand viagra
Friday, March 02, 2007 10:17:04 AM (Pacific Standard Time, UTC-08:00)
brand and generic fexeril
Friday, March 02, 2007 10:17:29 AM (Pacific Standard Time, UTC-08:00)
generic ultram
Friday, March 02, 2007 10:17:49 AM (Pacific Standard Time, UTC-08:00)
generic celexa
Friday, March 02, 2007 10:18:07 AM (Pacific Standard Time, UTC-08:00)
generic zoloft
Friday, March 02, 2007 10:18:55 AM (Pacific Standard Time, UTC-08:00)
free porn videos
Friday, March 02, 2007 10:19:14 AM (Pacific Standard Time, UTC-08:00)
free porn videos online
Friday, March 02, 2007 10:19:34 AM (Pacific Standard Time, UTC-08:00)
brand cialis
Friday, March 02, 2007 10:20:02 AM (Pacific Standard Time, UTC-08:00)
generic fioricet
Sunday, April 22, 2007 12:36:07 AM (Pacific Daylight Time, UTC-07:00)
goood
Comments are closed.