Take the time to understand your problem and use every tool at your disposal.
Otherwise you won’t get any sleep tonight and you’ll feel foolish in the morning.
Problem solving is fun. As a society we have created whole industries around it. From the most basic puzzles to latest craze of escape rooms, everyone loves a head scratcher. Even though The problem solving aspect isn’t what originally drew me to programming its one of the reasons I stayed. I was working in the service industry at the time and though work was fast paced and physically tiring the mental challenges were lacking. I’ve found all metal challenges ill ever need in Coding bootcamp. The only problem is sometimes while Im merrily typing away the hours fly by. When there isn’t a deadline or you don’t need to get some sleep thats not a problem. Unfortunately Im planning on making a career of this. From what I understand of the arrangement employers like to set deadlines, also I plan on sleeping again.
So what do I do.
The first step, which I’m still working on, is not just diving in. I know it sounds somewhat counter intuitive to some but You will save sooooo much time by getting to know your problem. White boarding is particularly helpful in this. IOCE’s inputs, outputs, constraints, and edge cases. Know what type of inputs you’re getting, what the data you’re outputting should look like. You should also know if you have any constraints on your problem solving and if there are any possible edge cases that fall outside of a possible solution. You don’t want to find a solution to the wrong problem its a time waster and frustrating.
The next step is don’t pass up a solution. After you start coding make small changes and evaluate constantly. There will be times when you change to much and miss a solution because you broke something else before you evaluated it. You should also use all of the tools at your disposal to evaluate your code. The most under utilized of these tools among beginners is the debugger. Stop console logging everything. All those console logs clutter your screen and only give you a limited view of your problem. Debugging on the other hand saves you the clutter and gives you a timeline of values not just the one snap shot you’d get from logging.
Lastly type faster and learn keyboard shortcuts. You could be the most knowledgable programmer in the world but if you’re slow you aren’t the best. Its going to be rare that you immediately know exactly how to solve a problem and even if you do sometimes you’ll need to tinker with your code. The better you are at typing and using shortcuts the more test you can do and solutions you’ll find.
Becoming a more efficient and productive programmer is a must, otherwise you won’t get enough done or enough sleep and you feel foolish when you realize just how much time you wasted.