19

I feel it's important to continue practicing my problem-solving skills. Writing my own mini-projects is one way, but another is to try and solve problems posted online. It's easy to find interesting programming quizzes online that require applying clever algorithms to solve - Project Euler is one well-known example.

However, in a lot of real-life projects the design of the software - especially in the initial phases - has a large impact and at later stages it cannot be tweaked as easily as plain algorithms. In order to improve these skills, I'm looking for any collection of design problems.

When I say "design", I mean the abstract design of a software solution - for example what modules will there be and what are the dependencies between them, how data will flow in the program, what sort of data needs to be saved in the database, etc. Design problems are those problems that are critical to solve in the early stages of any project, but their solution is a whiteboard diagram without a single line of code.

Of course these sort of problems do not have a single correct solution, but I'll be especially happy with any place that also displays pros and cons of the typical solutions that might be used to approach the problem.

1

4 Answers 4

7

How about Code Kata. I've done a few of these, and they're fun to do, and challenging enough that there's always something to learn.

The comments for each of the kata typically have enough information to help answer anything you get stuck on.

1
  • The first is certainly a design problem, but I had a feeling the others are all far more code-oriented. I'll give it another look, thanks!
    – Oak
    Dec 18, 2010 at 16:35
4

Start with the classic design problem: KWIC.

David Parnas used KWIC as an example in his classic paper on modularity: On the Criteria To Be Used in Decomposing Systems into Modules, which everyone should probably read every 10 years.

KWIC, for key-word in context, is a simple indexing and sorting problem where you read in lines of text, and then rotate each line based on keywords (e.g., excluding "the", "with"), adding each shift to a list you then sort. The idea is that using KWIC would be useful for generating an index for a book. At the time of his classic paper, Parnas said that an experienced programmer could solve it in one to two weeks, but Yannis's Law states that it can now be done in one to two hours. [Operating systems and standard libraries have gotten much better.]

Read through Parnas's paper, and as soon as you can grok what the KWIC program is supposed to do, go and write your own as a design exercise. Then, read the rest of the paper, which discusses two different designs: Both are modular, but one achieves information hiding while the other does not.

After knowing the KWIC example, you'll be able to appreciate other software design papers that use it. For example, Michael VanHilst's paper Decoupling Change from Design uses it to show a really interesting design technique using C++ templates. And, so long as we are talking about C++ templates and design, read Czarnecki and Eisenecker's Synthesizing Objects paper.

Moving on from KWIC are other classic examples, such as the Spacewar example, which has been ported/redesigned in several languages, such as Python and AspectJ.

Of course, any program can be used as a design exercise, but KWIC and Spacewar are examples where you can look at several alternatives.

1
  • Re: Your clarification... I am talking mostly about the white-board level of design here. But it is worthwhile to dig down to the code level too, as you can realize many of your design solutions have flaws that make them much harder to express.
    – Macneil
    Dec 17, 2010 at 15:22
1

I've heard this sort of thing referred to as "programming katas." Kata is a martial arts term for a form or sequence of movements that is practiced over and over again to perfection. Do some searching for katas in your language of choice and I'll bet you'll turn up something. :)

1

I agree Katas and Euler are nice for designing algorithms and practicing coding -- perhaps you can expand on them, and be a little creative and design a system around one of the problems.

For instance, I am working on not just solving the problems of Euler to find the quickest, shortest answer, but solving them in a distributed way -- I want to set up a series of Erlang nodes in order to tackle one of the problems. Of course, this means I have to figure out how to separate out the problem into discrete chunks and have them report back on their progress and aggregate the results together (all within a Functional Language that I'm not an expert in).

Perhaps you can design a system around solving one of these problems as a business solution -- how can you make it so that multiple "customers" could have access to your problem at one time, you can go through designing a client and service layer interactions, etc.

It's all about being creative and having fun.

Not the answer you're looking for? Browse other questions tagged or ask your own question.