It’s Not Just About the Syntax, You Moron

I see many programmers comparing languages based on their syntax alone. Something along the lines of “Java sucks because it’s much more verbose than my favorite language X and it also requires a semicolon at the end of each statement which is so 20 years ago and is a total no-go”. Okay. But who the fuck cares?

Note: This post doesn’t apply to you if you don’t develop end user enterprise applications. If you’re in academia, or a language hacker, or learn languages for fun or to broaden your perspective, or just enjoy writing your own libraries, frameworks, and language tools, you might pick a language based solely on its syntax and there’s nothing wrong with it. But this post focuses on real world enterprise application of languages.

All this talk about syntax is superficial and focuses on things that don’t fucking matter at the end of the day when we talk about developing end user enterprise solutions.

If you only consider syntax, yeah, Java is a pretty old-fashioned language. There are more expressive, succinct, and modern languages out there. There are features I miss in Java like type import aliasing that exist in other languages. But since I’m a practical developer working on end user enterprise applications, what matters to me is way beyond just the syntax and whether it requires a fucking semicolon after each statement.

What’s important to me is the ecosystem around a language. The community, libraries, frameworks, IDEs and other tools. Let’s go through each in detail.

Community

It all starts with the community because a community is people. And people define what the ecosystem around a language is going to be.

To have a ton of high quality tools like IDEs and reusable code like libraries and frameworks, you need a huge community with a good number of experienced and smart professionals.

If a community is full of amateurs like the PHP community, you’ll have a hard time finding high quality tools and reusable code.

Don’t get me wrong, there are some very smart and experienced people in the PHP community, but they are a minority. Like a very small minority. Or maybe even an exception.

Because they don’t stick around. Once they become better at programming in general, they realize how fucked up PHP and its reputation are, and they switch to another language. That’s why the PHP community fails to accumulate a critical mass of smart and experienced programmers to push the ecosystem to a whole new level.

Most of the PHP community is more like WordPress hackers that learn the basics of the language enough to get their job done and then just stop there.

Then there are more serious PHP developers working on big codebases that learn the language and maybe a framework or two. But a very little number of them go beyond that.

Most don’t learn general programming practices of good software design like separation of concerns. They write huge bloated classes where each solves dozens of problems. They put domain logic into controllers. Or even into views. Some even put SQL into views. And then they tell you they’re doing MVC. Do they even fucking understand what MVC is?

In the case of a relational database, they don’t bother learning good — or even essential practices — like using foreign keys. Or proper use of indexes. Or query optimization.

Basically, their code is a huge unmaintainable ball of mud. And that’s like 99% of projects. Even using decent frameworks like Symfony doesn’t help them a bit. If they don’t know shit about SOLID or other good — or essential — programming practices, no framework will ever help them.

It is possible to write decent and maintainable code in PHP, but most of the community just has no clue how to do that.

Here’s an awesome analogy of the PHP community:

I can’t even say what’s wrong with PHP, because— okay. Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there.

You pull out a screwdriver, and you see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to you, but you guess it comes in handy sometimes.

You pull out the hammer, but to your dismay, it has the claw part on both sides. Still serviceable though, I mean, you can hit nails with the middle of the head holding it sideways.

You pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever.

And on you go. Everything in the box is kind of weird and quirky, but maybe not enough to make it completely worthless. And there’s no clear problem with the set as a whole; it still has all the tools.

Now imagine you meet millions of carpenters using this toolbox who tell you “well hey what’s the problem with these tools? They’re all I’ve ever used and they work fine!” And the carpenters show you the houses they’ve built, where every room is a pentagon and the roof is upside-down. And you knock on the front door and it just collapses inwards and they all yell at you for breaking their door.

That’s what’s wrong with PHP.

But enough of PHP.

Let’s consider a smart community. Like Scala.

The Scala community is mostly smart hackers that care about writing the most obscure code only they can understand instead of solving real world problems.

If you can’t understand their code, you’re just not smart enough. Go learn monads. Or better yet, go do Java or PHP instead.

They’re language hackers. Theorists. Purists.

They care about elegancy more than anything else. And hey, there’s nothing wrong with elegancy. It’s good if you solve a real world problem. It’s even better if you solve it elegantly. And it’s just awesome if you solve it both elegantly and in some finite amount of time like this week. Or decade.

What’s different about most of the Scala community is that they just don’t care about practicality or deadlines. They’re on the mission to pure theoretical and idiomatic elegancy. They’re more like purist theoretical mathematicians that find numbers — or some other mathematical construct — the most beautiful thing in this dark and ugly real world.

Of course, there are people in the Scala community that are both smart and practical, but they’re a minority.

