ad
Choosing The Right Language in 2024: Javascript vs Kotlin vs PHP vs Python

Choosing The Right Language in 2024: Javascript vs Kotlin vs PHP vs Python

I’ve been a developer for over 7 years now, and I’ve used a lot of technologies for both personal projects and client projects. Kotlin, Node, PHP, and Python are the four that I have used the most. I want to talk about the benefits for each of them and what you should choose based on your project needs.

I will compare them in four different fields and give each one an overall score. As you can see, I am not mentioning efficiency or performance because all of them, if used correctly, can perform really well.

Also, I believe performance is a metric that shouldn't be looked at when we are talking about the web. If you do your job correctly, every language will perform.

  • Community & Ecosystem

  • Scalability

  • Developer Experience

  • Fun

Javascript

I started working with TypeScript around the time when I began coding. It was one of the first languages I ever wrote in and the one I used to deploy my first applications. I have mixed feelings about the JS/TS ecosystem, but I will be fair and give praise where it is due.

The JavaScript ecosystem is problematic.

The JS world is too bloated with bad code, too many frameworks, and too many options to choose from. There are so many that you get lost into dependencies. JavaScript is like a country with no laws; it has no rules. There is no standard way to write code, and your freedom can become your biggest enemy.

This creates an issue of bad code and inconsistencies. The amount of trash code I have seen in JavaScript projects is far more than in any other language. Because of the fact that by default there are no guidelines it is very easy to get lost

BUT

JavaScript can be the most fun and beautiful thing to work with; it just needs a few adjustments. You need to create your own laws. You have to be strict, so strict that people should not even be able to push code if it is not exactly how it must be. You do that by adding these 4 things to the language. Without these 4, the language is unusable.

  • TypeScript

  • ESLint

  • Prettier

  • Husky

TypeScript is the most important tool that Microsoft released to the JavaScript world to make it a better place. Microsoft was the big dog that took all the criminals and put them in jail. If you work on any project that needs more than one developer, then type safety is a must.

ESLint provides JavaScript with an extra set of rules responsible for writing unified code. Without it, chaos occurs. Used with some global settings like Airbnb or Google defaults, ESLint gives your JS project a fresh new look.

Prettier is used alongside ESLint to ensure the correct use of spaces and tabs. Without it, it's like living in disharmony; with it, everything returns to its natural state.

Husky is the bouncer; it doesn’t let you commit any code if the rules of the three mentioned technologies are not used. Without it, you rely on the programmer to remember to run ESLint and Prettier before each commit. Everybody knows this will never happen.

