Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^4: What's it with Perl Syntax ?!

by ELISHEVA (Prior)
on Feb 20, 2011 at 06:31 UTC ( #889156=note: print w/replies, xml ) Need Help??

in reply to Re^3: What's it with Perl Syntax ?!
in thread What's it with Perl Syntax ?!

May be good Perl programmers do not sacrifice readability for brevity.

Good programmers (and writers) in any language adapt their writing style to circumstance.

I think it is a common mis-perception that greater expertise means the need to use that knowledge in every circumstance. Perhaps that mis-perception is no different than the high school kid or college student who goes crazy writing essays with the longest possible words hoping to impress their teacher with their mastery of the English language? Eventually they figure out that sometimes less is more (one hopes).

If I am writing a one liner on the command line, I might use shortcuts like you describe. No one has to read it again, including I, and it saves typing. For code that has to last a long time, I tend to avoid them. while(my $line = <STDIN>) is far more self documenting than while(<STDIN>). Additionally, those shortcut variables are fragile. They tend to get reset easily. As a result, the wise programmer transfers their value into something more stable as soon as possible.

The situation is similar to a skilled speaker that can talk the slang of the day with their friends on the street, use simple language with their two year old child at home, and write academic papers for publication at work. It is all English (or French/Hebrew/German/etc), but oh how different.

Where I might agree with you is that Perl's flexibility makes it more vulnerable to the same errors and mistakes we make when learning to write natural language. Java generics are obscure but you aren't likely to be responsible for reading and writing such code unless you are a fairly abstract thinker to begin with. Perl's more obscure shortcuts help with tasks even a beginner needs to do. As a result, it is a lot easier for someone learning to program to be like that high-schooler with Perl than it is with Java.

Update: added final paragraph.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://889156]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2018-05-21 06:21 GMT
Find Nodes?
    Voting Booth?