Thursday, January 29, 2015

Shock and Terror - Perl IS a readable language


As a fresh developer, one of the first things you'll hear about Perl is one of the following:
  1. Perl is unreadable
  2. Perl is the only language that looks the same before and after is encrypted with sha256
  3. Larry Wall fell asleep with his head on his keyboard and when he woke up he called the result Perl
You won't hear that Perl is the language that was behind almost every Web page until 2000s, practically powering the whole www, or that you can use Perl to build anything and elegantly implement all of your business requirements, or that Perl is the only real programming language that is delivered with every Linux distribution. No, I'm sure that if you started programming in the last 5 years, the very first thing you heard about Perl is one of the above bullshit jokes. And, if you happen to challenge their affirmation, they'll pull out some snippets that won a Perl golf code competition to "prove" it to you, proudly enforcing their statement with: "that is a perfectly valid  piece of Perl code". The truth is that no, the output of a golf code competition is not a valid piece of code. Not for the business critical applications that we generally use Perl for. Believing someone who never opened a Perl manual and says that Perl is unreadable, is like believing a 3 years old when she tells you that English is unreadable. Come on, you gotta be smarter than that.Show me a programming language that you can understand without reading some parts of its documentation and I'll give you the winning numbers at the lottery.I'm sure you can read and understand any programming language after you put enough effort and exercise into learning it - yes, even brainfuck

Programming Languages are Like Spoken Ones

There are around 1 billion people who understand Chinese and 200 million people who understand Arabic after all. And there are literally billions of people on earth who can't understand a single letter from the Latin alphabet. Do you believe that those billions of people who can't read English are wrong? or the ones who only speak Chinese, Japanese, Arabic, Russian, or Hebrew are using a less than best language because you can't understand them?  Now, do you really think that Perl is unreadable? Compared to what? To a language you used for years before trying to do something with Perl? Who sets the programming language readability standards? You see my friend, There Is More Than One Way To Do It and if someone tells you something else, send them to this post.
Just because some respected developer in an unrelated technology can't figure out what each sigil means in Perl, it doesn't mean that the language is unreadable. It means that the developer is a superficial cunt individual, who can't figure the difference between a joke and reality.

Programming Languages are Like Civilizations

We can consider Perl to be like the modern world, where everybody is allowed to do anything they want as long as they don't disturb or harm other people (this is unfortunately untrue at a world scale, but I live in Europe and here this is pretty much the case). Perl evolved nicely from a time similar to Egyptians where we used rudimentary tools and were able to  build great things - the internet, just like the Egyptians built the pyramids, to the present day, where we have DBIx::Class, and Mojolicious, and Catalyst, and Dancer, and Plack and we build beautiful skyscrapers with hundreds of floors.
We can see that other languages are still in the dark middle ages, where they burn witches when they say that not everybody likes to have their indentation enforced on their code the Earth is not flat, or even that it revolves around the Sun instead of the reversal.

The future is now

Right now I'm in Brussels, waiting for +FOSDEM 2015 to begin (thanks Evozon for sponsoring my presence here). If you're also around, do your best to attend Larry Wall's keynote speaking on Sunday, because I've heard he has really important news to share regarding Perl6. You might actually not have that much time to try Perl6 (which I hope will be named Camelia) before it is declared production ready and becomes mainstream.
If he made it that big with the original Perl, imagine what kind of a language will come out after his more than 25 years of experience, out of which, 14 were spent on designing a new language.

I can't wait to see the power of Perl6 explained by +Curtis Poe (who's one of my favorite presenters) on Saturday - have a sneak peak at his slides hereIf you liked this article, don't forget to share it on your favorite social network.

4 comments:

  1. Small typo: leave in Europe -> live in Europe

    Awesome post, thank you, thank you. Look forward to receive a big hug from me at FOSDEM!

    ReplyDelete
  2. I like what you wrote, though I have nothing against the Python space convention. I think it's a silly thing to have a flame war over, no matter what side you're on.

    I think the real reason a language enjoys popularity, or declines, is less the language than the community. Perl is an outstanding language. But for a while, I think the Python community was more welcoming to newbies and that got them more interest and more mindshare. The Perl community has come around a lot since then, and now I think it's an interesting race between them to attract new blood - and no matter which side you pick, we all win.

    ReplyDelete
  3. I guess what I find most frustrating about perl is this mentality:

    >We can see that other languages are still in the dark middle ages, where they burn witches when they say that not everybody likes to have their indentation enforced on their code the Earth is not flat, or even that it revolves around the Sun instead of the reversal.

    Is this really how you see yourselves? Why is it that no one can ever explain to me what's good about perl without a tsunami of self-righteous bullshit? Assholes with an axe to grind are all over the internet defending any number of programming languages for stupid reasons, but if you look hard enough, there are cogent discussions as well. Not perl, as far as I can tell. Every "defense of perl" I read:

    A) is completely hollow (like this one that you wrote)
    B) would have made sense if it were written for the development ecosystem that existed in 2002...

    CPAN? Yeah, cpan is great, but in the year 2015, every perl successor has similarly available repos (...to compliment their actual standard library).

    Wide availability on Linux? Sure, but again, it's 2015, all the successors to perl are available with a single command to the package manager... I'll note that polluted rivers are widely available in cities all over the world, that doesn't make them an idea drinking water source, even if people in third world countries have to resort to them.

    YEAH BUT NO INDENTATION REQUIREMENTS? I love the juxtaposition between the whole "people who criticize perl must not understand it"... and then shit like this.

    Of course, in any place where you might want to play with indentation (e.g. a very large function definition that you'd like to have on multiple lines), python doesn't actually pay attention to whitespace at all. If you're frustrated by the indentation requirements for blocks of code, then you're a bad programmer, plain and simple, and no language can help you.

    It's all moot though; you could just as easily say, "some people don't like having to type curly braces", and it would be just as valid. It's not an argument for or against anything.

    Your (bad) metaphors all fall apart on first glance. What if your theoretical Three-year-old was able to read and write in five other languages? Would that change the weight of their opinion on english orthography? Another note, everyone I know that understands english well is more than happy to criticize its confusing features without getting all nationalist about it.

    Despite this terrible inferiority complex, I know perl *must* be a decent language, since it's used pretty much exclusively in production where I work. I'm trying to become more fluent for obvious reasons. Yet everywhere I turn, even the vaunted "camel book," I'm dealing with this shit. Sure, the examples are clear enough, but it'd be nice if every single one of them weren't accompanied by:

    "HEH, CAN'T EXACTLY DO *THAT* IN C, CAN YA???"

    no, you're right, in C you'd only have to write the type once when you declared it. Gee, I can feel my job getting easier already.

    ReplyDelete