Golang, Java or Python
If you are a technical lead or a senior engineer or someone with enough context. How would you decide which language to use for the new application you are writing. What are the factors to consider ?
I faced this problem couple of months ago when I started a project. At the core, I use the following principle.
"Slow solution is better than No solution"
I was torn between C++, Rust and Python.
So I sat down, had an honest discussion with myself on what I need.
I opened up a register and wrote down the requirements, they were:
- fast
- low memory footprint
- cross platform with easy deployment
- easy to understand code
- easy to refactor, scale or test
- good third party dependency manager
Then I wrote down pros and cons of each language, in context of my requirements :
Python Pros & Cons
+ Easy to code and understand.
+ Relatively best dependency management, pip.
+ Fastest for prototyping and experimenting.
+ Faster onboarding and development sprintds.
+ Relatively easy cross platform deployment.
+ Easy to test using pytest.
+ Have recent 2 YOE with latest Python version.
+ Nice logging and CLI support
+ Great community with good debugging support
- Slow
- High memory footprint
- Stupid variables design (call by ref not value)
- No pointers
- Type unsafe with only linting
- Pathetic binaries generator, pyinstaller
- I absolutely despise lack of curly braces
C++ pros & cons
+ Can be made fastest with careful usage
+ Low memory footprint
+ Perfect variables and memory management
+ God loving pointers
+ Type fucking safe
+ Great compilers available for all major platforms
+ Incredible community with debugging support
+ Have most YOE with it and personal bias
+ Easy to test using doctest
+ Good logging and CLI support from third party
- Bites you in the ass for compiler errors
- Painful cross-platform deployment using CMake
- Slow onboarding and development
- Not good for prototyping and experimenting
- Relatively worst third party dependency integration. Your dependency may work on one platform or architecture. It gets tough to integrate components using CMake and handle CMake version conflicts.
- Have to actually dig out good libs to use and spend time understanding their docs.
- Not so easily readable at first glance but can be improved massively.
- Requires absolutely massive boilerplate to work with.
- I'd be spending writing code for several dependencies and build systems (cmake) than working on core functionality.
Rust Pros & Cons
+ Newest thing in the market
+ Best thing between C++ and Python
+ Overcomes several shortcomings of C++
+ Good package manager
+ Easy to understand
+ Easy to code
+ Awesome variables
+ Awesome memory management
+ Pointers <3
+ Type fucking safe
+ Incredibly fast
+ Would learn new stuff
- Third party libs not as rich as pip or cpp
- Got no working experience
- Have no idea on how to structure scalable project in this lang
- Would have to spend time learning it.
I ended up selecting Python.
4 months in and I am so far happy with my decision.
Do I hate the language? Yes.
Do I miss curly braces? Yes.
Is this fast to develop? Yes.
Is the application slow? Yes.
But does app exist publicly? Yes.
I released my v0.1 within 1 month, with C++. I am sure it would take double or triple time of it.
I did not choose Rust since I want to fight only one battle at a time. Me vs core problem. Not me vs core problem & foreign syntax.
We are lucky that we develop software that can be repaired and made faster during development. Whatever we do is not set in stone and we don't have to discard and demolish everything if I find some fundamental mistake. We have VCS.
Although, I thought out and brainstormed everything I could on paper about my application before writing a single line of code. There are several things that you only realise while you are in development.
With python I am in relative ease of tackling development problems fairly quickly.
I will try to extract all the possible juice from Python while I reach v1.0 (have that in roadmap). I am planning on exploring mypy, codon and mojo. And thankfully, things are looking hopeful.
Still, If I feel there is more to do and realise that I'm limited by the language.
I can switch to C++ and just release v2.0.
By this time, it would be tad easier for me to code as I would only have to deal with one problem. Syntax.
Since I've already solved the business problem, It would be fairly quick for me to catch up with Python codebase with C++
As a perfectionism patient, this tradeoff of logical discussion helps me move out of my analysis paralysis.
Thanks for reading. Ignore grammer, I'm half asleep at the moment.
Learn Java first. Its evergreen and you'll learn a lot.
Then move to GoLang, it has taken over west and many Indian companies are
Discover More
Curated from across