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,243dc2fb696a49cd X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newshub.sdsu.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-08!sn-post-01!supernews.com!news.supernews.com!not-for-mail From: Chris Humphries Newsgroups: comp.lang.ada Subject: Re: Ada Popularity: Comparison of Ada/Charles with C++ STL (and Perl) Date: Mon, 27 Sep 2004 10:51:01 -0400 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <415828D5.8030905@unixfu.net> User-Agent: Mozilla Thunderbird 0.8 (X11/20040918) X-Accept-Language: en-us, en MIME-Version: 1.0 References: <11b4d.3849$d5.30042@newsb.telia.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@supernews.com Xref: g2news1.google.com comp.lang.ada:4274 Date: 2004-09-27T10:51:01-04:00 List-Id: Adam Ruth wrote: > In article , > duggar@mit.edu (Keith H Duggar) wrote: > > >>>I've come to this thread late, so I'm not completely sure about the >>>exact specs of the code, but here's my take on a Python version. It >>>comes in at a svelt 10 lines, and I think it's quite readable. I'm sure >>>I'm missing something though. >>> >>>import sys >>> >>>words = {} >>>for line in sys.stdin.readlines(): >>> for word in line.split(): >>> words[word] = words.get(word, 0) + 1 >>> >>>words = [[x[1], x[0]] for x in words.items()] >>>words.sort() >>>words.reverse() >>> >>>for word in words[:10]: >>> print word[0], word[1] >> >>Sweet. Python get's my vote for most readable in this case. >>The "for ... in ..." construct is very nice. It saves a lot >>of time and a lot of error prone indexing code. Thanks for >>posting it. > > > > Python and Ada tie for my favorite languages (with Lisp coming in a > close second). Which I use, depends on the task at hand. Ada and > Python seem to have similar philosophies, though on opposite sides of > the spectrum. Python's designer had as an explicit goal: > > "There should only be one obvious way to do anything". > > Some think that that stifles creativity, but I disagree. It frees the > programmer in my mind. While I'm not sure about the Ada designer, it > seems that a similar philosophy was in play. That's a very > "engineering" type of thought, as opposed to a "hacker" type of thought. > > That's actually my biggest problem with Perl. Its designer had as a > goal that there should be as may ways to accomplish things as there are > programmers. Great if you're just a hacker having fun, terrible if > you're someone maintaining Perl code. I think that has more to do with > Perl's unreadability than the syntax. I've never met a "great" Perl > programmer (read, Perl hacker), who wasn't completely confused by their > own two month old code. I've seen those same programmers be able to > digest 20,000 line Python programs in an afternoon. I've not got nearly > as much experience with Ada, but I can't see it being much different in > that regard. > That is not completely fair. It depends on the programmer as well. Having good documentation (including comments) as well as defined coding standards should make the code readable in any language, perl, python. Understanding the syntax of the language helps in both cases. If I know the syntax, and language, I can read any language the same. True that python by nature is easy to read, but it is unfair pit it against some perl code itself. I have seen python code that is hard to understand at a glance and perl code that is easy to understand at a glance :) I would like to see a perl programmer go over 20,000 lines of python, such as Zope and understand what is going on. Even for experienced python programmers or any programmer for that matter, that is a lot of code to read. Plus in a proper environment, there should be documentation somewhere before hand that defines what the purpose of the code us, use cases and even a explanation of what is going on from the mouth of the designers and programmers. That makes looking at code much easier, whatever the language... Even though the geeks in us would rather just look at the code first :) Perl gets a bad rap, just because there are 12341234 ways to do one thing, that doesn't make the language bad. I believe that Perl gets a bad rap from bad programmers/designers and thus bad code. The language is really a moot point if the foundation doesn't exist, or being built as you build. All things being equal, Ada is nice to have, yet Perl is no better off than Python in many respects, unless you talk about OO features and such. Perl 6 should be interesting (even though it may be vaporware for a few more years, heh). Only reason I could see why the argument of reading the language of Python over Perl would be better is if there was no documentation and you had no idea how it worked before opening up your editors and browsing files. Then the weak link isn't the language, but the software development team. Though it is easier to blame a language and take it from ourselves. Sure language syntax for readability is very nice to have, but it should not negate the need for proper documentation and standards :) Note: I am not attacking you bud, just pointing out something that is frustrating :) PS: I have done a ton of work with Python, and specifically Zope, even a Zope 3 sprint in NYC.