
COMPOSITION AND INHERITANCE MODEL COMPARISON
Author(s) -
Aleksejs Sergejevs,
Sergejs Kodors
Publication year - 2019
Publication title -
cilvēks. vide. tehnoloģijas
Language(s) - English
Resource type - Journals
ISSN - 2592-8597
DOI - 10.17770/het2019.23.4394
Subject(s) - inheritance (genetic algorithm) , structuring , computer science , composition (language) , software , programming language , code (set theory) , software engineering , business , gene , biochemistry , chemistry , linguistics , philosophy , set (abstract data type) , finance
The inheritance seems to be the natural and the default solution of structuring the logic of software nowadays. But is it always the best option? Considering the increasing need for programming and the speed at which the projects are made, it’s inevitable that the requirements of a project will be changing many times and a lot of fundamental building blocks in the software will have to be redeveloped. The problem with inheritance is that with a change in functionality it may become necessary to rewrite huge amounts of old code or even end up duplicating existing functionality which only makes things worse in a long run. An excellent solution that can be used to avoid essentially getting stuck in situations like these is composition. The goal of the study is to analyze the pros and cons of composition and inheritance and make a conclusion about their correct usage.