30

I am always looking for ways to improve my programming skills, and one of the most important of those is problems solving.

This question addresses some techniques people use for problem solving, but not as much how they aquires the skill and improve on it.

One answer Links to several books on the subject, which for me is one of the steps in getting there.

What other books and techniques can you recommend for improving problem solving skills?

27 accepted

While I firmly believe in using books for just about anything, I believe this is a situation where you need to acquire as much experience as possible. You get better at solving problems by trying to do so, and you often learn your best by doing your worst.

That being said, here are a few things that I consider when trying to solve a problem:

  1. The answer has likely been published by someone else. Solving a problem is about finding a solution. Being able to find one faster than you can develop one is often just what the doctor ordered. But don't worry about not learning anything—often, implementing the solution you find will be very instructive and filled with "why didn't I think of that" moments.

  2. You don't have to figure it out in one sitting. The mind, like the body, benefits from a measure of rest. Just as a weightlifter who works his arms every day instead of every other may find himself lingering in the same ability, so too will a thinker often find himself running in place if he doesn't take a break from the strain and give the brain a chance to breathe. My best solutions always come when I'm not sitting in front of the problem (this applies to more than just programming, by the way).

  3. Do not be afraid to (in other words expect to) fail. Even if it's just failure by your standards (a solution that you quickly find could be better), doing a poor job and recognizing it gives you a platform for your next problem. You can see what you've done wrong and what could be done better. These failures are a valuable step in the process, and I think you'll find that you're going to screw up something in a solution for the rest of your life. That's ok—you'll do that thing better next time.

13
  • Programming/Math practice: http://projecteuler.net/
  • Puzzles are all over the place, but I love http://perplexcity.com/, though you have to buy the cards.
  • Search around for "engineering interview questions" and start tackling them.
  • FIND A PERSONAL PROJECT. Write a game, website, library, anything. The best way to get better at this stuff is to make it your passion. You won't be able to engineer your brain to want to be an engineer.
12

I think it would be a mistake to restrict the "logical and analytical thinking skills" that make "an awesome programmer" to logical puzzles and math problems. Sure math and logical skills are important, but analytical thinking and great programming entails much more than that. Great programmers are creative people with an insatiable curiosity. Creativity and curiosity are cultivated when programming is contextualized in a historical and philosophical framework.

Here are my suggestions on how to do this:

  1. Read Hofstadter's Godel Escher Bach. The book gives a great sense of the philosophical questions and meta-questions that are fundamental to the fields of computer science, information technology and programming. Hofstadter also does a great job of bringing concepts to life with examples from literature, music and art.

  2. Get a sense of the history of information technology. This is important to understand the significance of the generation that we are working in today and to anticipate the future of the field. Read up on Moore's law and its many corollaries. How can this exponential growth be explained? Why is it that the field of information technology has been blessed with exponential growth whereas other technological fields such as husbandry have not? Once you've explained the exponential growth, how long will this growth carry on for? What will the near future look like if these trends continue?

  3. Understand design patterns. Don't just be able to do object oriented programming but make sure you understand its methodological and historical importance as a breakthrough programming methodology. Make sure you can appreciate the elegance of the different design patterns. Try to invent your own design pattern. Determine on your own what types of projects would be best suited for a given design pattern.

  4. Why is parallel processing such an important breakthrough in computer science? What will the next breakthrough be?

  5. Try to tackle the biggest and best algorithmic problems in computing today. Start designing your very own natural language programming language or a machine that can pass the turing test.

  6. Master the art of outlining and detailing software development projects. Invent new and betters ways to do this.

  7. Understand why the waterfall method of software development fails so often and why agile methods are a major improvement. Invent your own programming methodology.

  8. Understand the P versus NP problem of computer science (a millennium problem) to the best of your ability. Whenever you have spare second in an elevator or before you go to sleep at night you should be working on that problem trying solving it. Is it or is it not theoretically possible to solve the seemingly endless amount of important NP-hard problems out there? Can the human mind solve these problems? What is the computational analog for human creativity and intellectual insight?

  9. Make new questions to think about and add them to this list.

6

I'll kind of repeat what the other guys have said.. Just keep solving problems.

In terms of programming I tend to look at as many real world things as possible and think about how I would model that as an application. What patterns would I use? What problems would I face? Why? How would I fix them?

For example, look at the keyboard you are typing on. How would you model that as an business object? Would you create a Key class? What function would it perform? How would it communicate with other parts of the keybaord? What about the caps/num/scroll lock lights? Key groupings? Does it have extra bits? An LCD screen? A pointing device? How does it interface with the computer? How would all of it go together?

