Pages

vendredi 3 juin 2016

JavaScript for Perl lovers.

This time I feel really qualified to write this article, because believe me, I love Perl ! I think in Perl, I dream in Perl, and I really appreciate the whole Perl community. I’ve been in love with this language for more than a decade but I decided that I needed a change.

I’ve already said in a previous article why I chose to learn JavaScript this year (instead of getting involved in Perl 6 for example) but let me tell you why you might also enjoy learning JavaScript if you love Perl. Perl developers form a very unified community that all too often, resist outside influences, but learning a secondary language as JavaScript can really be a very enlightening experience.

It’s expressive

JavaScript, like Perl, is an expressive language. You get your work done with just a few lines of code. When talking about programming languages, I really like the tent analogy:

In a tent you have functional things (tent fabrics) whose purpose is to provide a function to the user (protect the user) and structural things (tent pegs) whose purpose is only to provide a structure to make the functional things “work”.

The same goes for a programming language, one part of the syntax serves the function and another part of the syntax serves the structure.

Perl and JavaScript and the other expressive languages minimize the structural part, whereas some other languages require more structural code like Ada, Java for example.

It gets the job done

With a gazillion of available modules, you can do everything from highly dynamic Web pages, networking code, command line tools, daemons, desktop to phone applications. JavaScript right now is on a roll, it’s both a front end and a back end language through node.js and with the existent frameworks and libraries it goes as far as robotics. It’s powerful and practical. You can do a lot of things with it, quite easily.

There is more than one way to do it

Let’s state it, I love diversity, I love choice.
Of course I felt overwhelmed at first when I delved into the JavaScript tools, but that was more the discomfort of learning a whole new ecosystem than a real issue. I’m still a programmer at heart and in mind, I think like a programmer no matter the language that I’m using, it’s only a matter of adapting to syntax and structure.

If I wanted for the “one best way to do it”, I probably would have gone for Python.

You’re at home

You think that blessing is a bit curious but an efficient way to achieve Object Oriented Programming? You’ll love prototypal inheritance.

Want more? What about an open and heterogeneous community, an efficient interpreter, lot of tooling (tests, modules, frameworks)

You don’t blindly follow the pack

Remember all the silly things you’ve heard about Perl?
Imagine, just for one moment, that the same goes for JavaScript:

What if the language isn’t that slow?

What if the language enables you to produce quality software?

What if the quirk of the syntax (callback hell, hoisting etc) can now be managed?

What if the language enables you to code everything and not just Web Page animations?

Why don’t you check by yourself, you might well be surprised.

Vitality

I don’t subscribe to the Perl is dying trend (In fact I think the contrary), I believe in Perl as a powerful and important language in the developing world. I’m not abandoning my Perl roots by learning JavaScript, I’m just growing as a programmer.
But, I must there are advantages here, the JavaScript crowd is bigger, and although that’s by no means a criteria of quality to me, it is an opportunity to meet even more interesting people or discover new paradigms/tools/ideas.

Conclusion

I hope I’ve presented plenty of reasons to at least make you take into consideration that you might love JavaScript as much as you love Perl. In any case don’t take my word for it, give JavaScript a try.
Next time, I’d like to get into the details and talk about code, if there are some area that you’d like to be covered, don’t hesitate to comment; Your feedback/suggestions are welcome.