1
Discussions générales / Don't use inheritance directly, use template instead !
« le: Août 15, 2014, 04:22:56 pm »
Hello,
The library seems to have a very nice interface.
But one thing can be improved in my opinion : not using inheritance directly, and using template instead ! I strongly encourage you to watch this *really* awsome speech to understand how it works :
"http://channel9.msdn.com/Events/GoingNative/2013/Inheritance-Is-The-Base-Class-of-Evil"
For instance, any client class my_class_t implementing a draw function could be feeded to window.draw() without the need to inherit from Drawable . But there are other very nice advantages (easier to factor code, some performance gain when virtual functions can just be templates, etc).
It is just an advice
Thank you !
The library seems to have a very nice interface.
But one thing can be improved in my opinion : not using inheritance directly, and using template instead ! I strongly encourage you to watch this *really* awsome speech to understand how it works :
"http://channel9.msdn.com/Events/GoingNative/2013/Inheritance-Is-The-Base-Class-of-Evil"
For instance, any client class my_class_t implementing a draw function could be feeded to window.draw() without the need to inherit from Drawable . But there are other very nice advantages (easier to factor code, some performance gain when virtual functions can just be templates, etc).
It is just an advice
Thank you !