And this minority is just not enough to produce a critical mass of reusable code and tools to get Scala into the practical enterprise world.

Whatever I say about Scala can be applied to many other communities like Haskell, Lisp, etc. For whatever reason, it seems to be mostly communities built around functional languages. Maybe it’s because functional languages require a good grasp of mathematics and hence attract mathematicians-programmers (mathgrammers?). And many mathematicians love purity and elegance.

These languages are not useless though. They are just niche languages. There are successful systems implemented using them that work great production. Most are very specialized though.

Another benefit that comes from the communities of those languages is that they’re like R&D of the programming world. All their theoretical work filled with elegance gets distilled and ends up in mainstream languages.

So, the PHP community is full of practical people that solve real world problems. No one does PHP for elegancy; it’s only being used as a practical means to an end. But most of the community has no clue about essential software practices and hence they mostly produce unmaintainable piles of shit.

The Scala community, on the other hand, is full of smart people that are mostly focused on pure elegancy and don’t really bother solving real world problems because the real world is ugly and irrational. And because it’s just not fun.

There has to be a community that’s a good balance between these two extremes. And there is. Drumroll… You guessed it. It’s Java.

Java is full of practical enterprise developers and unlike PHP it’s full of really smart people. The ratio of smart people in the Scala community might be higher, but Java has enough to form a critical mass to produce all that’s necessary for it to dominate the enterprise world.

There are hundreds of thought leaders of the whole programming industry that do Java.

And there is a ton of companies working on tools and reusable code for the Java ecosystem.

There is also a huge number of big enterprises that depend on Java. Banks and other financial institutions, social networks, healthcare systems, airline systems, etc — multibillion dollar companies. Java is practically in every industry there is.

Reusable Code

PHP has a huge community but it mostly consists of amateurs with the NIH syndrome. They don’t produce much reusable code and when they do, it’s mostly garbage.

Why can’t the PHP community join forces and create one awesome reusable piece of code like a Kafka library? Instead a bunch of not-really-programmers empowered by the low entry barrier of PHP go and write their own retarded version of a library and then abandon it a few weeks or months later.

Then some other PHP programmer starts looking for a great Kafka library, finds only garbage, and decides to create their own piece of shit version from scratch. And on it goes.

It’s like they don’t even realize how much work it is to write and maintain a high quality library or framework. They look at Symfony or Doctrine and say “Hey, I can write all the parts of those I need myself in a few weeks! Why use all those monsters?” Good fucking luck with that. The only thing those morons end up producing is incomprehensible garbage a poor successor will have to spend years unfucking.

Another interesting phenomenon I noticed in the PHP community is this obsession with microframeworks. Every once in a while, a new PHP microframework pops up. And it’s being advertised as small, simple, and hence performant. Like fuck yeah.

Then a bunch of idiots jump on the bandwagon and start using it. Since the framework is so fucking small and simple, they waste months reinventing a fuckload of wheels that come for free with big and “bloated” frameworks like Symfony. And of course most of the code they write is far from being performant because they have no fucking clue how to write performant code. Even so called “bloated” Symfony performs magnitudes faster than their pathetic attempts to write an application based on a microframework.

Since a microframework is by definition not that feature rich, some of its relatively less retarded users start requesting more and more features to be added to it to avoid writing the same code over and over again. And the happy framework authors forget about all their initial promises and go do that. Fast forward a few years and you see yet another big and “bloated” framework.

And then some other smartass decides to fight the system and writes yet another microframework. The cycle is endless madness.

One very important difference between a framework that started as a microframework and a framework that planned to be huge right from the start is that the former lacks any well defined architecture necessary to sustain growth. Instead it’s just a bunch of pieces of shit duct taped into one incomprehensible stinking ball of mud.

It’s also common for me to find a library that solves a particular problem and start integrating it. And it works fine for basic use cases I have at first. But once I start doing anything more advanced, I immediately hit limitations. I see that neither the authors of the library nor its users have ever bothered with those advanced use cases and hence there’s either no support of them at all or the support is ugly and incomplete.

After hitting that problem many times with many libraries and frameworks, I realized it’s not an exception but a general trend in the PHP community. It’s like no one digs deep into anything; they only focus on superficial basic use cases.

Sure, there are some decent libraries and frameworks that are mostly clones of Java libraries and frameworks, but they’re so rare and hard to find, it’s just frustrating. They’re being developed and maintained by those exceptionally smart and experienced PHP programmers who for some weird reason got stuck with the PHP community and didn’t move on. And since there are not that many of them, the community just doesn’t have enough hands to keep up with cloning Java libraries and frameworks. Hence the state of the PHP clones is a decade behind the Java originals.

