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!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: What is your opinion on Global Objects? Date: Thu, 20 Nov 2014 22:35:16 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Injection-Date: Thu, 20 Nov 2014 21:35:05 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="2b3884a634d8f846e0712b4e3a92507a"; logging-data="9440"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18auKTI4mcbtvMI5Ws+hfWC" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 In-Reply-To: Cancel-Lock: sha1:ylezokla1b7vtqEv1HT6esS3dgY= Xref: news.eternal-september.org comp.lang.ada:23580 Date: 2014-11-20T22:35:16+01:00 List-Id: Le 20/11/2014 21:33, sbelmont700@gmail.com a écrit : > For what it's worth, I'm in the "pass everything as an argument" camp > (and really functional programming in general), and loathe the > 'hidden state' setup, for the following reasons: Let's see what the other camp has to respond... > 1. You are hardcoded to a particular implementation (i.e. no dispatching) Yes, it is more static, therefore safer and more easily provable. Dispatching is a very powerful tool, but only when you really need it. > 2. You always end up needing a second object, no matter much you think you don't think you will. Doesn't meet my experience. Knowing that by design there can be only one object simplifies understanding and provability. You don't have to worry about which object you are dealing with - there is only one. > 3. The majority of the program becomes impure ??? Please explain you notion of "purity". > 4. Things that access global objects are way more complex to try and test Yes, when accessing in uncontrolled ways global variables from multiple places. No with proper encapsulation (like here) with accessors and selectors that can control exclusive access if necessary. > 5. Everything is compile-time constant (i.e. no creating or deleting things dynamically). I would regard this as a huge benefit - dynamicity has always been opposed to simplicity and provability. -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr