DEV Community

Discussion on: Think Like a Programmer??

javascripterika profile image

I love this question, because so often do we read it, but don't necessarily reflect on it!

To me - it's thinking logically and in steps with no assumptions made! I am problem-solving at its finest. And, like anything - it is a skill to practice and reiterate on. So usually I like to break down problems or functionality into small manageable steps.

I want A to do B. I get the logic down (or at least try to in pseudocode whether that be mentally or in the form of comments in my editor <-- a much better approach) and then implement it in code.

I really don't worry about my first draft of code being polished, I allow it to be messy. Then, once I get working functionality I go back and comb through it, rinse and repeat.

For me, that above are the foundations of thinking like a programmer.

The next steps are efficiency!

How can I write my code that is explicit and easy to follow?

One thing I absolutely love is - finding new ways to implement code or a solution in a different way. Sometimes I'll come across an article and get so excited when I find practical bits that are relevant to what I am working on and I can implement it in. It feels like a treasure when you can find and see something in a different way! I LOVE that and cherish those moments!

Aside from development in particular, I find myself solving problems in every day life logically. Why carry my groceries the same route, when I can take this different path and get to the kitchen quicker?

emptyother profile image

Agree. "The code works, but there must be a simpler/more manageable way to do this." Cue a day researching patterns and badly documented libraries just to MAYBE reduce my 60 lines of code down to 5 lines.

When it works, it's the best feeling in the world. When it doesn't, I always learn something i can use somewhere else.

cat profile image
Cat Author

This is actually the most succinct answer I've got here since you broke down into detail what you do by step.

I find myself solving problems in every day life logically.

Right??? I also think about the grocery problem especially if I buy party-sized things and it's raining outside: 5x 2 liter soda bottles, 5x bags of chips -- how can I carry it all into the house, while running back and forth in the rain the least amount of times?