Even though we all know the general answer, I guarantee we would all come up with completely different code, each with different pro's and con's :)

Just keep repeating the problem solving process, always remember, we are the odd ones out where Quantity Always Trumps Quality

3
  • Creating multiple solutions to problems. Coming up with a second method to solve something you've already done might prompt you to have to think differently about the problem.
  • Answering 'hard' problems (i.e. outside your normal comfort zone) - and you're in the right place for that by being here.
  • Reading other people's solutions, not just code reviews, although that's definitely a part.
2

In the dev team that I am program manager for we have started a trend of bringing these mechanical puzzles to work. It's all about thinking about your brain as a muscle and make sure it gets challanged on a daily basis.

Oh, let me also give away my greatest secret to learning programming languages and techiques fast:

  1. Study the basics of the topic
  2. Find an irc channel for your topic
  3. Help the people that are just a step behind you

Teaching others is the single best strategy for learning that I know. It's all about

What you can explain, you understand.

This strategy works equally well with your issue as using the help others "technique" you will encounter puzzles you wouldnt think of yourself, and the more of these you solve, the better you will be equipped when a though nut lands on your own desk.

Happy baking.

2

Here's a book recommendation from Charles Simonyi :

"SIMONYI: There are a lot of formulas for making a good candidate into a good programmer. We hire talented people. I don't know how they got their talent and I don't care. But they are talented. From then on, there is a hell of a lot the environment can do.

Programmers get a couple of books on their first day here. One of them, called How to Solve It, is by George Polya, the mathematician. [Simonyi takes the book from a bookcase next to his desk and opens it to a certain page.] These two pages are important. The rest of the book just elaborates on these two pages. This is like a checklist for problem solving. This is the preflight, the takeoff, and the landing checklist. It doesn't mean this will tell you how to fly, but it does mean if you don't do this, then you can crash even if you already know how to fly.

We follow these four steps of problem solving: first, understanding the problem, then devising a plan, carrying out the plan, and, finally, looking back. We have about four books like this and I think we make the programmers better than when they arrive "

Source : http://programmersatwork.wordpress.com/programmers-at-work-charles-simonyi/

1

Depends what type of problems. There are analytical problems and there are managerial problems. One requires more logic while the other requires good HR skills and understanding of human nature.

1

The best way to improve is to practice!

Subscribe to the RSS feed at: http://www.mensa.org.uk/puzzles/ and take time to complete them as they come out.

A puzzle-a-day desk calendar (e.g. http://www.calendars.com/product.asp?PID=1&MGID=-1&IID=46387&cm_mmc=Affiliate_Program--performics--k137666-_-DDI%20Link) is a good idea too as it will give you regular, bite-sized, and varied problems to solve.

While these will invariably be off topic from the problems you will find yourself facing, the variety is important as it will force you think in ways you haven't before, which is really what problem solving is all about.

Edit: Also check: http://www.mindtools.com/pages/main/newMN_TMC.htm for good problem solving tips.

1

More than practice I think the key is deliberate practice ...

1

Although it's true that solving more problems will help, as almost everyone else has mentioned, you also have to solve problems in different ways. You need diversity to develop new techniques. Learning very different programming languages can help with that. Different language families approach problems differently. Find languages that are unlike the ones you already know and try them for awhile.

0

Practice. Try to get involved in as many different projects with variation in type. Unfortunately at work we often get limited to the type of project we're allocated to, and can rarely chose what project to work on.

This is why it can be a real bonus to get involved in an open-source project that poses the types of challenges you'd like to face and overcome. Sure, books can help to a degree, but I think doing is the best way of improving. This goes for any skills, problem-solving or otherwise.

Good luck!

EDIT: Oh, you could also try the New Turing Omnibus, which is great fun to pick up once every so often.

0

I find that when attempting to solve a problem a solution is found but I am not comfortable with it. I put it to the back of my mind and get on with something else and the brain continues to work on it. I know I have the correct solution when it 'feels simple'. If a solution feels simple I probably have the best solution given the data I have at my disposal at the time.

The key as others have mentioned is keep doing it. Also never jump at the first solution.

0

I've often found pair programming to be useful. Usually the other person will have a totally different approach to solving the problem than I have and their approach may give me ideas for other problems or at the very least give me food for thought.

0

Think simply, simple=better (most of the time)

If you can't get something to work simply walk away from the code and come back in an hour or two. Most of the time when I do that I can find the error within a minute when if I didn't walk away it would take at least 10 if not more minutes.

0

Practice Practice Practice..

But you should also be aware of steps followed by most people to solve any given problem: So here is my recommendation... i'm still reading these books...

alt text

alt text