DEV Community

loading...
Cover image for How to solve complex problems

How to solve complex problems

anja profile image Anja ・1 min read

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! 😊

Discussion

pic
Editor guide
Collapse
vuong profile image
ѵµσɳɠ 😈

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 Author

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 Author

That's a great idea, pen&paper helps too. 😊

Collapse
levirs565 profile image
Collapse
anja profile image
Anja Author

You are welcome 😊

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 Author

You are welcome and I agree with you! 😊