🗊 Презентация Prefer interfaces to abstract classes. (Item 18, 19)

Нажмите для полного просмотра!
Prefer interfaces to abstract classes. (Item 18, 19), слайд №1 Prefer interfaces to abstract classes. (Item 18, 19), слайд №2 Prefer interfaces to abstract classes. (Item 18, 19), слайд №3 Prefer interfaces to abstract classes. (Item 18, 19), слайд №4 Prefer interfaces to abstract classes. (Item 18, 19), слайд №5 Prefer interfaces to abstract classes. (Item 18, 19), слайд №6 Prefer interfaces to abstract classes. (Item 18, 19), слайд №7 Prefer interfaces to abstract classes. (Item 18, 19), слайд №8

Вы можете ознакомиться и скачать презентацию на тему Prefer interfaces to abstract classes. (Item 18, 19). Доклад-сообщение содержит 8 слайдов. Презентации для любого класса можно скачать бесплатно. Если материал и наш сайт презентаций Mypresentation Вам понравились – поделитесь им с друзьями с помощью социальных кнопок и добавьте в закладки в своем браузере.

Слайды и текст этой презентации


Слайд 1


Item 18: Prefer interfaces to abstract classes
Описание слайда:
Item 18: Prefer interfaces to abstract classes

Слайд 2


Existing classes can be easily redesigned to implement a new interface Steps to add a new interface for several classes: add an “implements...
Описание слайда:
Existing classes can be easily redesigned to implement a new interface Steps to add a new interface for several classes: add an “implements interfaceName” in each class add the required methods for each class What about abstract classes? Two classes should extend the same abstract class –> Place the abstract class high up in the type hierarchy after an ancestor of both classes –> Great damage to the type hierarchy.

Слайд 3


Interfaces are ideal for defining mixins. Mixins provides some additional behavior (For example Comparable) Class can implement several mixins as...
Описание слайда:
Interfaces are ideal for defining mixins. Mixins provides some additional behavior (For example Comparable) Class can implement several mixins as interfaces Class can have only one superclass – there is no place in hierarchy for mixins as abstract classes

Слайд 4


Interfaces allow the construction of nonhierarchical types interface Singer + interface Songwriter = interface SingerSongwriter extends Singer,...
Описание слайда:
Interfaces allow the construction of nonhierarchical types interface Singer + interface Songwriter = interface SingerSongwriter extends Singer, Songwriter The alternative is a bloated class hierarchy containing a separate class for every supported combination of attributes (2n possible combinations).

Слайд 5


Interfaces enable safe and powerful increasing of functionality + Using an interface – enable to use composition - Using an abstract class – no...
Описание слайда:
Interfaces enable safe and powerful increasing of functionality + Using an interface – enable to use composition - Using an abstract class – no alternative but to use inheritance

Слайд 6


Abstract skeletal implementation class Combination: Skeletal implementation = Interface + Abstract class Skeletal implementations are called...
Описание слайда:
Abstract skeletal implementation class Combination: Skeletal implementation = Interface + Abstract class Skeletal implementations are called AbstractInterface (AbstractCollection, AbstractSet, AbstractList, AbstractMap) Simulated multiple inheritance Simple implementation

Слайд 7


Advantage of abstract classes: It is far easier to evolve an abstract class than an interface + All existing implementations of the abstract class...
Описание слайда:
Advantage of abstract classes: It is far easier to evolve an abstract class than an interface + All existing implementations of the abstract class will then provide the new method - Once an interface is released and implemented, it is almost impossible to change

Слайд 8


Item 19: Use interfaces only to define types Don’t use constant interfaces, it’s antipattern. Use utility classes for constants and static import....
Описание слайда:
Item 19: Use interfaces only to define types Don’t use constant interfaces, it’s antipattern. Use utility classes for constants and static import. Constant interfaces in the Java platform libraries, such as java.io.ObjectStreamConstants - should be regarded as anomalies



Похожие презентации
Mypresentation.ru
Загрузить презентацию