The modern graphical world is a new complexity, but I past years I looked after 
a code base (not Pascal/Delphi) across 3 operating systems (PDP, Dos/Windows, 
and Unix) where the code was about 99.5-100% common in a code base of 1 
million+  lines.

There we isolated anything that differed in any way across platforms to 
libraries, and made a wrapper for each with a new invented common name, and 
inside the wrapper was IFDEF code for each compiler/operating system.  The 
libraries were as much as possible a single code base as well (with ifdefs).  
That was the crucial design step.

Looking back I can see some of the library routines eg screen output had ifdefs 
for TSXPL, DBL, SFW, Sibol, SFB, Unix, Debug   which covered 5 compilers on 3 
operating systems, 4 different compiler vendors (each with different memory 
models), and different versions of each compiler.  Each compiler had quite 
different syntax extensions to deal with many of the API’s  - ( None of these 
syntax extensions were allowed to be used outside of the libraries). The entire 
source code base had to be moved to each operating system and compiled there 
against the appropriate compiler and IFDEF’d library code.   However it was 
very successful for the life of all those operating systems, and is still alive 
on Windows.

Inside each IFDEF in the library, the code was native, calling the appropriate 
native APIs.  The approach can be described as “Put all the grief and problem 
stuff in just one place”   

How much simpler life and bug fixing gets with a single code base cannot be 
overstated!

For instance something that misbehaved everywhere meant look in the common 
code, something that misbehaved only on one platform meant look at the library 
wrapper routine.

When getting to Android etc projects I am sure as much as feasible I will be 
taking a similar approach.  So it can be done (in theory).  In practice I have 
yet to see!

From: Leigh Wanstead 

Hi Jolyon, 

Don't you think that 75% common code is a great success?

Regards
Leigh
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: [email protected]
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to [email protected] with 
Subject: unsubscribe

Reply via email to