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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,aea4cc77526f5e4a X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news1.google.com!news2.google.com!news.glorb.com!newsfeed2.telusplanet.net!newsfeed.telus.net!edtnps89.POSTED!023a3d7c!not-for-mail Sender: blaak@METROID Newsgroups: comp.lang.ada Subject: Re: Separate Compilation in Programming Languages References: <7xJvj.7420$Ru4.4246@newssvr19.news.prodigy.net> <5b9wj.4639$Mh2.1432@nlpi069.nbdc.sbc.com> <5Ekwj.10401$0o7.6822@newssvr13.news.prodigy.net> <%Ntwj.12620$Ch6.11402@newssvr11.news.prodigy.net> <47c39f6c$0$15196$607ed4bc@cv.net> From: Ray Blaak Message-ID: Organization: The Transcend User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 26 Feb 2008 19:08:54 GMT NNTP-Posting-Host: 208.66.252.228 X-Trace: edtnps89 1204052934 208.66.252.228 (Tue, 26 Feb 2008 12:08:54 MST) NNTP-Posting-Date: Tue, 26 Feb 2008 12:08:54 MST Xref: g2news1.google.com comp.lang.ada:20101 Date: 2008-02-26T19:08:54+00:00 List-Id: "John W. Kennedy" writes: > Actually, this doesn't accomplish as much as you wish, in practice, as it will > eventually be necessary to have a constructor for the real class, or else a > static factory method. That is true. There are ways around this. The simplest way is to have a factory class that is dynamically loaded by some other startup class that client code does not see. That way clients are never affected by the implementation classes. interface IWidgetFactory { // Root client API methods: public IWidget createWidget(blah, blah) {...} ... } class WidgetFactoryAccess { static private IWidgetFactory instance = null; static public IWidgetFactory getInstance() {return instance;} // Called by start up logic. static public void register(IWidgetFactory f) {instance = f;} } You can also do tricks like dynamically loading the implementation class at runtime from some environment-specified jar. That way there are also no compilation dependencies. Again, all this takes effort and discipline. For larger applications, one also needs to take the trouble to control the subsystem layering, since a good orthogonal design actually improves compilation times when the dependencies are minimized. This kind of thing is easier in Ada. -- Cheers, The Rhythm is around me, The Rhythm has control. Ray Blaak The Rhythm is inside me, rAYblaaK@STRIPCAPStelus.net The Rhythm has my soul.