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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,60e2922351e0e780 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-11 07:36:58 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newshub.sdsu.edu!small1.nntp.aus1.giganews.com!border1.nntp.aus1.giganews.com!intern1.nntp.aus1.giganews.com!nntp.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 11 Nov 2003 09:36:57 -0600 Date: Tue, 11 Nov 2003 10:36:56 -0500 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Clause "with and use" References: <3FA2CDCB.500F4AF0@fakeaddress.nil> <1068123815.335508@master.nyc.kbcfp.com> <3FAAB12E.C7593B45@fakeaddress.nil> <3FACCBFB.9D288CF2@fakeaddress.nil> <3FAF8C99.5040201@noplace.com> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <7KWdnct0w8mEnyyiRVn-hA@comcast.com> NNTP-Posting-Host: 24.34.214.193 X-Trace: sv3-RqtZYf9u5jn5eh4USFeXkkbLAZNUpaDiCJZo3O3855kK5jf+ya9D0ZZpsplnm0DC3/+fARBht+t+zjh!Wz1XPBSL6KpuH4fh6Ap/TSemWYvtNU+acHuDmGpWXF1161fjMPkZLoCeJIoJHg== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:2351 Date: 2003-11-11T10:36:56-05:00 List-Id: Russ wrote: > I think that's a very good analogy to what you are saying. The > "context" section at the beginning of nearly every Ada file is like > the front yard of a home. It's the first thing anyone who reads the > file sees. If it's unnecessarily cluttered, people may not complain > about it, but it will leave a lasting first impression. I think again you are missing the entire point. Why is all that stuff you call junk in the front yard in the first place? Because a lot of effort when into developing a set of requirements that specified where that "junk" goes. Some of it doesn't look pretty, but burying it in the back yard to conceal it results in disaster. The solution, as you point out, is to get someone to haul the junk away, to give your code better "curb appeal." In C you can use nested includes to accomplish that. In Ada, it takes a effort devoted to coherence and information hiding. A package spec that has more than three or four with clauses is a clue that problems exist in the code. Ada was designed that way. Package bodies often have as many as a dozen with clauses on large projects, but again, beyond that you have to wonder if it indicates a problem with the coherence of the package body. Often use of generics, child packages, and separate bodies can reduce the clutter. Sometimes the only way to "fix" the problem is to start the design over and refactor the problem differently. (Note: putting an absolute maximum limit on the number of with clauses in the software coding standards fixes nothing. If there is a problem it is in the design not the code, and it can't be fixed by coding standards. Also the average number of with clauses will go up with the size of the project. Don't say that too many with and use clauses produce clutter that reduces the appeal of Ada as a programming language. Say instead that bad design in Ada results in cluttered looking with and use clauses. If you want a single number to measure the "goodness" of the design, I have been comfortable with (2S + B)/(N * ln(N)) where N is the total number of compilation units and subunits, S is the number of with clauses on package specs (including generic package specs) and B is the number of with clauses on other units. Some people may disagree with including separate subunits in N, but I seldom find designs abusing that. There is a problem though is some compilation units are too small, so I get concerned when the average size of compilation units is outside the 100 to 1000 NCSLOC (non-comment source lines of code) range. -- Robert I. Eachus 100% Ada, no bugs--the only way to create software.