Early bird prices are coming to an end soon... ⏰ Grab your tickets before January 17

This article was published on December 8, 2022

Forget about algorithms and models — learn how to solve problems first

Aspiring developers and data scientists, listen up


Forget about algorithms and models — learn how to solve problems first

Almost weekly a friend or an acquaintance asks me, “I want to learn to code; which language should I start with?” More or less bi-weekly I get a DM on LinkedIn starting with, “My son should start programming; what is the best language for him?”

It’s not just people who’ve never coded before. Often I get these messages from people who have several years of coding experience under their belts.

I’m not saying this to complain.

I make half a living from prodding the pros and cons of different programming languages, frameworks, and AI models here on Medium. I profit greatly from people having such questions.

The 💜 of EU tech

The latest rumblings from the EU tech scene, a story from our wise ol' founder Boris, and some questionable AI art. It's free, every week, in your inbox. Sign up now!

The questions are quite intuitive. After all, everyone would like to work with the best possible tools and build their software skills as quickly as possible.

And when you observe that every developer seems to use a different technology stack, it makes perfect sense to wonder which one is the right one.

The thing is, it all depends on the problem at hand.

No technology on its own is good or bad; it just depends on what type of problem you want to solve. At the end of the day, programming is just that: problem solving by means of using a computer.

So, for people who want to start programming or enhance their skills in software development or data science, the question should not be, “What should I use, Python or Julia?” The question should be: “How can I solve software problems better?”

How to solve problems

For full disclosure, I’m not a computer scientist by trade. I’m a particle physicist who happens to use concepts from programming and data science because I deal with humungous amounts of data from particle colliders.

That being said, physicists are similarly sought-after as computer scientists. That’s not because of their knowledge about neutrinos or black holes; it’s because of their problem-solving capabilities.

Abraham Lincoln is quoted to have said, “Give me six hours to chop down a tree and I will spend the first four sharpening the axe.”

For programmers and data scientists, this means spending time understanding the problem and finding high-level solutions before starting to code. In the average coding interview, candidates are expected to spend less than half of their time actually writing code, and the rest of the time understanding the problem.

1. Understanding the problem

Don’t skip this step, ever!

Key to knowing whether you understand a problem is whether you can explain it to someone who isn’t familiar with it. Try to write it down in plain English or your mother tongue; draw a little diagram; or tell a friend about it. If your friend doesn’t understand what you’re talking about, you need to get back to the problem statement.

Key questions to ask are:

  • What is the input? What is the desired output?
    For example, the input could be an array of data, and the output might be a linear regression on the data.
  • Which assumptions are underlying the problem?
    For example, you might be assuming that there is (almost) no measurement error in your data.
  • What is making this problem complicated?
    For example, the data that you have might be incomplete or the dataset might be too small to draw clear conclusions.

2. Break the problem down

Every big problem consists of lots of smaller problems. Given our previous example with the linear regression, you might want to consider the following sub-problems:

  • Cleaning the data
  • Finding out which variables in the data are meaningful for the regression, and which ones can be safely neglected
  • Searching for the right tool to do the regression with (this is where the old question about programming languages and frameworks comes into play)
  • Evaluating your results and bug-checking

Breaking the problem down helps you make a proper plan for your work.

It’s also more motivating, because you’ll be achieving small but important milestones along the way. This is much more satisfying than sitting in front of a mountain of work and feeling like you’re not moving forward.

3. Start with an example

The devil is always in the details.

Instead of starting with the whole project, take a little piece of it. Try whether your plan works, or whether you have to adapt it because of unforeseeable difficulties.

This helps you get your head around the hard parts. Many problems sound simple, but when you start building them there is one roadblock after the other.

In our example, instead of using all relevant variables, one could perform a linear regression on a couple of variables first. This won’t give you any points for project completion; however, finding bugs in your scripts when you’re still dealing with a small amount of data can be life-saving.

When you’re throwing all your data at the machine, running it for hours, and then come back to realize that the script hung up midway, you’ll be very frustrated.

Trust me, this happens a lot!

Run small tests first, and make sure your solution works as you envisioned it.

4. Execute

This is the meaty part. Now you can build the solution for your large problem.

Throw all your data at the code. Run a fancy model. Do whatever you want.

Having completed the three prior steps, this should run through quite smoothly!

If there are errors, you might have to go back to steps 1–3 to see if you’ve understood everything already and haven’t overlooked any bugs.

5. Reflect

Just because you found one solution doesn’t mean you found the best solution. Don’t run off and call it a day; think about how you could optimize your solution and how you might be able to approach it differently.

You might want to exchange with your colleagues and ask them how they would solve the problem. Is their approach different from yours?

You could also try to identify the biggest bottlenecks in your solution, i.e. the parts that take the most time and resources to execute. How can you improve them?

Finally, reflect on how your solution might evolve in the future. Would new software frameworks or the use of AI make your solution better? How could your solution contribute to solving other, even more complex problems?

Famous last words

People, including myself, tend to obsess over different programming languages and the newest framework that might make everything 1000x more efficient.

It’s worth reminding yourself that this is less than half of what it takes to become an excellent programmer. The other half is problem solving.

You won’t acquire problem solving skills over night.

But if you apply these steps, ask the right questions, and do this often, you’re on the right path to taking your career from good to great.

This article was originally published on Medium. You can read it here.

Get the TNW newsletter

Get the most important tech news in your inbox each week.

Also tagged with