4

Possible Duplicate:
How can I improve my problem-solving ability?

When starting a programming task, I have trouble breaking it up into steps and figuring out how to go about solving it.

I want to get better at it. Should I to focus on data structures/algorithms? Or should I be studying more design patterns?

What do you think would help in thinking more logically and being able to break things into steps?

Crystal
  • 149

4 Answers4

7

i have trouble seeing the logic in code sometimes

This is common, don't worry about it. Understanding code that you're not familiar with is much like trying to understand how someone else thinks. Usually getting a walkthrough of that entire portion (not the entire system as it may make your head explode if the entire system is big enough) of the system architecture helps a great deal. Once you understand the overarching solution, the logic in the specific code chunks can start to make quite a bit more sense.

It sounds to me like you need practice at system architecture. The next time you're tackling a problem, forget about the code. First, fully understand the problem that you're dealing with. Of course, if you don't fully understand a given problem, engineering a solution will be difficult at best. Next, take a look to see if there's an implementation for that problem readily available (OS), or if there's a design pattern that can be applied to it (Wikipedia has a decent list). If not, then start desiging a solution (still not even thinking about the code - all of this should be abstract design).

Once your design is done, then start coding.

Of course, studying design patterns and algorithms (and algorithm design/analysis) will most definitely help you in your conquest here, but practice really is just as important (whether you actually implement your designs or not is beside the point).

Doing this enough times will help spur that abstract problem solving thinking that you seem to be having issues with.

And don't ever forget: No matter how good you think you get at this, there will always be someone (or a number of someones) who are quicker/better/brighter than you. Use them to help you get better - don't let their abilities frustrate you.

Demian Brecht
  • 17,585
5

I think its quite simple: code more!

Your problem sounds exactly what i had when i started programming. And the only way to go around it was to just code more, more and more! Only then you can have the real grasp on it.

Just start small, dont go on big projects first.

kaino
  • 69
1

I'm currently taking a course called "Algorithms Analysis". This class is ALL about breaking problems up into steps and solving them (with an emphasis on optimization).

You should study algorithms. After studying an algorithm, close your eyes and try to recreate the entire algorithm on your own. It's important to understand each step at a higher level than just memorization so you can apply it to different examples. With practice, you will get quicker.

Casey Patton
  • 5,241
0

Chances are somebody has already met a similar functionnal problem and explained it on the web. If you don't know where to start, asking on the web is a valid solution.

Better than writing crap code anyway.

What language do you use? algorythms is more about knowing your API.

But you are right, learning design patterns indeed will make you a better programmer, so few people know them in the industry.

xsace
  • 695