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,34257fd17abeba14 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed-0.progon.net!progon.net!news-zh.switch.ch!switch.ch!cernne03.cern.ch!cern.ch!news From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: [SPARK] Code safety and information hiding Date: Mon, 21 Aug 2006 09:25:22 +0200 Organization: CERN - European Laboratory for Particle Physics Message-ID: References: <%%QFg.913090$084.629274@attbi_s22> NNTP-Posting-Host: abpc10883.cern.ch Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sunnews.cern.ch 1156145122 18881 (None) 137.138.37.241 X-Complaints-To: news@sunnews.cern.ch User-Agent: Thunderbird 1.5.0.5 (X11/20060801) In-Reply-To: Xref: g2news2.google.com comp.lang.ada:6288 Date: 2006-08-21T09:25:22+02:00 List-Id: Jeffrey R. Carter wrote: > As you're probably aware, rules with "always" in them always have > exceptions (including this rule). I have a rule that says always avoid > global variables. I'll accept a small number of well documented global > variables sometimes if the alternative is worse. It's interesting to see this discussion, especially after the posts revealing that it's not really clear what "global" means. Let's say I have a program composed of some subroutines or packages. Each subroutine has some local variables and each package has some state and together they all cooperate according to what the whole is supposed to do. Then I decide to break the system into separate processes, and for the sake of discussion what was a subroutine (or a package) originally becomes a separate process, all communicating using some form of IPC and still cooperating to achieve the supposed goals. The point is that while chopping the system into pieces, what was local (or state) variable originally became global in the resulting smaller program. Now - did I break SW principles and should I go to hell for making N programs with M global variables in each? After all, if I draw the whole on the whiteboard, the diagram is the same as it was at the beginning, with boxes encapsulating state and arrows depicting the only possible interactions. So? :-) -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/