Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Perverse Unreadable Code

by tinman (Curate)
on Apr 25, 2001 at 22:56 UTC ( #75566=note: print w/ replies, xml ) Need Help??


in reply to Perverse Unreadable Code

Well, I think that your accusations are somewhat unfounded.. I have some sympathy to your point of view, especially if you're relatively new to Perl and shell script like languages... but here are some thoughts on this...

Firstly, read perlstyle.. As in arhuman's sig, "Only Bad Coders code badly in Perl"... For the most part, I have found Perl to be a very concise and intuitively appealing language.. why I say this is because it has lots of constructs that are similar to natural language..and furthermore, you'll find the reference above gives an explanation for when "an if after the code" is appropriate....

One of my coworkers *always* laughs when he sees "or die" and "carp" :o), but they accurately describe what the function is supposed to do, and that sounds like a good thing to me...

Next, have you heard of the obfuscated C contest ? Look here for frightful examples of C code... its not just Perl, its any language you can think of, *every* language has the potential for bad code..

Readability is a big big win, I don't dispute that.. but sometimes, what may not seem readable to you may well be easy to someone who has actually taken the time out to understand the construct...Perhaps you need to know a little bit more Perl ? things may suddenly become easier to read and understand when you've been exposed to the language a bit more.. I certainly found that to be the case for me...

However, just so you don't get the impression that I'm dismissing your concerns, this is an article I think a lot of Perl programmers should read..especially if you write Perl code for a living...

Finally, TIMTOWTDI applies to Perl code.. perhaps you can learn a more efficient way of doing something by looking at someone elses code.. I know I have...
Update:Attributed sig to arhuman


Comment on Re: Perverse Unreadable Code
Re: Re: Perverse Unreadable Code
by Anonymous Monk on Apr 25, 2001 at 23:18 UTC
    Yes thanks for your reply and I do take onboard that things will get easier as I learn a bit more Perl. Thanks for pointing me to the coding standards. I do currently follow our own works coding standards which are very similar.

    I can not for the life of me understand why people do not use strict and warnings. That's like turning up the stereo in your car so you don't here the engine grinding through lack of oil.

    What do you mean there is something wrong with my car, its moving isn't it. Yes but only just and when will it blow up?

    Don't get me wrong it isn't Perl I dislike. I come from a VB background a have found the use of regular expressions unbelievably powerfull and now use them in VB which is now availble by referencing the VBScript library.

    Thanks for your Comments I'll stick at it and may yet be converted!

    Edit by tye

Re (tilly) 2: Perverse Unreadable Code
by tilly (Archbishop) on Apr 26, 2001 at 05:48 UTC
    its not just Perl, its any language you can think of, *every* language has the potential for bad code..

    More precisely, any Turing complete language.

    This is the substance of the first really big theorem about computers, the Halting problem. If the language is general enough to even model something pretty simple, it is possible to give a series of instructions that no amount of analysis can answer even a simple question about.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://75566]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2014-10-26 08:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (152 votes), past polls