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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,92c39a3be0a7f17d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-14 05:33:38 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!teleglobe.net!news.stealth.net!news.stealth.net!news-east.rr.com!news-west.rr.com!news.airnews.net!cabal10.airnews.net!cabal1.airnews.net!news-f.iadfw.net!usenet From: "John R. Strohm" Newsgroups: comp.lang.ada Subject: Re: Future with Ada Date: Thu, 14 Mar 2002 07:21:47 -0800 Organization: Airnews.net! at Internet America Message-ID: X-Orig-Message-ID: References: X-A-Notice: References line has been trimmed due to 512 byte limitation Abuse-Reports-To: abuse at airmail.net to report improper postings NNTP-Proxy-Relay: library1-aux.airnews.net NNTP-Posting-Time: Thu Mar 14 07:32:21 2002 NNTP-Posting-Host: !bn;Q1k-W!WQ+:] (Encoded at Airnews!) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:21224 Date: 2002-03-14T07:21:47-08:00 List-Id: Observation: Underlying all this is a PERFECT example of what might be called "80-column card thinking". The underlying assumption is that the terminal screen has 25 lines and so you should have everything broken into 25-line chunks. However, printer pages typically allow around 60 lines, and PCs have supported 43 and 50 line text modes for well over 10 years now. Printer pages also have the advantage that you can scribble on them as needed. Hm. I don't remember what the old Symbolics console provided, but it was a hell of a lot more than 25 lines. At the same time, the principle remains the same. Having a single procedure, spanning hundreds of run-on lines, is usually a Bad Thing. "Marin David Condic" wrote in message news:a6jg6p$iec$1@nh.pace.co.uk... > I *think* we're on the same wavelength. I was trying to say I don't object > to something like: > > case (Var) is > when Enum_01 => > Something_01 ; > when Enum_02 => > Something_02 ; > when Enum_03 => > Something_03 ; > when Enum_04 => > Something_04 ; > when Enum_05 => > Something_05 ; > when Enum_06 => > Something_06 ; > when Enum_etc => > Something_etc ; > when others => > Something_Others ; > end case ; > > And I would find attempts to go through gyrations to make this shorter just > to fit some kind of "Don't make a case statement longer than twentysomething > lines" rule a bit silly. My original illustration was to show a > stupid-code-trick needed to bust up the case statement to make it shorter. > Can you think of a way to make a case statement like this shorter that > doesn't look silly? (Assuming you've got 20 or so enumerals for some > reason - op-codes maybe? Lexical elements of some language you're parsing? > Reserved words in Ada? Not hard to imagine a fairly long list of enumerals, > eh?) > > Once that case statement gets longer than a screen, I'd find it handy to > have a name at the end of it reminding me of what I'm ending. Of course, one > could always encase the case in a procedure that did nothing more than > provide the name for the check - and I'd think that was a good thing. But > would you try to make that procedure into three procedures if the case was > 75 lines long just to shorten it up into 25 line segments? > > Maybe I've run into similar things with if statements or nesting of > structures and didn't want to start making subprograms that had no > identifiable function other than to encapsulate some arbitrary chunk of code > & avoid some arbitrary nesting or line length limit. If I can write a > subprogram name like: "Is_Device_Ready" or > "Check_Employee_Payroll_Deductions" then I'm more than fine about taking > that nested if or long stream of code and hiding it in there. If I have a > hard time writing a good name for it and start resorting to > "Run_Some_Long_Block_Of_Code_To_Avoid_The_Nesting_Police", then I know I'm > better off leaving it the way it was. :-) (It reminds me of stunts pulled to > get subroutines under some arbitrary line limit - divide the routine you > have by the number of lines in the arbitrary limit and just find convenient > places to cut along those breaks. One 400 line subroutine becomes four 100 > line routines with a "main" to call each in sequence, eh? :-) > > MDC > -- > Marin David Condic > Senior Software Engineer > Pace Micro Technology Americas www.pacemicro.com > Enabling the digital revolution > e-Mail: marin.condic@pacemicro.com > Web: http://www.mcondic.com/ > > > "Wes Groleau" wrote in message > news:3C8D0D70.BB09F3DA@despammed.com... > > > > > when others => > > > Do_Another_Case_In_A_Procedure (var) ; -- I *would* object to > this. > > > > I would, too. But I would probably NOT object to > > > > when others => > > Default_Var_Handling (voo); > > > > Matter of fact, whether by nesting or by calling, > > I would object to a case choice on a variable that > > dispatches to a case on the same variable. > > > > -- > > Wes Groleau > > http://freepages.rootsweb.com/~wgroleau > >