“There Ain’t No Such Thing as a Perfect Language”

by Austin Pocus, on Feb 23, 2018 2:19:52 PM

austin-profile-pic4.jpg by Austin Pocus, Software Developer at eFlex Systems                           

programming for manufacturing

Programming languages can be a contentious topic, to say the least. People stick to their favorite (and most hated) languages, sometimes to a fanatical degree. This isn’t going to be another post singing the praises of my favorite language while ignoring the ugly bits, or a rant railing on a language with no context as to what it does well. Here, I’d like to take a different approach.

The Good, the Bad, and the Ugly

My favorite language is probably Clojure. It’s a Lisp dialect, which means it has the most powerful code generation tools around. It runs on the JVM, which means it gets access to tons of libraries, whether through Clojure wrapper libraries or direct Java interop. Most importantly, development in the read-eval-print-loop (REPL) is fast and fun, an interactive way to build your programs. Because of Clojure’s unique syntax and constructs derived from its Lisp roots, you can easily develop entire functions and programs starting with one expression and expanding from there.

However, Clojure is not without its warts. It’s a language that sticks pretty closely to functional programming principles, which in part means that all data is immutable. Want to change a variable you defined earlier? You’ll have to use a ref or atom to store and modify that state. It’s great for concurrent programming -- not so great when you just want to make one state change in one place. That Java interop system I mentioned has pretty wonky syntax, and dealing with Java objects in Clojure is not the most pleasant experience. The community is thriving, especially for a Lisp dialect, but there are usually only one or two strong, actively developed and widely used Clojure libraries for a given task, like web development or GUI programming. There’s Java interop, or you could write your own wrapper library, but it’s just not practical when I need to get something done now.

Silver Linings

Perl is probably my least favorite language. (Please note, I’m talking about Perl 5. Perl 6 is pretty much a whole new language and I haven’t used it.) It’s widely criticized as a “write-only language”, meaning once you write it, you can’t read it. This isn’t far off the mark either -- I’ve written Perl scripts before only to come back 6 months later and forget how it actually worked. I’ve worked with large Perl codebases too, and it can get really messy when the devs who wrote the code couldn’t agree on which way to do a given thing. “There’s more than one way to do it” is one of Perl’s mottoes, and it’s really true.

On the other hand, Perl is incredibly practical. It “makes easy things easy and hard things possible”. Its module system, CPAN, is probably rivaled only by NPM these days. Integration with Unix and the shell is unmatched by any other language out there -- even in Python you’d have to “shell out” for a lot of things. In Perl, it’s dead simple. My favorite aspect of Perl, though, is its creator, Larry Wall. He used to give off-the-wall speeches about Perl every year called “The State of the Onion”, and he’s a linguist, giving Perl a flavor no other language quite matches.

It’s All Relative

Turns out things aren’t quite so black-and-white as “Language X is Going to be the Next Big Thing” or “5 Reasons Why Y Sucks”. I used to ask people, “What would your ideal language look like?” I liked my teammate Jacob’s response: “I don’t think there is such a thing as an ideal language. It depends on what you’re doing.” I’ve come to realize he was right. To paraphrase The Moon is a Harsh Mistress by Robert Heinlein, “There ain’t no such thing as a perfect language.”

Although I have to mention, when pressed on the issue, Jacob admitted his ideal language would “probably be something like Clojure”...

Topics:Development Process

The Blog

Our team is a creative bunch that loves learning and pushing the limits to find the best solutions for today's lean manufacturers.  Internal discussions at the office might range from new features that manufacturing process control software should have to machine learning, blockchain technology, or what the future of AR on the plant floor looks like. Check out our blog for opinions, news and trends that we find interesting and think you might too!