Re: C++ implementation for C API ---- converting legacy C code to C++



H. S. Lahman wrote:
Responding to Masood...

In this day and age, you never say no to any work that is thrown at you
---- so when I was offered this short-term contract to convert legacy C
code to C++, I did not say no.  Personally I believed that it was a
somewhat futile exercise since one of the main requirements was for the
existing API (a functional interface written in C) to remain the same.
I would have much rathered that the mandate be ab-initio, but that was
not the case here.  My client had a bad experience with OO, and they
wanted to re-tread this path very very carefully.  They were convinced
that a "phased approach" to OO worked much better for them.


I basically agree with Nolan. Don't convert the C code; rewrite in C++ from the ground up.

That's fine if you wrote the code or feel that you understand it well, but the world is littered with half-done replacement projects that people where people thought that the understood the original system. It can be done, but often a better way of going is to introduce enough OO in the code base to get tests in place then you can refactor or replace pieces as necessary.



Michael Feathers author, Working Effectively with Legacy Code (Prentice Hall 2005) www.objectmentor.com .



Relevant Pages

  • Re: Message Broker Architecture
    ... >>same so far as the legacy code is concerned. ... >>replacing a local client with a subsystem that can talk to a remote ... > Let's assume also that remote clients use TCP sockets. ... >>currently talks to a local client. ...
    (comp.object)
  • Date Question...
    ... Have a SQL Server database that I am populating (for a client) using file ... legacy files, I am including a data/time stamp. ... developing reports (I say 'loose' because a set of associated weeks files ...
    (microsoft.public.sqlserver)
  • Re: ddm.box
    ... The advanced client does a location request to an MP looking for a local DP ... It's possible the legacy and advanced client are going to different DP's ... Is the site server machine account an admin on all site systems for ... >> Do you have the SQL Server on the site server? ...
    (microsoft.public.sms.admin)
  • Re: Login Script
    ... You can use capinst.exe to isntall both legacy and advanced clients. ... However, if you are on SP1 the legacy client is not supported for Win2K, XP, ...
    (microsoft.public.sms.installer)
  • Re: Sample Login Scripts
    ... You can always use the good old reskit util "ifexist" and look for files in ... We run Windows 2000/XP which will run the ... advanced client, but we have some Windows 98 boxes that will need the legacy ...
    (microsoft.public.sms.admin)