pcg-cpp icon indicating copy to clipboard operation
pcg-cpp copied to clipboard

Prefer composition over inheritance.

Open o11c opened this issue 7 years ago • 2 comments

Inheritance is often a code smell. Composition is usually cleaner.

Porting the full code to a language without templates was painfully difficult.

The least concern was that sometimes the names from the template parameters is used, whereas sometimes the typedef/constant in the class was used. To avoid, consider prefixing all template parameters with a _.

The mixins were bad enough (especially since some have extra functions, like unoutput), but inside_out and extended were atrocious. The frequent reliance on mutable references didn't help either.

o11c avatar Oct 05 '17 03:10 o11c

Oh, and pointlessly-overloaded functions.

o11c avatar Oct 05 '17 03:10 o11c

Porting the full code to a language without templates was painfully difficult

@o11c Did you succeed? Linky?

0joshuaolson1 avatar May 08 '18 00:05 0joshuaolson1