Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!apple!netcomsv!jls From: jls@netcom.COM (Jim Showalter) Newsgroups: comp.object Subject: Re: Functions without side effects (was Old confusion) Message-ID: <1991Jun26.001847.24239@netcom.COM> Date: 26 Jun 91 00:18:47 GMT References: <130242@tut.cis.ohio-state.edu> <4888@osc.COM> <72893@microsoft.UUCP> <1991Jun21.013944.23970@netcom.COM> <20445@alice.att.com> Organization: Netcom - Online Communication Services UNIX System {408 241-9760 guest} Lines: 66 >You're doing it again, Jim. This is the kind of thing that caused all >the flamage about your earlier C-bashing. Your points are valid enought >without resorting to knocking down straw man code fragments. Okay okay okay--fair enough. >Try it this way: > Here we go again. The C equivalent of the above would typically look > something like: > Print( "I love named parameter names", 5, Laserprinter, Helvetica ); > This DOES take up less space. Is it more readable? >My answer might be, "No, but with the exception of the wired-in constant >5 for spacing (which should have some useful name instead), it is about >equally readable." Well, in this particular case you know what Laserprinter and Helvetica happen to mean, so, unlike their friend the 5, they have sufficient semantic content to be readable as is. How about this sort of thing (this is NOT intended to be a straw man piece of bad code--I see this stuff all the time, so unless the code I review is, in fact, submitted to me by men made of straw, this rates as a legitimate code sample): argl (4.5, 8, INCR, "bargl"); Even with a more readable name for the function, the arguments remain essentially content-free without a lot of surrounding context. The whole point of named parameter association is to provide the missing semantics at the point of call, to wit: argl (Azimuth => 4.5, Inclination => 8, Mode => INCR, Options => "bargl"); Yes, this is still semi-dreadful, but it is a definite improvement over the first version, doesn't it? Why, you can almost start to figure out what is going on! Look, I'm not saying the advent of named parameter association will feed all the world's children, but I do tend to get a little hot under the collar when people--the very people you accuse me of inventing as straw men, by the way--respond to every advance in code readability with the "verbose" label. I've said it before and I'll say it again--there is nothing wrong with most hackers that couldn't be fixed with a remedial course in touch typing... >Besides, complaining about C is sort of irrelevant. C++ is here now, >and provides a variety of features that make it easier to write clean >and robust code. It's like us raggin' on Ada because Pascal had >problems. Who cares? Okay, true enough. I grant you that, much as I take issue with its warts, C++ DOES represent a golden opportunity to reboot the C/UNIX culture with a different mindset--one that recognizes the value of strong typing, abstraction, portability, maintainability, etc. On the other hand, if the very same people who argue that formal names for parameters are "verbose" are going to be doing the writing in C++, what makes you think anything is going to change? At least when people learn Ada they HAVE to learn a new language--it's not backward compatible with Pascal. -- *** LIMITLESS SOFTWARE, Inc: Jim Showalter, jls@netcom.com, (408) 243-0630 **** *Proven solutions to software problems. Consulting and training on all aspects* *of software development. Management/process/methodology. Architecture/design/* *reuse. Quality/productivity. Risk reduction. EFFECTIVE OO usage. Ada/C++. *