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

I think Perl ruined me as a programmer

by Petras (Friar)
on Oct 31, 2007 at 01:46 UTC ( #648156=perlmeditation: print w/ replies, xml ) Need Help??

I have a confession to make. I'm not the world's best programmer. I don't get paid to do it, but I do it because it's fun. I do it because I can make an html table of 1000 photos with six lines of Perl code instead of six days of clacking away in Notepad. I do it because there's a puzzle to it, there's the thrill of learning a new language, and I do it because it gives me the power to make this machine do whatever I want it to or else I'll throw it out the window! I've no intention of ever being a Perl master but I do intend to be a Perl life-long student. I love a language that makes simple things easy, especially since most really hard tasks can be accomplished in several simple steps, even if it's thousands of simple steps, that is, if you aren't worried too much about efficiency.

So, how has Perl ruined me as a programmer? It makes easy things simple. I didn't start programming with Perl; I started programming in C64 basic. Even that had a lot of short cuts (why type out print when ? works just as well? And it was Java that taught me about OOP. Java had less short-cuts than did my beloved C64 basic, but it could do a lot of things that I could never do before (especially since there were a lot of things a C64 just couldn't do!). Then came Perl. With Perl, heck, why bother with variable names when $_ works so well? Why type out for each my $counter (1, 2, 3, 4, 5) when for (1..5) saves keystrokes representing hours of life that will be gone for ever? Yep, Perl made me lazy.

So, this week I took a new project for a non-profit. I'm writting a VBA macro. The lazy in me is going nuts. I don't like the lack of simplicity. I mis being able to type things like ++ or at least +=1 instead of value=value+1. I don't like writing out  for each c . I'm not saying VB is bad (enough other people have said that elsewhere: "Sure seems like a lot of typing for a visual language!"), but I'm saying Perl has made me not want to tolerate unnecessary restrictions and unnecessary keystrokes. That's how Perl's ruined me as a programmer.

Funny thing is, I appreciate Perl all the more for it! I've developed a new sense of laziness and hubris, which means, really, Perl is a complete success!

Cheers!
Petras


Don't worry about people stealing your ideas. If your ideas are any good, you'll have to ram them down people's throats.

-Howard Aiken

Comment on I think Perl ruined me as a programmer
Select or Download Code
Re: I think Perl ruined me as a programmer
by BrowserUk (Pope) on Oct 31, 2007 at 02:08 UTC
    but I'm saying Perl has made me not want to tolerate unnecessary restrictions and unnecessary keystrokes.

    Every now and again I encounter someone saying something that, once I read it, I feel I've been trying to say in a dozen different ways for months or years.

    Dispite all my dilettantism with half a dozen other languages of various flavours over the last couple of years, I still find myself reverting to Perl when I want to get something done. It's not that there aren't nice features in each of those other languages, things that I wish I had access to from Perl. It's that I don't miss those things in Perl anywhere near as much as the bits of Perl I miss when I am in those other languages.

    Moreover, I resent the hoops those other languages make me jump through to get things done that are just so easy in Perl.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      I still find myself reverting to Perl when I want to get something done.

      Amen.

      If you think about it, Perl is a horrible mess. The implementation is the definition, and although both have had a benevolent dictator drawing guidelines, there's layers of fixes on fixes in both the language and the implementation. The documentation is full of exceptions to the rules it tries to describe. The core language is quite huge, even if you don't have to know all of it, and the built-in function list makes many programmers of other programming languages shudder.

      Yet the reason it is effective in solving various practical problems is precisely because solutions to practical problems have been made easy. If you want to find all strings matching certain description, just write the description as a regular expression and use it. No need to load libraries or fight with baroque syntax. If you want to loop over all lines in a text file, just use the diamond operator. Although this isn't part of the language implementation, if you don't want to solve a problem again, download a module for CPAN.

      Perl is not pretty, but it's the best tool I know of. If I were a driver or operating system programmer, I would probably make similar arguments in favour of C (which is not a nice programming language but also gets the job done).

      --
      print "Just Another Perl Adept\n";

Re: I think Perl ruined me as a programmer
by Your Mother (Canon) on Oct 31, 2007 at 04:07 UTC

    I started out almost exactly the same. Former kinda-sorta hacker who fell in love with the Perl way of solving problems so got back into programming. Funny thing is, this place has slowly but surely turned me from an admitted drive-by hacker to one much more serious about writing code seriously and not just for kicks. I owe a lot of the fine folks here a big lunch with drinks for that b/c every time I start to take it a little more seriously I seem to get a pay bump soon after the fact. I'd start with BrowserUk but I suppose there's an ocean in the way.

