DEV Community

Kevin Naidoo
Kevin Naidoo

Posted on

Go Vs Node Vs Python Vs PHP. Do you context switch?

I do context-switching a lot. I manage a large architecture with various moving parts in multiple languages.

There is this old JS node script that I needed to make changes to, I get the need for TypeScript but I just don't have the time to rewrite the whole thing.

Nonetheless, man! "async await", nearly the whole script everywhere, it's ugly and disrupts my flow.

Python on the other hand is a lot better, but maybe I haven't installed the right vscode extensions. The type-hinting sucks! In a large project, I constantly forget the field names, and also lack of interfaces is a bit annoying.

PHP, which I enjoy, is still one of my favorite languages (Is my second language after C# so very fond of it) but yeah constantly forget the needle/haystack thing, and Laravel keeps getting more and more bloated.

Golang! The mighty Golang, something about structs and the formatting package. I just open Vscode and voila! Logic just flows into code like poetry.

Nearly all of what I need is in the standard lib, and the IntelliSense just works. The package manager is also quite efficient, just "go mod tidy" and everything is downloaded and ready within seconds.

Finally! "go run build", and deploy! Done! Nothing to install or configure, even if I am using drivers like MongoDB or MySQL, the host machine doesn't need apt packages.

How's your experience with these languages?

Top comments (6)

Collapse
 
xwero profile image
david duymelinck

Php is my comfort language. But I use javascript, python, go and C#.
All languages have their own positive and negative points. And you can learn from thee positive things to take with you to other languages.

I use the jetbrains IDEs which gives me a similar workflow when switching languages.

ps: python interface article

Collapse
 
kwnaidoo profile image
Kevin Naidoo

Thanks. Yeah, 100% Jetbrain IDEs are generally awesome, I used PHPStorm for some time, but since I switch a lot, it's much easier just to use vscode.

In terms of the interfaces, Python has ways like with this article but it's not clean enough for my liking compared to say PHP interfaces which are first-class citizens.

Collapse
 
xwero profile image
david duymelinck

I used idea ultimate for a long time and added the languages I needed to it. But it is not the same as the language specific IDE. They provide just that little more effort to make working easier.

Sure in many languages you have an interface keyword to identify the purpose of the code, but does it matter if you have a feature in the language that does a similar thing?
For example you don't have enums in go, but you can use grouped constants as an enum.

It all depends on your preference which way you like it more or less. If you learn other languages you get to know other ways of doing things. And they can be just what you need for your code.

Languages for me are more different screwdrivers than a mutlitool. You can do everything in every one of the languages, but some things are harder in one or the other. Why settle for the hard way if another language gives you an easy way.

It is true that when you dive deep into a language you will discover more features that someone who knows multiple languages. But the problem is other people need to be able to understand the code to. And if they don't understand the language part of the code, they are going to make mistakes.

I have a lot of respect for people who dive deep into languages, they taught me a lot. But I rather want to specialize myself in fixing domain problems. And that is why I use multiple languages.

Thread Thread
 
kwnaidoo profile image
Kevin Naidoo

I agree with the "screwdrivers" analogy, and yeah it's important to also do things in the way the language you are currently working with recommends rather than writing PHP in Python or Java in PHP and so ...

My main goal with this article is to show appreciation for Golang, and its creators. You can see throughout the language, careful thought went into keeping it minimal and performant.

Languages like Java for example (nothing wrong with Java by the way! Great language), can get verbose and you end up spending so much time writing boilerplate code.

Then you get languages like JS/TypeScript where you have to import nearly everything.

Even though Golang is so minimal, the standard library is fairly good and caters to a wide variety of use cases before you need to reach out for some third-party package.

Golang essentially has the aesthetics of Python, and the minimal nature of C, and the performance is great too. One of the best modern languages yet.

It does have a few shortcomings as with every other language, but what it does get right, it outshines nearly all other languages in that regard.

Collapse
 
go4webdev profile image
Go4WebDev • Edited

I try to learn as few languages as possible. I think I become more productive then.

Using Go for both frontend and backend. Strange thing is that I find it way simpler than Wordpress / Drupal. I avoid Javascript if possible. I have found some tricks to reduce the Javascript code by using SSR and Go.

I maintain a PHP forum which I hope I never will touch again. PHP have a lot of dependencies, moving parts and takes lots of space and memory. So PHP will never be on my to-learn-list :-)

Collapse
 
kwnaidoo profile image
Kevin Naidoo

Yeah, Go is cool for a web app, so productive and you get a single binary as well.

WordPress is the worst thing ever but I kinda like it for small websites/blogs:-) WordPress was built at a time when PHP was a bit odd and "dirty". They have to keep that legacy support since so many plugins and themes are built around procedural PHP.

At the time CMSes like Joomla and other random projects sucked when it came to writing themes. In WordPress you can easily just convert an existing HTML design within a few minutes. So theming is a breeze and that's why there are so many great-looking themes out there.

What derailed it, was developers trying to use it as a framework to build large applications and all these marketplaces with poorly written plugins.