Before we answer this question, it is necessary to understand what competitive programming is? Why people are doing it? And what do they get from it? Once we answer these questions, we should be in a good position to conclude whether competitive programming is really needed to become a good software engineer.
What is competitive programming?
Competitive programming is like a contest or sport where you will be given a problem statement which you have to solve using your preferred programming language preferably in least amount of time.
In the above statement, pay attention to two things as CP (competitive programming) teaches you a lot about them.
- Preferred programming language
- Least amount of time
Preferred programming language
In a programming competition, you do not jump in with working knowledge of dozens of programming language. If you do that, you are bound to get one of the last positions in the leader board. Why are we saying this? See, programming languages are tools to solve problems and to solve a problem you need to have a good hang of your tools. So, it’s better to know a couple of programming languages (1 to 3 at most) and know them very well because in the competition you might not have time to search a particular way to do something in the language which you are using.
Hence, when you keep using one or two programming languages in competitions, you eventually become good at them which becomes an advantage for you in the competition as well as your career.
Least amount of time
As the heading implies, you have to solve a problem in minimum amount of time both in terms of implementation and execution of the solution. Let’s talk about both scenarios.
In a competition, you have to come up with a solution quickly or at least before everyone else. This will give you an upper hand in the situation where you will have a bit more time to implement and debug your code to solve the problem. Let’s assume you come up with a solution which requires you to use lists and hash maps and you don’t remember or know how to use them in your programming language. In this case you will definitely search for it on the internet which will take up some time and will add up in your time taken to implement the solution, which might cost you some points. So, participating in programming competitions train you to implement frequently used data structures, algorithms and code patterns such that you don’t have to even think before using them which saves you a lot of time.
On the other hand, when your solution has been implemented and has to run within the time constraint mentioned in the problem statement. It has to be written in an optimal way such that in a given timeframe your code passes all test cases. This forces you think optimally for every problem and improves your problem-solving skills.
Why people do competitive programming?
There are three main reasons why people like to do competitive programming:
- To aid in learning programming, data structures and algorithms – mostly done by students and job seekers (freshers + laterals).
- To be a competitive programmer – this is like becoming a professional sports person. Mostly done by students and developers who have a vast experience and extreme interest in competitive programming.
- To keep their skills sharp – Mostly done by experienced developers in their leisure time.
Majority of the people lie in the 1st category i.e., people who are either new to programming and want to learn it or people who are preparing for job interviews.
2nd category consists of programmers who take competitive programming as a side hustle if they are working or students who wants to measure the depth of it. They can generally be found on the first page of the leader board of programming competitions.
3rd category generally consists of experienced developers who are responsible for developing and maintaining large and complex software systems having deep understanding of system architecture. These developers do some competitive programming to keep their skills sharp or just to have some fun in their leisure time.
Is it required?
First of all, you should understand that a software engineer is not person who just produces code. A software engineer possesses different qualities, programming happens to be one of them. CP primarily focuses on this skillset.
In real life, you won’t be using as many algorithms you learned and implemented in your competitions. But that doesn’t make software engineering easy as compared to competitive programming. As a software engineer you have to deal with large software systems which are made up of different sub systems which communicates with each other to create a complete solution. In such cases if you try to use your competitive skills and implement a feature or fix a bug quickly then either you will end up with an incomplete/buggy implementation or your code might get rejected in code review because you are not habitual of writing human readable code. And this is just one example out of hundreds where your competitive skills can make you a liability on your team.
So, is it required? Well, the answer is not as simple as YES or NO. It actually depends on who are you and what do you want to achieve. Let’s discuss about some scenarios which will answer most of the situations.
- You are a student and
- Just starting out – You should definitely actively participate in competitive programming. You can give 60 – 70% of your free time to it and rest can be given to learn more about programming languages and build small applications with them.
- Been doing it for 1 – 2 or more years – In this case you should not give more than 30 – 40% of your time to competitive programming. You should be spending more time in building projects, doing an internship or work as a freelancer. This is the time where you have programming skills but don’t know how to use them. So, try to get some real-world experience.
- You are working professional (junior and mid-level) and
- You are looking for a job change – You should be focused more on learning about the things which you worked on and should at least give 20% of your time in learning data structures and algorithms through competitive programming.
- You are not looking for a job change – You should not give more than 10% of your time to competitive programming. Instead focus on knowing more about the project you’re are working on and technologies related to it.
- Remaining – Up to you. If you want, do it otherwise don’t do it.
In a nutshell, competitive programming is a great way to increase your programming and problem-solving skills but to be a good software engineer you need more than just that. So, you should include competitive programming in your career journey as you see fit.