07-31-08 - 3

There're a lot of great coders out there who just insist on continuing to reinvent the wheel all the time. I'm certainly still somewhat guilty of that sin myself, but I think at least I'm aware of it. It frustrates me every time I have to interact with their code, and I just think it's a mistake.

Using existing libraries is just so inherently superior on many levels, that you need to have a really really good reason to not go with an existing standardized solution.

For existing libraries I'm talking about things like the C stdlib, the STL, and also open source libraries that are stable and old and very well tested such as Boost etc.

These things have a very low chance of bugs, the performance is generally okay, and the features are usually pretty complete. But what's more important is that the performance characteristics are well known, the feature set is the standard one so that you know you have the same features as everyone else, you can adopt improvements to the standard, other people's code fragments are interoperable with yours, etc.

Most importantly, they're familiar to lots of users. Familiarity has *huge* value. You may not like the way std::map works, but lots of people are familiar with its quirks, so you really should not make a better replacement. Familiarity lets me write code without reading through all your documentation, and your documentation usually sucks so I actually have to go and read your code and I waste a ton of time. If your code uses standard stuff and is written with the standard styles, anyone can read and instantly know what's going on without digging all over to figure out your system.

In fact, familiarity is so valuable that new interfaces that you make should be designed to mimic standard ones that people are familiar with. That means any container should be made to look and act just like an STL container. Simple string routines should mimic the conventions of the stdlib string functions. Doing it a "better" way is really much worse.

No comments:

old rants