How To Overcome Barriers When Solving Programming Issues
Programming is hard and you will often find yourself in a love-hate relationship with it. You love what you do, but you hate it when you don’t get something right.
There are sometimes issues with the frameworks you are using or maybe even the language and technologies themselves, but most of the time you find yourself stuck due to another reason.
That another reason is not focusing enough on how to break down and deconstruct problems.
You don’t have to be a programmer to become better at problem solving.
The rule of breaking down issues into pieces applies to everyday life and he who gets to master this skill has everything to gain, no matter his line of work.
Divide Et Impera
Before you write any lines of code, pick one issue you are trying or have been trying to solve and step back from the computer. Do not write a single line of code!
Instead, grab a sheet of paper and a pencil and start breaking the problem down. Don’t even think about programming. Your focus should not be on code at all.
Go ahead and try and break the problem into smaller subproblems until you can start writing very basic instructions. I encourage you to break your instructions down until a 5 years old can understand them. Think small instructions, small sentences, small words, but still be very detailed and methodical about your approach.
It’s very tempting to treat a problem with superficiality and give really skimpy instructions that will eventually lead to bugs or not completing the issue at all.
Resist that temptation and remember that computers are stupid, they do only what you tell them to do. They cannot read your mind! – well…not yet.
The entire point of writing down instructions on a piece of paper or a whiteboard is to eliminate your tendency to hand-wave and make assumptions , and instead break the problem into tiny pieces.
Train yourself in this skill until you can do this naturally!
Only begin writing code once you’ve finished planning your program on paper. When you start doing this, you’ll find that most of the time the problem has an easy solution and can be coded using basic primitives such as if statements, for loops, while loops and basic data structures.
If you are working in web development in particular you will find yourself using at least one library. That’s totally fine. Libraries are here to help and make our work easier but there is also a downside to this. You will be tempted to skip certain steps of your instructions just because the framework or the library allows you to.
Be vigilant in this situation and try to thoroughly understand what that particular function really does. This will save you plenty of debugging time in advance and you will better understand the functionality of the library or framework.
Over time you will gain more experience and learn more about the language and technology you are using and you will get better at problem solving, but only if you work through challenges, exercises and problems.
Break It Down…Away From The Computer
As I said before, you can train and use your problem solving skills in other ways besides programming.
For example, take a random piece of furniture and ask yourself how you might design and build it. Come up with schematics, figure out what parts you might need.
Think of some type of dish and ask yourself how you might go about preparing it. Take something you do every day but never consciously think about such as using a wash-hand basin.
Or, way better… pretend you’re a robot and come with instructions on how to use certain objects around you. Give yourself step by step instructions on how to use the microwave oven – and everyone around you will love you.What you’re trying to do here is gain the mindset of an engineer. Engineers, no matter the discipline, do this kind of thing all the time.
Whether you are architecturally designing a bridge, building wood furniture or writing a program, the underlying process is the same.
If you have a big and somewhat intimidating task ahead of you, start breaking it down, chipping away at pieces, until the previous problem is just a series of tinier problems that are much easier to tackle one-by-one.
The reward for being a good problem solver is to be heaped with more and more difficult problems to solve. – R. Buckminster Fuller