Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

seeds...

by SamCG (Hermit)
on Oct 24, 2005 at 22:23 UTC ( #502596=perlmeditation: print w/ replies, xml ) Need Help??

I'd been developing with Perl more or less on the sly for a couple of years. Oh, I was the senior developer so it wasn't explicitly verboten, but neither was it officially approved. I used Perl largely for a lot of quick, necessary tasks -- parsing strange text files, moving ftp files around, zipping files/id for storage, and the like. No one really knew I used Perl for many of these tasks except the other developers. Since they were all from the MS background, they generally shied away from the things I'd done. A friend of mine, a solid C#/VB.NET developer, and I used to banter back and forth over the verbosity of .NET and the inscrutability (from his perspective) of Perl.

A few months ago for various *cough* PHB *cough* reasons, I left the firm. I knew my Perl would live on for at least a while, and instructed a couple of the developers on what to do if something changed. On leaving the firm, my friend said to me, "I'm sorry, but PERL must die!" I told him it was his decision, and that if he wanted to rewrite the things I'd written he certainly could, and that I probably wouldn't want a language around I knew nothing about either.

A week ago or so he contacted me -- he'd been charged with writing a new asp page, and had looked at one of my asp pages written in perlscript. He liked it, saying the way I'd done it was "like .NET in concept" (I think this was because of the Response->Write syntax and that I'd declared a bunch of tags at the top of the script that I knew I'd use -- it wasn't really spectacular work). He was also surprised by how clear it was to him. He had a few questions to ask about regexes and split (I'd turned him on to regexes months before leaving in a project, noting that he could use them in .NET for a file parsing engine he was developing). As we ended the conversation, he said he was going to try developing the page in Perl.

A small bit of evangelism, perhaps, but it left a warm feeling in my heart. It just goes to show that you never know when people might be listening.

Comment on seeds...
Re: seeds...
by graff (Chancellor) on Oct 24, 2005 at 23:59 UTC
    Great story -- thanks. I was especially struck by this piece:
    ... He liked it, saying the way I'd done it was "like .NET in concept" (I think this was because of the Response->Write syntax and that I'd declared a bunch of tags at the top of the script that I knew I'd use ...). He was also surprised by how clear it was to him.

    This points to the importance of a notion that tends to be forgotten sometimes by truly dedicated (addicted) Perl users (including me): not only is it possible to write Perl programs so that they resemble programs written in some other language, but sometimes it is a Good Idea(tm) to do so.

    We all know how cool it is (clever, intriguing, sexy, etc) to write Perl code that is highly idiomatic, tersely compact, even ethereally abstracted. But this sort of usage will pose problems for maintenance, especially in shops where Perl is only one of several available tools (and not necessarily the predominant one).

      We all know how cool it is (clever, intriguing, sexy, etc) to write Perl code that is highly idiomatic, tersely compact, even ethereally abstracted. But this sort of usage will pose problems for maintenance, especially in shops where Perl is only one of several available tools (and not necessarily the predominant one).

      *shudder* Where does that horrid "cleverness" mentality come from, anyway?!? What happened to professionalism; the KISS principle; clean, obvious code that doesn't require wasted thought or effort to maintain?

      I see so many would-be clever programmers using complex idioms for the sake of cleverness; playing games with scoping, closures, OO to implement a theoretically elegant solution that's convoluted, hard to maintain, and hard to test.

      Sometimes it's simpler to just plain write:

      print "Hello, World";
      and be done with it, rather than some "sophisticated" mess like:
      use Config::Parser; # "clever" in house module to parse config files; +relies heavily on closures, XS, and mutual recursion; contains own le +xer and parser use Language::Gylph::Unicode; # "clever" in house module for unicode; +written in as a clever polyglot of FORTRAN, C, and Assembler, "just i +n case" only one of the languages is available at any given time my $parser; $parser = Config::Parser->new( $ARGV[0] || $ENV{CONFIG} || get_default +_config($0) ); $parser->set_output_device(\*STDOUT); $parser->set_Encoding( Language::Glyph::Unicode->get_encoding( $ENV{LA +NGUAGE} ) ); $parser->set_display_string( $parser->get_data(TYPE=>GREETING)); $parser->output_display_string();
      where the hastily written perldocs for the parser claim that only ASCII encoding is currently supported, and the entire target audience speaks only English, and only has access to 7-bit ascii text terminals. And yes, I've seen code that ugly before! :-(

      I see sooo much over-engineering, would-be cleverness, and solving of non-problems in my workplace that I'm perhaps oversensitive to it, but I find that "clever" is far too often code for "writing obfuscated code to stroke my own ego, and protect my job security"; my ex-boss did this for several years, and completely destroyed all semblence of maintainable code here at my company. :-( I'd re-write it, but I'm not allowed to until it breaks. :-(

      So, perhaps as a reaction to that, I very much prefer the K.I.S.S principle; make it work, and make it obvious. Be clear on your own time; don't waste your co-workers time on ugly idioms unless the idiom is necessary, and not just "cute". "Cute, clever, and tricky" is quite often the opposite of "simple, obvious, and correct", at least in my experience.

        To be honest, I prefer seeing idioms. It tells me that the user has a grasp on the elegance of the language. But I think that's completely orthogonal to "cleverness" - at least in the usage seen here. Idiomatic can be clear, clean, precise - and can be all these things while still being flexible to handle changing requirements.

        I'll definitely agree to the "simple, obvious, correct." But I don't think idiomaticness has anything to do with that.

        Then again, I've managed to eliminate about 80-90% of my manager's code from our department, and significant portions of his design. His design often is "simple, works, and rigid." I've replaced most of that with "simpler, consistant, flexible." At least, in my not-so-humble opinion ;-)

        *shudder* Where does that horrid "cleverness" mentality come from, anyway?!? What happened to professionalism; the KISS principle; clean, obvious code that doesn't require wasted thought or effort to maintain?

        The original poster talked about idiomatic and tersely compact code which is quite a bit different than "clever" code. To me, idiomatic perl is clean and obvious. "Clever" code is typically non-idiomatic and often obfuscated in some fashion. When the comments say something like "we rely on the undocument return value of this function to index into the array", the code is clearly too clever for it's own good.

        Judging from the rest of your post I'd say that you have a very different idea of what "idioms" are than I do. Just as you don't code C as if it were Fortran once you learn C well enough, you don't code Perl as if it were something else (unless that's explicitly your goal) once you learn Perl well enough. I certainly don't "dumb down" my perl code for the sake of those who don't know perl well enough to understand it. Rather I encourage them to learn perl better.

        Anyway ...

        "Cute, clever, and tricky" is quite often the opposite of "simple, obvious, and correct", at least in my experience.
        I could not agree more. I just think you and I perhaps have differing ideas of what's "simple, obvious, and correct"
