DEV Community

Cover image for How to solve complex problems
Anja
Anja

Posted on

How to solve complex problems

How can you better solve complex coding problems? Here are a few tips:

  1. Work test-driven
    Write your tests first, and then your code. Like this you can immediately check if your code is doing what you want. Also this helps to have all your code covered with tests.

  2. Use the debugger
    The debugger is very powerful, as you can run and stop your code line by line and see which values your variables have at the corresponding line, for example.

  3. Write detailed pseudo-code
    With pseudo-code you write down in โ€œnormal languageโ€ what your code is supposed to do. Its important that you write very detailed and exact pseudo-code, so that its easy for you to fill in the actual code later.

  4. Use coverage tools
    There are different coverage tools available, which check which parts are covered by tests and to what degree. Like this its easy for you to fill in the gaps.

What are your tips for solving complex coding problems? Have a nice day! ๐Ÿ˜Š

Top comments (9)

Collapse
 
vuong profile image
Vuong

Nice post. I also try to understand the general context, then break down it to small things first. With the small things, I can get it done quicker and also can get supports from people easier if I can't do it individually.

Collapse
 
anja profile image
Anja

Hey, thank you! Yes it's a lot easier to handle pieces of the problem and solve these first possibly with someone else. ๐Ÿ‘๐Ÿ˜Š

Collapse
 
drm317 profile image
Daniel Marlow

I always like to think about the problem away from the keyboard first.

Collapse
 
anja profile image
Anja

That's a great idea, pen&paper helps too. ๐Ÿ˜Š

Collapse
 
levirs565 profile image
Levi Rizki Saputra

Thank you

Collapse
 
anja profile image
Anja

You are welcome ๐Ÿ˜Š

Collapse
 
swasdev4511 profile image
Swastik Upadhye

I used to write down the problem and try to break it into smaller sub tasks and then accomplish those and doin so it motivates myself to push one step ahead...๐Ÿ˜„

Collapse
 
legendprogrammer profile image
LegendProgrammer

Thank you , really nice post.
I would love to add a small tip: take breaks during debugging.

Collapse
 
anja profile image
Anja

You are welcome and I agree with you! ๐Ÿ˜Š