Re: I think Perl ruined me as a programmer
by ajt (Prior) on Oct 31, 2007 at 11:28 UTC

    I'd have to agree, C64 V2 Basic, then Turbo BASIC/Pascal, and finally Perl. Now I program for a living in SAP's ABAP (think COBOL + SQL) and it drives me mad at the number of things that are built into Perl and are easy to do and are hard in ABAP. Don't even mention CPAN, SAP has nothing even comparable, everything has to be written or bought in...

    Once you get use to a language like Perl, it is hard to go back to a less programmer friendly one.


    --
    ajt
      C64 V2 Basic, then Turbo BASIC/Pascal, and finally Perl.

      That's almost exactly my learning path as well. Was there something in particular about C64 BASIC that prepped our minds for Perl?

      And yes, I also feel ruined by this wonderful language. I love getting an opportunity to hack together a perl script, large or small, to solve a problem. I loathe being forced to code in a more restrictive language, where "Hello World" is more than one line of code...

        I think it was the $ symbol :)

        How can you feel when you're made of steel? I am made of steel. I am the Robot Tourist.
        Robot Tourist, by Ten Benson

Re: I think Perl ruined me as a programmer
by spectre9 (Beadle) on Oct 31, 2007 at 12:46 UTC
    I first picked up Perl in 1994. I like to say that its the last language I ever learned. Since then I have had to code in other languages -- but instead of writing that code directly, I write a Perl program to generate the code. Very few languages I have to use (SQL, Cognos "languages" i.e. DecisionStream) cannot be more easily written in Perl than with the "visual" tools.

    Here's to the beauty of dynamic, interpreted, text based languages. Just count your blessings that Visual Basic has a text source to edit. You could be stuck with a GUI and no place to go...

    spectre#9 -- more dangerous than acme
      You could be stuck with a GUI and no place to go...
      That's when you wake up screaming..
      --
      Andreas
Re: I think Perl ruined me as a programmer
by bart (Canon) on Oct 31, 2007 at 18:23 UTC
    I think you're not even listing the most time-saving features of Perl. The examples you give are just peanuts, in my opinion. You're not even beginning to touch Perl's real strong points. For example, how many lines does it take to write a universal min function? Not many:
    sub min { my $min = shift; foreach (@_) { $_ = $min if $_ < $min; } return $min; }
    There aren't many other languages that produce such a powerful function (the minimum of any number of items, the minimum value in an array, or a mix, like the minimum value in 3 scalars and 2 arrays) in so few lines.

    And that's where my laziness lies.

    Another example? Data::Dumper. Enough said.

      bart,
      Or simply List::Util 'min';

      There was a signature going around a while back along the lines of "90% of all perl programs are already written". On top of that, Perl let's you code in your paradigm of choice (imperative, OO, functional). Taking your min() example a few steps further, you end up with reduce. I have found it incredibly difficult to spend much time learning other languages now that I have found perl.

      Cheers - L~R

      Ironically I consider that one of Perl's weak points compared to other languages.

      Take your min function. Suppose I want to use it to find the first word in a list. Can I? No! I have to write another function for strings! And if I want to compare arrays in lexicographic order, I need another one! (That one gets nasty, particularly with arrays of arrays.)

      Compare Ruby (or Python, or Haskell, or Smalltalk). There the exact equivalent min function would work on any data type that defined <. So it would work on integers, floating point, strings, arrays of things that are themselves comparable, and so on. But Perl can't do that! Why not? Because Perl has typed operators and untyped data. Those other languages have typed data and untyped operators. So in those languages it makes sense to "compare these things" with the most natural possible comparison. In Perl it doesn't.

      Sure, Perl is much better than Java in this regard. But that is a deficiency which generics can help with. By contrast Perl's deficiency is not readily removable, it is inherent in Perl's notion of data that automatically casts itself to whatever it is asked to be. (A notion which does, of course, pay off in other conveniences.)

        This is fixed in Perl 6, not with generics, but with multiple dispatch. The prejudice of == toward numerics and eq toward strings is then merely the behavior of the default function that is invoked if a more specific type does not define a more specific behavior. (Of course, generics can help with defining a set of related functions for a new type.) And, of course, you also handle mixed types with multiple dispatch, since that's what it was invented for in the first place.
      that min functions looks kinda funny, and in some ways manages to expose the dangers of writing lazy (ie, terse) perl.
      sub min { my $min = shift; foreach (@_) { $_ = $min if $_ < $min; } return $min; } @a = (10, 5, 8, 2, 1, -4); $min = min(@a); print "min of @a is $min\n";
      produces: min of 10 10 10 10 10 10 is 10

      probably not what you expected! not only did it give the wrong answer, it destroyed the input list!

        The function should be:
        sub min { my $min = shift; foreach (@_) { $min = $_ if $_ < $min; } return $min; }
Re: I think Perl ruined me as a programmer
by amarquis (Curate) on Oct 31, 2007 at 19:56 UTC

    I, like you, am not a professional programmer. My programming ability is just viewed as a bonus in my profession.

    Perl, though, has made me into somebody who has a very low tolerance for other languages. Perl fits my life because:

    1. It does not judge me. If I need to do something sloppy because it is a script that will be run one time, it lets me. If I want to create something elegant and expandable and easy to modify down the road, Perl is cool with that too.

    2. CPAN. I recently caved in and started using it, and I get things done a million times faster than before (only slightly hyperbole).

