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!news.glorb.com!peer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post02.iad.highwinds-media.com!fx26.iad.POSTED!not-for-mail From: Hubert User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: What is your opinion on Global Objects? References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 141118-2, 11/18/2014), Outbound message X-Antivirus-Status: Clean Message-ID: X-Complaints-To: abuse@newsdemon.com NNTP-Posting-Date: Wed, 19 Nov 2014 02:50:22 UTC Organization: http://www.NewsDemon.com Date: Tue, 18 Nov 2014 18:50:27 -0800 X-Received-Bytes: 2016 X-Received-Body-CRC: 3716532366 Xref: news.eternal-september.org comp.lang.ada:23537 Date: 2014-11-18T18:50:27-08:00 List-Id: On 11/18/2014 3:23 AM, Brian Drummond wrote: > On Mon, 17 Nov 2014 19:08:03 -0800, Hubert wrote: > >>> This is only a problem in poorly designed languages. In Ada these >>> "singletons" >>> should be packages. > >> What is the best way to access such an object > > Through the accessor subprograms supplied by the package. > > - Brian > 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, I guess they are just used interchangeably in applications. Personally I am for global objects since they keep the interfaces smaller and avoid tramp data, the problem I see is just the unit test setup. Subprograms with side effect are hard to test automatically --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com