The only community worse than the PHP community in this regard I know of is the Node.js community. They decided to reinvent every fucking wheel there is from scratch with even lower ratio of smart people in the community, with the worst mainstream language out there, and with even stronger case of the NIH syndrome. Good fucking luck with that. I guess Node.js is the new PHP. Like PHP 10-15 years ago.

Java, on the other hand, thanks to it having a huge community and a good ratio of smart people in it, has many high quality libraries and frameworks. Spring alone is a huge collection of high quality reusable code maintained and contributed to by very smart people with experience developing complex enterprise systems.

Unlike the PHP community, it’s pretty common to see the Java community joining forces on an existing library or framework to make it better by reporting and fixing bugs, suggesting and adding new features, etc. They don’t each go and start their own version of something just because they just learned how to fucking push code to GitHub.

And unlike with PHP, when I start doing something advanced with Java libraries and frameworks, most of the time it just works. I see good support of advanced use cases. Probably because there are many people who hit those advanced use cases before me and added their solutions to the existing libraries and frameworks instead of rolling their own.

The Spring ecosystem alone blows my mind. It solves problems in almost any area an enterprise might have. Whatever you do: Web, REST APIs, Websockets, security, caching, validation, SQL and NoSQL databases, cloud, microservices, integration/messaging/queues/Kafka/etc. — they have high level abstractions for all that.

Overall the Spring ecosystem has millions of lines of high quality code with great test coverage that has been battle tested in a ton business critical systems all over the world. And Spring is not the only ecosystem of libraries and frameworks in the Java world.

All that reusable code is the code I don’t need to write yourself. I just include the necessary parts of the libraries and frameworks and inherit decades of distilled real world experience solving problems in multibillion dollar companies. The code that you likely don’t have money nor time to write yourself. Even if your company has millions of dollars just for that purpose. Which I doubt it has.

Data Systems and Tools

Java is the new C/C++. The kinds of systems that were traditionally written in C/C++, are now being written in Java. Some systems are written in other JVM languages like Scala but they still provide native clients written in Java.

These systems include Elasticsearch, Lucene, Solr, Cassandra, HBase, Hadoop, Spark, Hive, Pig, Storm, Kafka, Zookeeper, and so on. The list only keeps growing.

Most of these systems provide native Java clients. More than that, some of them provide higher level abstractions on top of those clients.

For instance, the Java client for Cassandra provides an object mapper. It greatly simplifies development against Cassandra and makes it more productive.

Is your system written in a language other than Java or some other JVM language? You’re shit out of luck. Enjoy reinventing high level wheels on top of low level clients you have access to.

Elasticsearch provides a high level Java API client. It provides a nice type safe DSL on top of the low level client. A huge productivity booster.

Is your system written in a language other than Java or some other JVM language? You’re shit out of luck.

Kafka provides a native Java client that’s in sync with the server component. Spring provides a higher level abstraction on top of it. And then an even higher level streams abstraction.

Is your system written in a language other than Java or some other JVM language? You got the idea.

Most of the other mainstream languages have low level clients that are likely just a wrapper on top of their C/C++ clients. They usually lag behind the native Java clients in terms of version releases and features.

Even if you go with the traditional SQL world, even though SQL databases are mostly written in C/C++, there’s still a ton of Java abstractions for them.

First of all, Java has JDBC for low level SQL access. That low level API gives you complete control of database access.

Then there are higher level abstractions like Spring’s JdbcTemplate and jOOQ. They let you write almost any query you want, but simplify some low level stuff.

Want even higher level abstractions? There’s JPA. Since it’s an ORM tool, it manages mapping between classes/objects and tables/rows. It also abstracts most of the SQL for you by providing a higher level query language called JPQL. It simplifies writing 90% of queries, but sometimes you still have to drop down to SQL and JPA lets you do that.

And if that’s not high level enough for you, there’s an even higher level abstraction in the form of Spring Data JPA. It generates repository implementations for you based on the method signatures you write in repository interfaces. It also provides nice pagination support and — my favorite — specifications.

Not using Java? Poor you. Take my insincere condolences. You picked your own loser language. You had it coming.

By the way, PHP does have a JPA clone called Doctrine ORM, but… First, it’s years behind Java alternatives. Second, if you liked Spring Data JPA specifications as much as I did, hey, go fucking write them yourself. You have time for that, right? What’s the big deal anyway?

The situation is not much better with other mainstream languages.

IDEs

I don’t know what you use for actual coding, but I hope it’s not a text editor. Don’t tell me it’s Vim. Ugh…

Okay. If you picked Vim because you didn’t know better, I forgive you. I’ll tell you about the beautiful world of IDEs, you’ll get fucking amazed, and switch to one.