Re: I think Perl ruined me as a programmer
by rob_au (Abbot) on Nov 01, 2007 at 00:28 UTC

    I think the comment that you make about feeling spoilt by the flexibility and capability of Perl is absolutely fair - Moreover however, I have found Perl to provide a robust and flexible basis from which to learn more about how things can (and at times, should) be done.

    Indeed, from the knowledge basis that Perl has given me and the rounded understanding about how system processes and applications should be development, I have been able to build quite extensively upon the preliminary knowledge that I had in some lower level languages and concepts to work nearly wholly in embedded and new-hardware development environments. This work includes tasks such as interpreting schematics and developing hardware drivers, developing embedded firmware and developing commercial communication protocol implementations, a level of development which I once thought would be beyond me.

    In short, I think the flexibility and capability of Perl is not so much a limit for cross-development on other languages and platforms, but rather a spring-board from which I can test and experiment with new ideas ahead of launching into more advanced development challenges.

     

    perl -le "print unpack'N', pack'B32', '00000000000000000000001000000000'"

Re: I think Perl ruined me as a programmer
by bradenshep (Beadle) on Nov 02, 2007 at 15:12 UTC
    I realize the use of "ruined" is tongue-in-cheek, but I would change the perspective a bit. Did Perl really make us lazy? I say, no, it didn't. I think we've been lazy all along, but Perl just allowed the most room for our natural laziness.

    Now when we use other languages, it feels painful. You have to work so hard, type so much, compared to working in Perl. When you've driven a sports car, compacts feel slower, and way less fun.

    Perl has, by far, the highest thought-per-keystroke ratio of any language I've used. It's highly context-sensitive, the default variables and myriad builtins; it's one of the hardest languages to just skim if you don't know it. But once you learn the language a bit, more and more powerful statements are opened to you.
    map, grep and reduce are confusing and difficult to understand as a new Perl programmer (at least from an imperative background). But once you get your head around them, you start replacing loops all over the place with them. And you want them so badly when forced to use another language.

    In conclusion, I don't believe Perl made us lazy, and therefore impatient with other languages. I think Perl showed us a new level of concise, flexible power. Once you've used a table saw, you won't be happy with a hand saw.
      Funny. Just yesterday, trying to make the macro run better, I actually had to think, "How do I make a bubble sort again? It's been so long..." Well, so I-never-thought-I'd-have-to-do-that-again code later, and now in my project thisproject.bubble_sort works. But, man I missed typing sort!
      Don't worry about people stealing your ideas. If your ideas are any good, you'll have to ram them down people's throats.

      -Howard Aiken
      Oh, wow. You just summed up exactly what I've been feeling - I've been forced to start picking up some ASP.Net and do some PHP debugging for work, and in all cases I'm dying to be able to use map and grep.
      I could not agree more. I pay the bills as a graphics designer and web developer, and I sometimes have to do some PHP debugging work, and really, stuff like map and grep are some of the things I've missed most. Also, I like the fact that the language doesn't get in my way if I quickly need to write a script that will only run once, for instance.
Re: I think Perl ruined me as a programmer
by ady (Deacon) on Nov 02, 2007 at 16:54 UTC
    Quote
    The Tao gave birth to machine language. Machine language gave birth to the assembler. The assembler gave birth to the compiler. Now there are ten thousand languages.

    Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao. But do chose the path of least resistance, do chose the Perl of Tao, if you have a choice.

    Programmers that do not comprehend the Tao are always running out of time and space for their programs. Programmers that comprehend the Tao always have enough time and space to accomplish their goals. How could it be otherwise?

    The wise programmer is told about Tao and follows it. The average programmer is told about Tao and searches for it. The foolish programmer is told about Tao and laughs at it.


    allan
      I prefer this quote from that source:
      A master was explaining the nature of Tao of to one of his novices. ``The Tao is embodied in all software - regardless of how insignificant,'' said the master.

      ``Is the Tao in a hand-held calculator?'' asked the novice.

      ``It is,'' came the reply.

      ``Is the Tao in a video game?'' continued the novice.<p? ``It is even in a video game,'' said the master.

      ``And is the Tao in the DOS for a personal computer?''

      The master coughed and shifted his position slightly. ``The lesson is over for today,'' he said.

Re: I think Perl ruined me as a programmer
by apl (Monsignor) on Nov 04, 2007 at 14:10 UTC
    For me, the beauty of Perl is in how hashes are an inherent part of the language. So much of what I've done in the past involved setting up / searching / storing hashes manipulated by libraries. Now *pffft*, the hash is there, the reference is obvious, etc.

    Or, in other wordws, my programs only do what they're intended to. 8-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://648156]
Approved by BrowserUk
Front-paged by BrowserUk
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (7)
As of 2014-07-25 05:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (167 votes), past polls