Insights in Solving Hard Coding Problems

Daniel Guedes
Arionkoder Engineering
6 min readAug 2, 2022

Programming is not easy. Even things considered entry-level for developers, such as creating simple CRUD apps inside a language/framework require a reasonable amount of skill in coding, researching, and planning to succeed.

The situation is even more complicated when dealing with complex problems, related to the business domain, architecture patterns, and complex algorithms and solutions. So how would you solve a complex problem, when even where to start is not clearly defined?

How can complex road systems be built? One road at a time…

I’m writing this article to bring some ideas on how I do that, and maybe those can help you too. So without further ado, let's get to it.

1 — Divide and conquer

Uncover the pieces, learn how to fit them, and solve the problem.

Let’s say you want to build a full-stack video application for a course platform. You want the video to load in small parts at a time, and not all at once. You also want to make sure the video is not easily downloaded by your users. So what is the most basic setup for these specifications?

  • We need a server that will listen to user information with the video ID, time span, and size of the package. Each video part can be sent as binary data according to this info using an HTTP GET request;
  • In the frontend, the video will be loaded to the <video> tag as a blob, along with necessary metadata;

Now, we have the basic information about the problem, if we can solve these two parts, we can solve the problem as a whole. Every solution can be thought of as a puzzle, you just need to uncover the pieces and how to connect them, and you’ll have the final objective concluded.

You may ask, but how can I know that I need to send the video as binary data? How can I do that? Or also what is a blob?

These pieces are also part of their own puzzle, and in all steps knowledge is key. Asking the right questions is the catch that will lead to answers. For example in this situation we may ask in order:

  1. What is a video?
  2. How to read a file by its binary data?
  3. How to split binary data from a file in an ordered way?
  4. How to send data in order with an HTTP request?
  5. How to read a file in small bits at a time? What is a stream?

These questions will lead to answers that will allow the uncovering of the solution to the problem. By dividing your problem into ever smaller bits of a whole, there will be a point where you’ll know the answer to some of the questions, and like in a puzzle by combining the pieces you’ll get a better understanding of the whole picture and what kind of pieces connect where.

The thing that is difficult with programming, is knowing where to divide and where to connect the pieces. It's like a puzzle where you see the big picture, but can't make sense of it, so you hack it into pieces until the point you understand the single pieces, and then you rebuild and understand the big picture.

There’s no universal answer on how to do that division, and it depends on the problem. But some of the skills that help with that are:

  • Experience;
  • Overall knowledge, not only of programming;
  • Knowledge of the basics, such as Data structures and Algorithms;
  • Domain knowledge of the problem;
  • Knowing what is the category of the problem. Ex. Algorithms > Array ordering;

2 — Know how to search and where to search

Now, I’ll address this a little differently. I could go on and show how to google, use stack-overflow, and these standard answers. Here I’ll give an answer that is valuable and so far I’ve seen few developers doing it.

With a problem that is uncommon, or very difficult, you won’t find answers on google or StackOverflow directly. You’ll find it very hard to find an answer to these problems. For example, some of the problems may be:

  1. How to create a multi-layer webcrawler? One that starts on a page goes through links in an efficient way until it finds the information.
  2. How to do a JSON object diff from scratch?

You’ll not find direct solutions to these problems in a google search, or you may find something that is not in the patterns that you want. So go to open source.

Code for all

Let's take the example of the object diff. It's not easy to find an answer, but we can find tools and libraries that do it. For example, Jest is an open-source javascript library for tests. Go to the GitHub project and read and go through the logic. Here’s a starting point. Or also this one.

Again, knowledge is key. So knowing where to look in the code and what project to look for the answers, to requires time, research, and experience.

3 — Share with others

Together we can do more

This one may even be a tip for life. Be open about the problems you want to resolve. Maybe go for a coworker, or ask a question in StackOverflow, or on the issues page of the framework you use. Sometimes you may not find the answer, but even when you don't find it directly hearing what others have to say about the problem may give you the necessary tip/insight to find the answer by yourself.

Sometimes coding may feel like a lonely activity, but it couldn’t be further from the truth. Ever thought about all of the people directly and indirectly affected by your work? Team members, other people from your company, the customers, and people who heard about the product from a third party. Everyone has a particular vision, that may help you in some way. So if the situation allows sharing, don't keep it to yourself.

4 — Don't dwell too much on it

Ever got into a conversation/meeting problem, only to come across the perfect argument hours later? Don't dwell on it too much. Got to a point where it seems like no progress is made? Stop and catch up a few days later. You may end up finding the answer when you’re least expecting it. Simple and to the point.

Wrap up

Difficult problems are difficult for a reason. Don't feel bad if you can't divide, search or get a solution right away. There are mathematicians who spend decades trying to find a solution to a single problem.

Remember, knowledge is fundamental in finding a solution, and not only knowledge related to the problem you’re facing. Sometimes when solving another seemingly unrelated problem you may find insights that will help you.

Getting good at solving problems, like with many other things, is a process so it can take a long time before results are made. But with persistence and an open mind, you’ll always get something out of it in the end.

Links

Github: https://github.com/dgramaciotti

Linkedin: https://www.linkedin.com/in/daniel-guedes-79a05a176/

Medium: https://medium.com/@dgramaciotti

Have you liked this article? Give it a like and share it on social media!

If you got any observations/tips feel free to share them in the comments!

--

--

Daniel Guedes
Arionkoder Engineering

Software developer for around 4 years. Musician on the spare time