Sometimes I come across comments about inheritance that are “out of style” in the corporate application architecture, but I did not find a link to an article describing a competing theory. Also, is there a difference in implementation if the application is already built as opposed to starting from scratch? I believe that this may be due to a greater load on the interfaces, but I'm not sure.
I think you are referring to the Design Principle:
"Approve composition over Inheritance."
( ) .
,
public class B extends A implements I { // now I have all the methods from A }
public class B implements I { private I a; // delegate all methods public void methodOne(){ a.methodOne(); } }
, :
, - , , :
Phillips , Flatheads.
, , , , .
- "is-a" vs. "has-a" - , ( ), . , .
, . : " , ", " - ", ? ?
- . , - , ; -)
[ !]
, . : .
: , , , , , . - , , .
Smalltalk Perl. . .
, . 2003 , - . , 2009 !
++, mixins ( : , mixins):
Wikipedia: http://en.wikipedia.org/wiki/Mixin Dr. Dobbs: http://www.ddj.com/cpp/184404445.
" " (CRTP):
Wikipedia: http://en.wikipedia.org/wiki/Curiously_Recurring_Template_Pattern.
CRTP mixins, .
"" ( ), , mixins . , , , .
, CRTP , ( ) , . , .
... , ++, . mixin .
mixins , . , , . , " " , , "", .
Source: https://habr.com/ru/post/1711536/More articles:Creating CroppedBitmap at runtime - not loading from resource - exceptionWhy are iPhone apps so slow? - performanceGet version of Windows service pack from Java applet? - javaANSI UNIX_TIMESTAMP () standard - sqlThe correct way to configure SSL in .NET. - c #How to check if WS_VISIBLE is set in the window? (or if it is visible) - c ++Does cdb / windbg have the equivalent of autoexp.dat? - c ++What is half-corutin? - ruby | fooobar.comWhat syntax to use boost :: pool_allocator with boost :: unordered_map? - c ++Как я могу оценить ограничение загрузки с помощью TcpClient? - c#All Articles