Why 90% solutions may beat 100% solutions

by John on November 7, 2008

I’ve never written a line of Ruby, but I find Ruby on Rails fascinating. From all reports, the Rails framework lets you develop a web site much faster than you could using other tools, provided you can live with its limitations. Rails emphasizes consistency and simplicity, deliberately leaving out support for some contingencies.

I listed to an interview last night with Ruby developer Glenn Vanderburg. Here’s an excerpt that I found insightful.

In the Java world, the APIs and libraries … tend to be extremely thorough in trying to solve the entire problem that they are addressing and [are] somewhat complicated and difficult to use. Rails, in particular, takes exactly the opposite philosophy … Rails tries to solve the 90% of the problem that everybody has and that can be solved with 10% of the code. And it punts on that last 10%. And I think that’s the right decision, because the most complicated, odd, corner cases of these problems tend to be the things that can be solved by the team in a specific and rather simple way for one application. But if you try to solve them in a completely general way that everybody can use, it leads to these really complicated APIs and complicated underpinnings as well.

The point is not to pick on Java. I believe similar remarks apply to Microsoft’s libraries, or the libraries of any organization under pressure to be all things to all people. The Ruby on Rails community is a small, voluntary association that can turn away people who don’t like their way of doing things.

At first it sounds unprofessional to develop a software library does anything less than a thorough solution to the problem it addresses. And in some contexts that is true, though every library has to leave something out. But in other contexts, it makes sense to leave out the edge cases that users can easily handle in their particular context. What is an edge case to a library developer may be bread and butter to a particular set of users. (Of course the library provider should document explicitly just what part of the problem their code does and does not solve.)

Suppose that for some problem you really can write the code that is sufficient for 90% of the user base with 10% of the effort of solving the entire problem. That means a full solution is 10 times more expensive to build than a 90% solution.

Now think about quality. The full solution will have far more bugs. For starters, the extra code required for the full solution will have a higher density of bugs because it deals with trickier problems. Furthermore, it will have far fewer users per line of code — only 10% of the community cares about it in the first place, and of that 10%, they all care about different portions. With fewer users per line of code, this extra code will have more unreported bugs. And when users do report bugs in this code, the bugs will be a lower priority to fix because they impact fewer people.

So in this hypothetical example, the full solution costs an order of magnitude more to develop and has maybe two orders of magnitude more bugs.

{ 2 comments… read them below or add one }

1

Kevin McCarty 11.07.08 at 15:13

“At first it sounds unprofessional to develop a software library does anything less than a thorough solution to the problem it addresses”

The iconic counterexamples include:

* C
* Unix
* the Internet

They are all incomplete, but they worked well enough that, in their time, adoption was almost universal, because they were so darn powerful in spite of their shortcomings.

2

Derek Ditch 03.17.09 at 07:21

Really, the same design philosophy should apply to the design all libraries in any language, except those designed for a particular project. There is no way that my library X is going to do everything that you want to do in your project. The idea is to abstract out the stuff that is useful in more than one project and set an API for that. The advantage to languages like Ruby (and Python, which I prefer) is that you can change the API at runtime to be what you need. When using these dynamic languages, it is useful to have more elaborate libraries which can be easily molded into what you need.

I think the trap that library designers fall into is feature creep. They try to solve all of the world’s problems in one package. Be more like UNIX tools. Small tools for specific tasks. Glue them together and you have a larger project solution.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>