This is a collection of tips for novice developers who look at a blank screen and don’t know where to start. It is not uncommon to hear from young developers working on some programming task that they are not sure what to start with. They google “how to do my programming assignment?” in the hope that there is a magic pill on the Internet to solve all their coding problems.
We have collected for you the most useful tips to help you cope with programming assignments if you are a student and lack time and energy.
Read the task requirements at least three times (or at least as many times as you need)
You can’t solve a problem if you don’t understand it. There is a difference between the particular problem and the problem you think you are solving. You can read the first few lines and make assumptions about the rest because everything looks similar to what you’ve encountered before.
Sometimes you can try explaining a problem to friends and see if they understand your explanation. You don’t want to go halfway through and find that you misunderstood the requirements. So it’s better to spend more time at the start to make things clear. The better you understand the problem, the easier it will be to solve it.
Plan the implementation of your programming task
A plan is your roadmap to solving the task. Don’t start solving a problem without a plan, hoping not to get confused about it. Give your brain time to analyze and process information.
We offer you a simple question to ask before compiling a plan:
Given A as input, what steps do I need to take to get B as output?
This is the most important step. You have to divide your plan into milestones and subtasks. They will be much easier to solve, track the progress, and pat yourself on the head for an excellent job.
You should start solving subtasks from the easiest ones. When a problem seems easy, it means you know the answer (or are close to it). Narrow down the problem until you understand how to solve it. Solve each subtask independently of the others, and after solving it, combine the results.
Combining all the small problems will give you the solution to the original problem. This method is the cornerstone of problem-solving.
Don’t get discouraged if you get stuck
Even the most advanced senior developers sometimes do not know how to solve a particular programming problem. Their difference with amateurs is that they take a deep breath, fix a bug, or start looking for an alternative solution.
When you encounter difficulties, you should take the following three steps:
- Debugging. Check step by step where you might have gone wrong with your solution. Essentially, you need to understand how what you wanted to write is different from what you ended up writing. Debugging can be done manually (which is more time-consuming) or using special programs and tools.
- Change of approach. Find the subtask where something went wrong and look at it from a different angle. Very often, young programmers go deep into the details and abstract from the generally accepted principles that can easily solve a problem.
- Tip: If debugging and finding the problem area takes you too much time and effort, it is better to delete all the code and start writing it again using the new algorithm, not the one that did not work last time.
- Research. The World Wide Web holds tons of tutorial videos and articles in its depths. You’d be surprised how many people might have encountered the same problem you did. We’re not talking about you needing to steal someone else’s solution. We are advising you to turn to research and get hands-on experience when the original solution didn’t work.
Caution: Don’t look for the solution to a big problem. Look only for solutions to small subtasks. Why? If you don’t work hard, you won’t learn anything new. If you don’t learn anything, you’ve wasted your time.
After the basic steps have been worked out, write pseudocode that can be translated into real code. This will help you determine the structure of the code and make it easier to write in general. Write the pseudocode line by line. You can do this on paper or as comments in the editor. If you are just starting out and think a blank screen looks creepy or distracting, it is better to write on paper.
In general, there are no rules for writing pseudocode, but you can include syntax from your language if that’s more convenient. But focus not on the syntax but the logic and steps of the algorithm.
Convert the pseudocode into normal code and debug it
When you have your pseudocode ready, convert each line into actual code in your language. If you wrote on paper, transfer everything to the editor as comments and then replace each line.
You should now call the function and give it some of the previously used data sets. This way, you can check if the code returns the right result. You can also write tests to see if the output matches the expected result.
You can use console.log() after each variable or line. This will help you check if the values and code behave as expected before moving on. This way you’ll catch any problems without going too far.
Sometimes, novice developers get so caught up in the syntax that they have trouble moving on. Remember that you’ll find it easier to follow syntax over time, and there’s no shame in referring to reference materials later when writing code to ensure correct syntax adherence.
Write helpful comments
A month from now, you may not even remember what each line of code means. And the person who will be working with your code won’t know it at all. That’s why it’s important to write helpful comments to avoid problems and save time later when you have to go back to that code again.
Even experienced developers are constantly practicing and learning. If you get useful feedback, you should implement it. Solve the problem again or similar problems. Challenge yourself. You get better as a developer with each task you solve. Enjoy each success, and don’t forget how much you’ve already accomplished. Remember that programming, like any activity, will get easier and easier with time.