From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d694b5818a5102b1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-09-22 08:34:05 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!EU.net!Germany.EU.net!news.dfn.de!swiss.ans.net!newsgate.watson.ibm.com!watnews.watson.ibm.com!ncohen From: ncohen@watson.ibm.com (Norman H. Cohen) Newsgroups: comp.lang.ada Subject: Re: Naive question about system dependencies Date: 22 Sep 1994 14:54:10 GMT Organization: IBM T.J. Watson Research Center Distribution: world Message-ID: <35s5qi$174n@watnews1.watson.ibm.com> References: <35f559$mad@info.epfl.ch> <85B716C4188@annwfn.com> Reply-To: ncohen@watson.ibm.com NNTP-Posting-Host: rios8.watson.ibm.com Date: 1994-09-22T14:54:10+00:00 List-Id: In article <85B716C4188@annwfn.com>, merlin@annwfn.com (Fred McCall) writes: |> In <35f559$mad@info.epfl.ch> weber@lglsun.epfl.ch Mats Weber writes: |> |> >In many cases, a single package specification with different bodies |> >solves the problem. In other cases, the private part of the package |> >needs to be different in different variants (this means duplication of |> >the spec in Ada 83, Ada 9X has significant imporvements for handling |> >such cases). |> > |> >Using a good file naming convention helps a lot in managing the |> >different versions. We use something like this: |> > |> >sql_interface.ads (common package spec) |> >sql_interface-oracle-vms.adb (body for Oracle under VMS) |> >sql_interface-sybase-unix.adb (body for Sybase under UNIX) |> > |> >Despite the amount of code duplication, I prefer this to a preprocessor |> >approach. |> |> One thing to be *very* wary of -- during maintenance, if you find and |> fix a bug in one variant, you'd better check all those other alternate |> bodies for the same bug and apply the same fix. I agree with the |> difficulty of reading heavily ifdef'd sources, but they do have the |> advantage of putting all the source code in one place (which simplifies |> source control on bug fixes). Quite true. That's why the design should strive to isolate the target dependencies as much as possible. Ideally, the multiple versions differ only in a few very small units that define a few exported constants and low-level subprograms differently, but invoke common code that constitutes the bulk of the system. -- Norman H. Cohen ncohen@watson.ibm.com