ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General Discussion » Help for source code maintenance

Post new topic  Reply to topic
 Help for source code maintenance « View previous topic :: View next topic » 
Author Message
ktg
PostPosted: Thu Feb 12, 2009 9:56 pm    Post subject: Help for source code maintenance Reply with quote

Centurion

Joined: 09 Jan 2006
Posts: 138
Location: India

Hi All,

Till now our MQ based product/applications used to run on Solaris. Now, our client have started moving this product to other operating systems. Our solaris version of product is
XYZ_Solaris_E220, we started porting to Linux and it got halted due to some reason. Now, we have started porting to AIX. Linux version of the product was supposed to be called as XYZ_Linux_E100, AIX version of the product was supposed to be called as MNO_AIX_E100 (XYZ is being rebranded as MNO ). The problem is how to maintain the source code?
In future, client may ask us to do some changes to be done to AIX version of the product and may not want that change in Linux/Solaris or he may ask us to implement/test the change in next releases of Linux/Solaris. I mean at some point of time, the same product will be having different features on differ platforms.
If we have the same source base, changes done to fix some thing on a perticular platform may introduce new bug in other platform as testing would not have done on that platform. If we are maintaining seperate codebase for each platform, we need to do the change in all codebases when the client wants a feature in all the platforms.

Which parameters could be used to decide on this.

Thanks in advance.

Regards,
Kalpana
Back to top
View user's profile Send private message AIM Address
dgolding
PostPosted: Fri Feb 13, 2009 1:12 am    Post subject: Reply with quote

Yatiri

Joined: 16 May 2001
Posts: 668
Location: Switzerland

The relevance to MQ seems zero, but anyway, this is a basic software librarian question.

#define __AIX_OS

......

#ifdef __AIX__OS
<AIX specific stuff>
#endif

#ifdef __SOL_OS
<SOL specific stuff>
#endif


Last edited by dgolding on Fri Feb 13, 2009 1:17 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
exerk
PostPosted: Fri Feb 13, 2009 1:13 am    Post subject: Reply with quote

Jedi Council

Joined: 02 Nov 2006
Posts: 6339

I'm no developer but logic tells me to keep a common 'vanilla' code base (with appropriate if def statements) and modularise the bespoke elements for each platform.

Now awaiting being put straight by someone whom knows what it is they're talking about...
_________________
It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Fri Feb 13, 2009 3:59 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

As much as possible, you should move platform specific code into it's own source or header files, so that only the #include part of your code is littered with #ifdefs.

MS03, for example, does not handle this very well.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Feb 13, 2009 4:05 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Depending on how smart your source code repository is, you might be able to individually label different source code items, so when you compile for Solaris, you pull out the "Solaris" label and when you make a Linux binary you pull out the "Linux" label. Different versions of the same source could be branched for different OS platforms.

You'll still need some fairly rigerous procedures round this to ensure the same fix ends up in all the versions when you want it to, and a platform specific fix doesn't bleed into the others when you don't.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
gbaddeley
PostPosted: Wed Feb 18, 2009 6:47 pm    Post subject: Reply with quote

Jedi Knight

Joined: 25 Mar 2003
Posts: 2538
Location: Melbourne, Australia

dgolding wrote:
#define __AIX_OS

......

#ifdef __AIX__OS
<AIX specific stuff>
#endif

#ifdef __SOL_OS
<SOL specific stuff>
#endif


I've been doing multi platform support of common base code in C for more than 10 years, and this is a very practical and simple solution. The differences between various flavours of Unix (& Windows & z/OS) is less than you think. A common difference is that some need different header files, eg. Solaris needs ctype.h for islower() etc, but others do not.

Most O/S's can be detected without defining extra macros or using command line defines. eg. I put something this in a common header file:

#if defined(_HPUX_SOURCE)
#define E_HPUX
#define E_UNIX
#define E_PLAT "HP-UX"
#elif defined(sun)
#define E_SUN
#define E_UNIX
#define E_PLAT "Solaris"
#elif defined(_AIX)
#define E_AIX
#define E_UNIX
#define E_PLAT "AIX"
#elif defined(Linux)
#define E_LINUX
#define E_UNIX
#define E_PLAT "Linux"
#elif defined(_WIN32)
#define E_WIN32
#define E_WINDOWS
#define E_PLAT "Windows 32bit"
#elif defined(__MVS__)
#define E_ZOS_BATCH
#define E_PLAT "z/OS Batch"
#else
"Undefined environment";
#endif
_________________
Glenn
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General Discussion » Help for source code maintenance
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.