Are you a beginner and want to start competitive programming? Are you facing an issue while choosing the programming language to start competitive programming? Then here in this post of Terminal Stack, you will get all your doubts clear.
There are 100’s of computer languages, but beginners mainly start with C++ or Java as both these are object-oriented programming languages.
There are a lot of applications for using C++ as a competitive programming language. Some of this I have listed below –
- Most of the colleges in India have C/C++ in the curriculum, so it is one of the heavily used languages in colleges.
- One of the most sought out languages in sports programming is very fast. It’s STL (Standard Template Library) contains ready-made implementations of some of the most frequently useful DS and Algorithms like Hash Maps, Hash Sets, Binary search, etc.·
- Although C++ is an object-oriented programming language, participating in sports programming will not make use of those concepts as sports programming generally requires writing quick messy code in a short time frame under pressure which is also very hard to read. This is the reason, contest programming is somewhat loosely related to “Programming in the real world” which includes writing modular and maintaining software systems.
Desktop/ Native applications
- Companies such as Microsoft and Adobe heavily use C++ to create desktop applications. Applications such as Adobe reader and office 365 which you must have installed in your laptops are coded in C++.
- Native apps are generally platform dependent [MacOs, Windows etc] and can work without internet connectivity.
- Companies such as Tower research, Graviton research etc., which are specialized in algorithm trading heavily relies on implementing their trading platforms in C++ where low latency [sub-microsecond level] is required to generate profits. These companies do a lot of optimizations as C++ gives you much more control.
- One such example is: Memory management- in programming languages such as Java, a lot of CPU cycles will be spent on garbage collection which cannot be avoided and this can hurt sub microsecond level latency. In C++, we have full control when to allocate and free memory. For low latency systems, we can allocate it all at once and don’t pay the penalty of any allocations related to the task at runtime.
Hardware Companies such as Samsung, Intel, Qualcomm, etc. use C/C++ for embedded systems where we need to go very low level and work around memory structure, writing custom device drivers and writing low-level code that directly gets executed on the bare metal. So if you aim to get placement in such companies you should go with C++.
Very few colleges in India have Java in their curriculum. It is one of the most sought out languages in the industry
Implementations and Jobs
- Java supports very rich ready-made implementations of most commonly used DS and Algorithms which are called Collections in Java, similar to STL also, Java has libraries for dealing with very large integers and doubles which are missing in C++.
- We have always heard that we can use any programming language in an interview. But I have seen many interviews where an interviewer was biased towards Java as he has only worked in Java in his entire career.
Unlike C++, when Java is compiled into a platform-specific machine, rather into platform-independent bytecode (.class files). These .class files can be executed by any operating system and platform which have a JVM application running in it.
So, programs developed and compiled in java in one machine can be executed in any other machine, provided JVM for that machine is installed.
Java is used very heavily in almost all types of domains such as E-commerce Giants [Amazon, WalmartLabs], Big Startups [Flipkart, Swiggy], Major financial institutions [Goldman Sachs, JP Morgan Stanley], and many huge companies use java.
Frameworks such as SpringBoot, reactive java, etc are used to implement web applications in a microservices style architecture that can help you scale your applications and handle a load of huge amounts of users at the same time.
The dominance of Android Java is mostly using for mobile applications development
- To sum up, if you are in college and looking at the languages only for the perspective of sport programming. I would suggest thinking otherwise; you should not stick to just one language. Make yourself comfortable in at least 2 languages. If you see yourself as a software Engineer working in top tech companies 3-4 years down the lane, you will be working in a codebase with at least 2-3 different languages where each language will be catering to a different use case
- If you want to make a career in the fintech industry around High frequency trading, make yourself proficient in C++
- If you want to write complex web backends which can scale to millions of users, go deep into Java.