How to think like a programmer

Hey guys,

I just want to know what is the most effective way of approaching a coding problem. I’ve been running through some exercises on the way to front-end dev certification and 2 of the most troubling exercises I’ve encountered are: 1) “Wherefore art thou” and 2) “Roman Numeral Converter”. I spent so much time on these 2 exercises (more than 2 days) and to be honest, I looked into the solutions for them in here to solve them. Granted, I understood the solutions, but I would probably have extremely failed if these were interview questions. For some of the previous problems, I relied on my google searching skills to help me with the solutions (not the answers directly, but how to solve the specific problem based on different ways - stack overflow).

So, to help me become a better programmer/developer, I’d like to ask the community how you’d break down a coding problem such as these 2. What are the steps and strategies you usually use to complete these problems efficiently? How long does it usually take you or what is the ideal time to solve these kinds of problems?

Thanks guys! I’d like to finish my front-end certification soon but I’d like to do it the right way.

1 Like

try these

What you’re talking about is exactly what computer science is. But, to be perfectly honest, there’s no quick solution for you (as far as I’ve found.) The way I think like a computer is just by doing a lot of programming. You can try to think about every component. For example:

Instead of saying:
I need to find the center of this rectangle

Try to say:
I need to find the width of the rectangle, divide that by two, and add that to the rectangle's X position.

Keep in mind that it takes a lot of work (and time) to do this. As I said before, this is the epitome of Computer Science (which ain’t easy).

Good luck!