Let Go, Standard Library From Community
David B. Held
dheld at codelogicconsulting.com
Thu Apr 19 20:12:14 PDT 2007
Sean Kelly wrote:
> [...]
> Some points of analysis worth considering are average lines of code,
> number of parameters, cyclometric complexity, etc. One can't infer much
> from the simple presence of templates or a class hierarchy. Heck, the
> presence of templates can suggest more robust code than average, because
> they tend to prevent code duplication and force a focus on algorithm
> design rather than type-specific optimizations (which can be a source of
> bugs). Similar things could be said for classes.
> [...]
Personally, I find that libraries that *don't* use templates are
primitive, because they probably aren't very configurable. You're stuck
with what the library designer chose for you. I think in the future,
this is just going to become more and more pronounced. All of the most
interesting libraries I can think of are extremely generic. I would be
interested to hear about counter-examples.
As far as re-inventing wheels vs. code re-use, I think it is
instructional to look at other engineering disciplines. Which engineers
are praised for designing custom bolts and I-beams and steel pipes and
wires? The ones who get the recognition are the ones who take commodity
items for granted, who choose the best available, and focus on the
things that matter, which are the high-level problems. That is, the
best engineers are the ones that can abstract away the trivialities and
introduce something compelling and new using off-the-shelf parts.
Given that architect-level engineers usually need a decent variety of
parts to choose from, I think it makes perfect sense that one would have
alternatives in libraries. There is also the aspect of healthy
competition and alternative tastes. Obviously, Phobos appeals to
C-philes like Dan, while Tango appeals to Java-philes like...well, like
all the Java-philes out there. ;) I think making them interchangable is
the most worthwhile course of action.
Rewriting basic libraries is a good exercise for the learning
programmer. I reinvented plenty of good wheels in my day, and had a lot
of fun doing it. But when you get old and tired, you lose the zeal for
wheel-making, and you start to build cars, using parts that other people
made.
Dave
More information about the Digitalmars-d
mailing list