Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!udel!haven.umd.edu!socrates.umd.edu!socrates!rockwell From: rockwell@socrates.umd.edu (Raul Rockwell) Newsgroups: comp.object Subject: Re: Readability of Ada Message-ID: Date: 10 May 91 02:58:50 GMT References: <1991May1.041007.14124@odi.com> <1991May9.040947.28053@netcom.COM> Sender: rockwell@socrates.umd.edu (Raul Rockwell) Organization: Traveller Lines: 85 In-Reply-To: jls@netcom.COM's message of 9 May 91 04: 09:47 GMT Jim Showalter: > Is there an assembly language or APL programmer out there who truly > doesn't know anything about Ada who would care to comment on > whether the following code snippets make any sense?: Sure, I think I can qualify as an ignorant fool... :-) Qualifications: lotsa assembly work and machine language, I get paid to work in APL, and I've not learned ADA. (downside: I know C, LISP, used to know PASCAL, and a handful of other languages...) > for Current_Day in Monday..Friday loop > Go_To_Work; > end loop; Well, my first reaction is "that's pretty understandable". Second is "wait a minute, what data does "Go_To_Work" use??? Third reaction is that the "for" keyword only makes sense because I've seen it so much. Thinking about that a little more, I'd say that this is a trivial operation. I don't see that it is significantly clearer (or even significantly more compact) than the following: Go_To_Work; /* Monday */ Go_To_Work; /* Tuesday */ Go_To_Work; /* Wednesday */ Go_To_Work; /* Thursday */ Go_To_Work; /* Friday */ Or, if you like: /* Monday Tuesday Wednesday Thursday Friday */ Go_To_Work; Go_To_Work; Go_To_Work; Go_To_Work; Go_To_Work; Trivial problems are simple in any language. If I had to maintain that code, I'd be worried about side effects and what assumptions the person who wrote it made about when it was going to be used. (Since it is clearly side effect driven code.) (Assuming that it is part of some large body of code.) > while Batter_Remains_In_Bowl and People_Are_Still_Hungry loop > Make_More_Pancakes; > end loop; Well, this is better, because there is some presumably non-trivial test. There is still no hint of data flow, and unless I could speak to the person who wrote it, I'm going to have to do global analysis on the body of code (and the application environment) before I'd be willing to touch that thing. Also, "while" is more English like, to me, than "for". Presumably the point is how much like natural language this is. However, I don't care a whit how much like natural language the control structures are -- I care about how easy it is to understand their implications. I haven't the slightest idea how "Batter_Remains_In_Bowl" is supposed to tie in with anything else (though I suppose I ought to assume it's some pre-initialized global variable...). Of course, part of the problem here is that this is just a code fragment, not a complete program. > if You_Are_Sleepy then > Go_To_Sleep; > end if; Again, at first glance this communicates an understandable idea. However this tells me nothing about the action of going to sleep (how long? Some hard coded constant? Until the user selects "wake up" with a mouse? Until hell freezes over??) (Well, it doesn't tell me a lot of other things either, but that's what bothers me most.) To attempt to summarize my feelings: the assembly language programmer in me crys out "How is the data represented???" while the APL programmer in me crys out "What is the data???" And the systems analyst part of me wonders "What is the context?" Is this post in any way useful to anyone? Or was I just answering a rhetorical question? Raul Rockwell, fool at large