>>>>> "Ghane" == Sanjeev Gupta <Sanjeev> writes:
Ghane> Mithun Bhattacharya wrote: >> Umm Perl believes the author should have control over what he >> writes rather than the Language setting the restrictions. Ghane> So perl does not have a validating reference "compiler"? Ghane> And it guesses my intent how? Ghane> I am not qualified to judge which is better, but as a Ghane> SysAdmin I wade through other people's code, and I often Ghane> have to get a "good" guy to explain to me what a perl Ghane> fragment is doing. With python, I can read the code and Ghane> figure out what is going where, even though I have no clue Ghane> why. And I have been "reading" perl for much longer than Ghane> python. It's actually as easy to write readable code in Perl as in (e.g.) Python. However, it's also easier to write unreadable code in Perl than in most other languages. Which type of code you write is a choice you make as a programmer. Ghane> I got a shock in 1995 when I realised that perl had 2 ways Ghane> to write an "if .. then .. endif" clause. And the same Ghane> module had both styles used, in a random fashion. I have Ghane> not recovered ;-) Uh, that's the Perl motto: TIMTOWTDI: There Is More Than One Way To Do It. I'd use Python as the language to teach programming to newbie coders in. It enforces structure and helps you learn without making too many mistakes. Once you've learnt programming and, so to say, unbolted the training wheels from your cycle, I'd recommend Perl as the language to write real-world applications in, precisely because it doesn't enforce structure. IMO programming discipline should be a function of the programmer, not of the programming language. I want a language that lets me make mistakes if I choose to. A language where I can apply the rules of good, structured OO programming (which both Perl and Python let me do), or break them if I so desire (which only Perl lets me do). Couple of example of what I mean... 1. C (another language that does not enforce discipline on a programmer) permits you to use constructs of the form array[-1]. Now normally negative indices to arrays are taboo. However, you'd be surprised at how often in the Real World this sort of construct is not only used, but indispensable. One example of a large application that uses this construct is Glibc IIRC. 2. Most (all?) OO languages do not permit invocation of object methods that do not exist at compile time. In any ``sane'' programming language a construct of the form $object=new Class; $object->foo() is an error unless Class contains a method called foo. However this is not an error in Perl. Because of this feature, Perl actually permits to do some creative messing around with class definitions and dynamically generate lots of similar methods for multiple classes at run-time without having to code each one individually by hand. (No, this is not the same thing as templating in C++.) Now some people may say that that's a rotten way of doing things, since the code will be unmaintainable. My take is that, firstly, all programming languages contain paradigms, and in order to read another person's code you have to be familiar with the paradigms s/he has used, otherwise you'll be lost in any case. More important, I believe that 25 lines that implement cloning of similar methods are more maintainable in the long term than 5 lines per method for 1000 methods. Unstructured programming may actually be MORE maintainable than structured programming in some cases. To sum up, I'd recommend Python as a great language for learning OO programming and Perl for those programmers who want to have the freedom to be constructive, creative and innovative. Regards, -- Raju -- Raj Mathur [EMAIL PROTECTED] http://kandalaya.org/ It is the mind that moves Quote from an IRC channel: Perl, the only language that looks the same before and after PGP-encryption! ================================================ To unsubscribe, send email to [EMAIL PROTECTED] with unsubscribe in subject header. Check archives at http://www.mail-archive.com/ilugd%40wpaa.org