Without these 4 tools, JavaScript is unusable, it can’t be trusted, and by extension, it can’t be used. For those who say that with JavaScript you can be really fast and ship really fast, I agree, and I explain in another article of mine (What 10,000 Hours of Coding Taught Me: Don't Ship Fast) why shipping fast does more harm than good. So I don’t consider this one of JavaScript’s benefits.

The beauty of Javascript

JavaScript can be beautiful if we apply the above 4 tools. It is really easy to run, test, or debug. It can be deployed almost everywhere easily. It is fun to code because it gives you the right amount of complexity to make you think that you are a good developer.

Everyone can work with it, and you can use any combination of technologies with it. It can scale to millions of requests or run on 50MB of RAM. When you apply a discipline to each freedom, the language that was once ugly and silly becomes fun and pleasant.

The code looks really clean and easy to navigate. It may not provide a default folder structure, but even without it, when you organize the mess and chaos correctly with any folder structure, it is navigable and easy to use.

Community

The community is larger than it should be. The size of the community has made the language bad because it never had a golden standard. Everyone created their own framework and made the language look ugly, but it never was. From Redditors smashing your posts every day and YouTubers dedicated to JavaScript to Indie Hackers making $100K per month.

In the JavaScript world, you see everything from everything.

Score

The score I give JavaScript is actually based on two types of evaluations. The first is for using it correctly and as intended, and the second is for using it in the common way. The final score will be an average of the 2.

Vanilla Javascript (Use it as everyone does)

  • Community & Ecosystem: 10/10 (Great community) 🌐

  • Scalability: 5/10 (Can scale, but you wont make it that far) 📈

  • Developer Experience: 1/10 (Absolute nightmare) 😱

  • Fun: 3/10 (Is fun for the first 20K lines of code, then nightmare) 😩

Javascript Ninja Way (As it should be used)

  • Community & Ecosystem: 10/10 (Great community) 🌐

  • Scalability: 8/10 (Really good at handling large amounts of data and big codebases) 🚀

  • Developer Experience: 9/10 (Please experience) 😊

  • Fun: 9/10 (Really fun, combines complexity with ease of use) 🎉

Final Score: 6.875/10

Kotlin

Not many people use Kotlin, but Kotlin is something new, fresh, and with a lot of potential. It is not really common for smaller projects or large ones, but it offers a great combination of attributes that makes it one of my favorite languages for larger projects that many developers will work on.

As seen on Statista (https://www.statista.com/statistics/793628/worldwide-developer-survey-most-used-languages/), it is not very used; it’s placed just above Lua.

I encourage everyone to build an API with Kotlin Spring Boot for the reasons we are going to discuss below. I believe Kotlin is a revolution for the enterprise world. It is going to take Java’s place easily in the next 5-7 years.

Horse-Power for kids.

Kotlin is basically Java. It bundles up everything the JVM has; all the power you might need is there. Yet what Kotlin did differently is that it removed the barrier to entry and made it easy for everyone to use the JVM. Kotlin, in terms of simplicity, goes alongside Python for me. It doesn’t really have any complex syntax and it has nothing to do with the bloat Java carried on its back.

Kotlin not only gives power but also provides a solid foundation and structure. Writing Kotlin code is really hard to mess up; by default, it gives a strong foundation on type-safety and code structure. The frameworks that come with it are not many, but that makes the whole community code within the same lines.

Developer Experience

Kotlin has some drawbacks when it comes to developer experience. However, these drawbacks are related to the entire JVM, not just Kotlin. You can't simply run a command like in Python or JavaScript to start your app. It uses Maven or Gradle, and you need a JVM-specific IDE for a smooth experience. Setting it up isn't the easiest, and working with Vim or VSCode can be annoying—not difficult, but annoying.

With that out of the way. Writing Kotlin is supper easy. My experience with Spring Boot was amazing as it combines the access to power and also simplicity like Django or Laravel.

Kotlin is like type-safe Python combined with JavaScript’s freedom and PHP’s simplicity, along with all the JVM horsepower. For multi-developer projects, I can't see any other option out there if you like structure and style.

Also, I don't want to forget to mention that setting up a project is really easy.

Drawbacks

Kotlin overall is amazing. The community is what you'd expect from the standard JVM community—reliable but not particularly exciting. However, you can find solutions for any problem you encounter. One thing I didn't like and hope the Kotlin team can improve is making it more lightweight for smaller projects. Currently, a simple Kotlin app requires 600MB to run, compared to a Node project that uses only 180MB.

I know this isn’t really a drawback because under load Kotlin will be much more efficient but it would be nice to have.

Score

The score I will give Kotlin is quite surprising because I have nothing against it. It is my language of choice and I will choose it again in the future for any of my projects.

Kotlin

  • Community & Ecosystem: 9/10 (Great community, just boring) 🌐

  • Scalability: 10/10 (Can scale) 📈

  • Developer Experience: 8/10 (Almost great) 😱

  • Fun: 8/10 (Easy complexity) 😩

Final Score: 8.75/10

Python

Now let’s talk about Python. Before I start reviewing Python, I want to say that I never liked it. I have nothing personal against Python, and I think it is a great language with many use cases, but I think it is loved by disorganized people. They would use JavaScript, but JS is much worse compared to Python in many ways, so people just stick with Python.

You can write semi-clean code that is not as bad as JavaScript. It is really easy to run and work with. This is really important. Being able to do just a pip install and then a python command to start any app is really amazing. This is what I was talking about earlier for Kotlin. The barrier to starting an app is much higher compared to Python.

As you can see, a language with a great score like Kotlin is much less used than Python or JavaScript because developers consider how easy it is to run an app. Just open your VSCode and run the code without spending time setting up and configuring. You can spin up an app in seconds from a single main.py file.

Use cases

Python nearly has a library for anything and an SDK for everything. But I don’t think Python should be used on the web. We have much better solutions for the web like, Typescript, PHP or Kotlin. Python is great for building services. This is why a lot of micro-service architectures is using Python.

Yes it can be used we Django on the web, but what is the point of doing that? It does not offer a solid set of rules for writing clean code on the web, it does not provide type-safety out of the box and it is too free with not any restrictions at all.

Yet, I wouldn't say it is bad. Quite the opposite, it is fun to work with, and you can write clean code if you intend to. I would use Python for some of my web services, such as LLM integrations, data manipulation, scripting, and connecting to third-party APIs.

Scalability

Python can scale as well, it is cheap to run and it shines on micro-services architectures. You can literally have millions of requests come through your Python application and maintain a solid performance. It is not the best for scale compared to Kotlin or PHP for the web but it gets the job done.

Python has a ranger from very small projects that might only have available 50mb of RAM to large ones. When you get to really large projects and big monoliths I don’t think you would choose Python but for anything semi-large it is amazing.

Score

I don’t have much to say about Python because it is well established, if you want to go with it, then go. Python is a fair solution for almost everything. Overall is doing great and it gives you the option to extend it as you like. With that said I would give Python the best language award because it is simply overall the best.

Python

  • Community & Ecosystem: 10/10 (Great community, just boring) 🌐

  • Scalability: 7/10 (Can scale) 📈

  • Developer Experience: 9/10 (Almost great) 😱

  • Fun: 9/10 (Easy complexity) 😩

Final Score: 9/10

PHP

Here we have a competitor with a really bad reputation. So bad that everyone thinks there is no reason to mention PHP. But just because PHP made a bad impression 10 years ago doesn't mean it is still a bad option.

The first thing I want to tell you is that for the web, PHP is the best overall solution. Its features simply outperform every other language when you look at it from above.

Developer Experience

Setting up and working on a PHP project is very easy. With any PHP framework, you can start coding in just 2 minutes. In terms of ease of getting started, PHP comes right after Python, and it's easier than JavaScript.

The libraries for web development are extensive. If you plan to create a simple CRUD web project without any special features like AI or advanced processing, then PHP is your best choice. Most web projects are simply CRUD applications, and for that, PHP is perfect.

PHP has the amazing feature of using no resources when it is in an idle state. For example, when your Kotlin app needs 600MB and your JavaScript project needs 200MB, PHP needs 0MB. It spins up a worker only when needed. It works on a per-request basis. This can be a drawback if you want to scale to billions of requests, but until you reach that point or handle hundreds of millions of requests, you will be fine.

Clean Code

I have seen more bad code on Python or JavaScript rather than PHP. I don’t know how this is possible but PHP code most of the time is pretty solid, clean and readable. For a new developer it is going to be easy to started with a very small learning curve.

The syntax is simple with not many advanced features bundle in, but you won’t actually need them as well.

The community is great any resources online are endless as it is a very old language. The performance is amazing and with PHP 8 I would say it outperforms a lot of competitors out there.

Score

PHP cannot handle complex projects as well as other languages because it lacks robust SDKs like Python or JavaScript, making it less portable. Despite this, the ecosystem for web-related tasks is excellent, and you will have a pleasant experience working with it.

Python

  • Community & Ecosystem: 7/10 (Good community) 🌐

  • Scalability: 7/10 (Can scale mostly for web projects) 📈

  • Developer Experience: 7/10 (Good enough) 😱

  • Fun: 7/10 (Easy complexity) 😩

Final Score: 7/10

Thanks for reading, and I hope you found this article helpful. If you have any questions, feel free to email me at x@sotergreco.com, and I will respond.

You can also keep up with my latest updates by checking out my X here: x.com/sotergreco