Programming….is it really hard? is it really scary? is it really not everyone’s cup of tea?
You might be asking several questions to yourself before stepping into the programming world. You might be also getting scared when you listen to a lot of jargon words which programmers exchange with each other to communicate about software. Every beginner who enters in programming faces the same problem…difficulty while solving the coding question, difficulty in getting the logic of the code…difficulty in approaching a problem and getting the solution
. When other programmers are good at solving the questions, good at implementing the logic of complex software and good at building the features of any software most of the beginners start doubting their abilities.
In most cases when beginners start getting frustrated, either they give up on programming or they try to find the solution of a single question “How to think like a programmer and solve coding question quickly?
“. You might have received a lot of advice from professionals, you might have read several articles and blogs and you might have followed some tips as well. All these advices written in blogs and given by professionals making you more confused because you are still unable to find out a common hack that every programmer is using while solving the coding questions quickly. So what is the common approach every programmer follows to solve the coding questions to become good at problem-solving skills? In short, here is the answer…
A Common Hack Used By All The Programmers To Build Problem-Solving Skill
You can only solve the problems quickly if you’ve already solved the problem / seen the problem solved before.
The challenge is, therefore, ensuring you’ve seen every problem before.
Now, this doesn’t mean that you need to have seen every problem before, as that is impossible. In these cases, you have to be able to identify patterns in programming challenges
. This comes from ensuring you understand the solutions of a variety of problems deeply so that you can identify when two problems are similar and you can use the principles behind the solution of the solved problem to solve the unsolved problem.
People who are beginners in programming they should firstly start understanding a bunch of core algorithms and data structures
. Read the solutions to some more problems until patterns start to become visible to you. Then, you should practice challenges online until you’re fast. In programming solve a lot of problems, and the more you solve, the more you will see patterns from old problems in new ones you are solving, and you will get better over time.
Three Things To Keep In Mind While Building a Software
Look at the picture given below…
What do you see?? a puzzle…How are you going to solve this puzzle…? Well, this puzzle is divided into smaller chunks
and to find out the complete solution most of the people follow three steps…
- Try a solution.
- If that doesn’t work, try another one.
- If that doesn’t work, repeat step 2 until you get the solution.
Remember that initially, as a programmer you have to face problems most of the time in a block of the program
, and you have to fix it doing permutation and combination. If you are a fresher you will feel less interest in resolving bugs/issues because it will take more time to resolve. This time you need to have patience instead of giving up on programming. There is no substitute for deliberate practice. You need to evaluate the problems from different angles. There is a famous quote which most of the programmers have heard before…
“Everyone in this country should learn to program a computer because it teaches you to think.”
— Steve Jobs
Do you understand the real meaning of the quote….??? What exactly it means to think like a programmer??
We are going to explain here and if you understand it then probably you will understand the real meaning of what programming is in reality…
When you encounter a problem…read it carefully. Read the expected outcome. Then think about what steps are necessary to solve that problem. Resist the temptation to go in and blindly try things. Instead, step back and think about what you’re doing. Slow typist is always better programmers why…?? because instead of jumping into the solution quickly and using their hit and trial method they think a whole lot about what needs to be done, then they do it. Now you might have sensed the deep meaning of Steve Jobs’s famous quote.
Now we are going to discuss three major steps that every programmer should follow in industries while building a software and to become a good programmer.
Make it work, make it right, make it fast.
1. Make it Work
When you encounter a problem the first step is to make it work. The goal here is only to understand the problem and find solutions. Nothing more.
You might be thinking that your program should be also correct and optimal one but doing premature optimization is always a foolish idea. You will end up getting nightmares of your code. Remember that a good solution has to evolve and become better over time… start with just “any” solution.
You can make the code do what it’s supposed to do in whatever ugly, messy manner you want, so long as it works. We are talking about software and there is no cost of materials so instead of trying to find a perfect solution in your first attempt, only find the solution that makes the feature work in your software. Don’t waste your time worrying about whether your approach is ideal, your code elegant, or your design patterns perfect. If you think that there are multiple solutions and you are unable to find the best one then pick one and go with it. Once you’re done make sure it works and works repeatably.
2. Make it Right
From the first step, you have a working solution for your problem and an inexpensive way to ensure it remains working while you modify it. Now your job is to follow the refactoring fundamentals to improve your code’s design
. Follow the software principle, check if any design patterns might make your solution more conventional. Refactor; Deduplicate code, clarify interfaces, sole responsibility, SOLID, etc. While doing this make sure that you or somebody else understand and make changes in it without much effort. It becomes easier for you and for other developers to maintain your code.
3. Make it Fast
Now you need to measure the performance of your code which is the third step…code optimization
. Well, this is the hardest step in programming but If there are any obvious performance bottlenecks with easy solutions, implement them now. A lot of companies just release the solution to production that works from the ‘make it right’ stage. It’s highly recommended that if you have enough resources and time then always think about the performance of your code. Code optimization is not just about “how can I get this code to run faster”. But it is more than that. Your code should take less time and it should use fewer resources. You should be thinking how can I make it more testable, how can I make it more extensible, how can I make this code more valuable to the user
Share your thoughts in the comments
Please Login to comment...