From: Ryan Leavengood Date: 2002-01-01T19:10:47+09:00 Subject: [ruby-talk:29943] Re: Ruby/Python: Software Engineering Warning: lots of potentially boring rhetoric below! Quentin Crain wrote: > > All: > > There are many things I like about Python, but the one that seems to keep me > w/ Python is (IMHO) its commitment to "software engineering > practices/methodologies". > > Hopefully staying away from an infinite recursive descent into definitions, > is there any good summary that attempts to justify where/how Ruby makes this > a priority? Firstly, despite my taking a course named "Software Engineering" in college, I have come to believe that there really is no such thing. At least not at the moment. As others have said, software development is very young and is much more art than engineering. But I suspect I'm descending into the definitions you warned about. Anyhow, there certainly are best practices that are quite well established, such as doing things only once, keeping things decoupled, etc. But I find these are much more a function of the author than of the language being written in. I address this below: > What follows is detail which is not necessary to answer the question above, > but fills out (a little) my thinking. > > Software Engineering Practices/Methodologies include: > > Designed from the "ground up" for readability > > Enforced indention (you indent your own code I bet) { @No #line $noise } > No short cuts ($!, $%, etc) I have a feeling you are not a big fan of Perl and it's poor readability. I would agree with you on that point. But though Ruby does borrow some things from Perl, it is far more readable (IMO.) But again, as we seem to be on more of a philosophical than pragmatic discussion, I must point out that readability is much more a function of the author (AND of the reader) than of the language being written in. I have seen examples of readable and unreadable code in all the languages I've programmed in. Including Python. We have some utilities at my work written in Python that are quite a mess. So despite the claimed "purity" of the syntax, it CAN be warped into something quite unreadable. But I will admit that some languages tend to be more readable then others (but that can also depend on the readers background.) Personally I would group Ruby and Python in the "very readable" section. But I really don't like Python's style of indentation. For one thing I don't like being forced to do anything. Secondly I really find it quite unreadable how blocks keep trailing out with no visible end. Most of the time it takes me some time to figure out where a class or method ends, which is quite annoying. It just isn't symmetric. The philosophy behind it seems nice, but not all seemingly good philosophies result in successful systems (socialism anyone?) But then again, I have not written much Python at all, and that brings me to my next point. Readability is hugely influenced by the READER. This may seem obvious but no one ever seems to mention it. I could see my own biography written in Chinese and not be able to read one bit of it, despite being intimiately familiar with the subject. Similarly I could read some perfectly written English describing some complex astro-physics theory and also not understand any of it. You see, when we say READABILITY, we also mean UNDERSTANDABILITY. Just because you can read something doesn't necessarily mean you will understand it (and vice versa.) After almost a year of programming in Ruby, I can read it very easily (but then again I was reading it easily the first day.) But if I was reading a large library for some domain I had little knowledge of, I may not understand it (which could prove troublesome if I had to fix bugs or modify that library.) I can also read regular expressions quite well after being exposed to them for many years (and they are notorious for being unreadable.) But without regexps my programming life would be SO MUCH HARDER. If I had not taken the time to learn regexps and keep practicing with them (despite their unreadability), I would have a very tough time now programming and doing complex search and replaces in my text editor. This makes a point about your so called "short cuts." Feel free to spend hours writing a complex parser by hand in Python, but I'll just use a regular expression thank you. And yes I know Python has the RE library, but I'm just making a point. Short cuts are there to make programming easier and faster. So I suppose the point in all this is that readability is mostly in the eye of the beholder. And this beholder thinks Ruby is very readable and Python not as much so (but certainly a lot better than Perl.) > Documentation a priority from the beginning > > docstrings (at all) docstrings (as properties) Now these are definitely cool, and something that would be good in Ruby. > Many of you are probably tired of this type of thread, but these are the > types of things that keep me using Python and I am wondering if/when/where > Ruby addresses them. Are these simply topics of opinion, or do they actually > matter? They really do seem to be more opinion oriented than anything else. But of course when you are dealing with people (as we do on development teams), opinions do matter. Hmmm, clearly it is too late and I'm getting too philosophical. Ryan Leavengood