Re: seeds...
by pg (Canon) on Oct 25, 2005 at 00:50 UTC

    In this industry, lots of people have the wrong perception of Perl, for some reason... This is different from knowing Perl's weak point. Knowing perl's weak point is based on knowledge and experience, but lots of people never used Perl, however they got this negative impression from somewhere.

    I have two stories to share. First story, one day I was talking to two guys in my team. They were trying to come up with a piece of PL/SQL package to do something that was simple. I told them that they really don't need a PL/SQL package, all they need is one query (obviously the query would be a little bit tricky than usual). We talked about it, and they got my point and agreed. At the end, one guy made this comment "this is just like what those Perl guys do, they always try to compete and see whose program uses less characters." I didn't make any comment, cause that's not relevant any way. But obviously somehow from somewhere they got this impression that Perl or Perl programmers were less serious.

    If the problem in the first story is with others, not us Perl programers, then the second story is about ourselves. A guy recently left the company, he was one of few guys used Perl. This is not a Perl shop, so those who use Perl only use it for their own benefits, and there is absolutely no code review etc. This morning, someone had a question about his Perl code, and came to me. I looked at his code, wow, there is absolutely no use strict, or use warnings, and this goes on and on with all the bad styles.

    Just like what you have said, there certainly is a need for us to plant the seeds, and the good seeds, so that others see what good plants Perl grows, and change their perception about Perl.

      funny, I tried hard to find perl users in the place where i work. and I haven't found any. most of the ppl i know are just using this or that language and they don't seem to have a passion about any language.
      and I am the one hang the camel code/YAPC news on my wall so that anyone passing by can see it. I am screaming for my own identity

      but i shouldn't complain much, as we got a cool pm group in the city anyway. =)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (12)
As of 2014-09-02 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (29 votes), past polls