If, on the other hand, you’re well aware of IDEs but still decided to stick to Vim, I don’t even know what to tell you. You’re like a kid that hasn’t hit puberty yet. There’s just no point for me to argue with you. You think you know what it’s like to be an adult, but you have no idea. Because of the strong language I use on this blog, it’s not allowed for kids. Get the fuck out of here.

Don’t get me wrong. I like Vim. I use it to edit configuration files on servers and whatnot. There’s nothing wrong with Vim for text editing. But fucking code in Vim? You’re out of your fucking mind.

I’ve seen code written by people using a text editor like Vim. The minute I join the project and load the code into my IDE, I see numerous statements highlighted with red because they’re fatal syntax errors. Yet they go unnoticed because Vim is a disease that seems to mostly affect dynamic language programmers and hence there’s no compiler. That code only blows up in production.

Just by using an IDE, there’s a ton of errors that can be avoided. But that’s not the only advantage.

IDEs provide code completion. And code completion saves a ton of time.

But here’s the trick. Code completion quality significantly depends on the language you use. If you use a dynamic language like PHP, Ruby, or JavaScript, the quality of code completion goes to down the toilet. Especially with JavaScript.

The reason behind that is not that IDE developers are lazy or don’t like your language of choice. The actual reason is that dynamic languages with weak typing just don’t provide enough information like types that are available in statically and strongly typed languages like Java. Especially if your language allows amending existing classes and objects by letting you add and overwrite existing fields and methods.

Could that be the reason programmers using those languages pick Vim? Even if it is, it’s still not an excuse to use Vim. IDEs still do provide some kind of code completion even for languages that are as fucked up as JavaScript.

The code completion that a great IDE provides for Java is just mind boggling. For instance, an IDE can even figure out two levels of method calls I need to do to get a value of the expected type.

Here’s an example:

long randomNumber = fairy.<hit completion key combination here>

And my IDE completes it by adding two method calls:

long randomNumber = fairy.baseProducer().randomBetween()

Can Vim do that? Fuck no it can’t.

Can a great IDE for your non Java language of choice do that? Fuck no it can’t.

If you try do some similar code completion in a language like JavaScript, you’ll get 518 suggestions because of the 32 libraries you’ve added to your project that amend existing “types” with new properties.

By the way, I see code completion becoming better for PHP. But that’s probably because PHP recently added parameter and return type hints to be even more like Java.

But none of the dynamic languages will ever get the level of code completion that’s available for Java.

My IDE of choice is IntelliJ IDEA Ultimate from JetBrains. I tried other IDEs like Eclipse and NetBeans, but they all sucked balls.

IntelliJ IDEA is so fucking awesome I can’t even imagine myself coding without it. I took a little productivity hit when I just switched to it, but after a few weeks — once I figured it out — my code writing productivity went through the roof. And it’s still rising because the IDE keeps evolving, getting new features and becoming smarter overall.

There are IDEs for other languages from JetBrains. HTML/CSS, PHP, Ruby, Python, JavaScript, Go, C, Swift, and some Microsoft languages I don’t give a shit about. IntelliJ IDEA Ultimate let’s you install plugins to add support for most of those language to IDEA itself. Hence you don’t need to buy each of those IDEs; just buy Intellij IDEA Ultimate and install the required plugins.

And hey, I pay for the Ultimate subscription out of my pocket. Actually, I pay for the All Products Pack subscription that includes all of their IDEs. IntelliJ IDEA is such an essential tool in my toolbox that I don’t need my employers or clients to pay for it. And it’s one of the rare cases of my money spent fucking well.

If JetBrains has an IDE for you language of choice and you’re not using it, you’re just an amateur.

And even if you use one but Java is not the language of your choice, take my condolences again. Because you have no fucking clue what awesome code completion looks and feels like.

And if you’re not using an IDE and stick to Vim, you should be fucking fired for wasting the time you’re being paid for.

Conclusion

Yeah, syntax wise your language of choice might be much more modern and elegant. It might be cutting edge and still actively evolving. You might not have to type a semicolon at the end of each line. You might be able to write succinct and elegant code.

But it doesn’t fucking matter.

Because even with an awesome language like that you’re likely to have to write and maintain a ton of code to reinvent thousands of battle tested wheels with suboptimal tools.

And unlike you, I pick Java and get a ton of reusable code that I don’t have to write myself and awesome tools that make me very productive writing the application specific code that I do have to write.

Let’s see who writes well tested production ready application code faster. I’ll wait you on the finish line.

Published by

Elnur Abdurrakhimov

Elnur Abdurrakhimov is a software architect and developer with over a decade of real world experience.