DEV Community

Sotiris Kourouklis
Sotiris Kourouklis

Posted on

The 4 step problem solving process.

Here are the steps to approach a problem when programming and how to solve it.You need to code slowly, yet effectively with no mistakes. This is the 4 step process:

Think of the problem (Have your ever solved anything familiar, do you see for the first time the problem ?)

Read documentation on things you think you don’t know.

Design on a piece of paper your though process

Start coding , slowly.

Why you should take this approach ?

Remember it is better to spent 30 minutes thinking and reading docs and 1 hour coding, rather than spent 0 minutes thinking and 45 minutes of coding. That’s why if you take the second approach, you will end up refactoring for another 2 hours afterwards. That is not even the wurst part. If another developer tries to approach the same project one month later he will understand nothing due to lack clean and readable code.

The only time you may not need to take this approach is when you’ve done in the past the same thing and you know exactly what to do or you have years of experience.

Here’s an example.

My manager told me to create a registration page that the user needs to provide his information to register.

What are the things I need to create this page ?

  • I need a form to capture the user data( email, username, password )

  • I need to save the data in an object and send them to the API( localhost:2233/user/register )

  • I need to validate the two passwords and see if they are the same if not through an error

  • I need to capture the error from the form to see if the password is wrong or the email does not exist.

  • If the password is correct redirect the user to dashboard and save the session id.

  • I need to create loading states for better UX

As you can see I break the process in small parts in chronological order. If needed I can design on paper small wire-frames of what I want.

wireframing

Thanks for reading the article,
hope you have a nice day!

Check me out on:
Linkedin
Github

Top comments (0)