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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!news.flashnewsgroups.com-b7.4zTQh5tI3A!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: What is your opinion on Global Objects? References: Date: Thu, 20 Nov 2014 10:34:28 -0600 Message-ID: <8561e9omp7.fsf@stephe-leake.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.94 (windows-nt) Cancel-Lock: sha1:NNVaw26yevQ9DQflZQeyM5dt8U4= MIME-Version: 1.0 Content-Type: text/plain X-Complaints-To: abuse@flashnewsgroups.com Organization: FlashNewsgroups.com X-Trace: 075e8546e1816e3fb833031377 X-Received-Bytes: 1765 X-Received-Body-CRC: 2542047508 Xref: news.eternal-september.org comp.lang.ada:23571 Date: 2014-11-20T10:34:28-06:00 List-Id: Hubert writes: > That basically is a vote for global objects. Whether they are accessed > through a global variable or some sort of getter function that returns > access, it means bypassing the parameters. Well from what I read here, > there are no strong opinions for either concept. Strange, I wasn't > able to find good arguments for or against the two concepts anywhere, If you can really, truly, absolutely guarrantee that you will _never_ need two different copies of the data structure, then the singleton pattern makes sense (data in a single variable in a package body). If you ever need two different copies of the data structure, then you need to pass it around in parameters. The symbol table for a compiler is a good candidate for a singleton. A database connection is not; you will need to copy the database from one object to another when you change the schema or move to a new backend in the future. -- -- Stephe