[TriLUG] OT: A C++ Templated Class Problem
clubjuggler at gmail.com
Mon Apr 17 14:10:45 EDT 2006
On 4/17/06, Wing D Lizard <wingedlizard at nc.rr.com> wrote:
> Templates are definately hard to debug ( most inline code is hard to debug,
> templates just make it harder). Using them isn't too hard, writing them
> is a b*tch.
Actually, I think that's mainly a compiler failing. There's no reason
templates should be hard to debug. Sadly, the one compiler I've
seen that gives good error messages for templated code is the
SGI c++ compiler. Gcc fails miserably on that. :-(
> My view on being a good programmer is to write code that an average
> person can understand. Most of the code any professional writes will
> be maintained by somebody else. If you are too clever, you are doing
> a poor job.
Lowest common denominator? I definitely cannot agree to that.
That just leads to mediocre code.
> Yes, good documentation is key, but...
> If the average programmer can keep 5+/-2 things in their head, and your
> code requires them to keep 15 things in their head, you are setting up
> a bad situation.
The solution to this is to make code sections small. Make them
do one thing and only one thing. That doesn't mean it can be
done in a clever manner.
> Many genius/cowboy programers have caused companies to fail.
Then their companies didn't exercise due diligence on their own
employees. Good coding practices can go a long way and you
don't have to beat programmers down and make them code in
a "lowest common denominator" manner. Let them be creative,
but make them do code reviews, document things correctly both
before and after the fact and make sure more than one person
understands the code.
clubjuggler at gmail dot com
(fieldless) In fess two roundels in pale, a billet fesswise and an
increscent, all sable.
More information about the TriLUG