🗊 Презентация Prefer class hierarchies to tagged classes. (Item 20, 21, 22)

Нажмите для полного просмотра!
Prefer class hierarchies to tagged classes. (Item 20, 21, 22), слайд №1 Prefer class hierarchies to tagged classes. (Item 20, 21, 22), слайд №2 Prefer class hierarchies to tagged classes. (Item 20, 21, 22), слайд №3 Prefer class hierarchies to tagged classes. (Item 20, 21, 22), слайд №4 Prefer class hierarchies to tagged classes. (Item 20, 21, 22), слайд №5 Prefer class hierarchies to tagged classes. (Item 20, 21, 22), слайд №6 Prefer class hierarchies to tagged classes. (Item 20, 21, 22), слайд №7 Prefer class hierarchies to tagged classes. (Item 20, 21, 22), слайд №8 Prefer class hierarchies to tagged classes. (Item 20, 21, 22), слайд №9 Prefer class hierarchies to tagged classes. (Item 20, 21, 22), слайд №10 Prefer class hierarchies to tagged classes. (Item 20, 21, 22), слайд №11 Prefer class hierarchies to tagged classes. (Item 20, 21, 22), слайд №12 Prefer class hierarchies to tagged classes. (Item 20, 21, 22), слайд №13 Prefer class hierarchies to tagged classes. (Item 20, 21, 22), слайд №14

Вы можете ознакомиться и скачать презентацию на тему Prefer class hierarchies to tagged classes. (Item 20, 21, 22). Доклад-сообщение содержит 14 слайдов. Презентации для любого класса можно скачать бесплатно. Если материал и наш сайт презентаций Mypresentation Вам понравились – поделитесь им с друзьями с помощью социальных кнопок и добавьте в закладки в своем браузере.

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


Слайд 1


Item 20: Prefer class hierarchies to tagged classes
Описание слайда:
Item 20: Prefer class hierarchies to tagged classes

Слайд 2


Tagged class – instances come in two or more flavors; contain a tag field indicating the flavor of the instance
Описание слайда:
Tagged class – instances come in two or more flavors; contain a tag field indicating the flavor of the instance

Слайд 3


Prefer class hierarchies to tagged classes. (Item 20, 21, 22), слайд №3
Описание слайда:

Слайд 4


Tagged classes: Bad readability Spend to much memory (contain fields belonging to other flavors) Fields can’t be final (constructors don’t initialize...
Описание слайда:
Tagged classes: Bad readability Spend to much memory (contain fields belonging to other flavors) Fields can’t be final (constructors don’t initialize irrelevant fields) Constructors must set the tag field and initialize the right data fields – compiler can’t control this. Type doesn’t gives a clue to its flavor.

Слайд 5


A tagged class is just imitation of a class hierarchy
Описание слайда:
A tagged class is just imitation of a class hierarchy

Слайд 6


Prefer class hierarchies to tagged classes. (Item 20, 21, 22), слайд №6
Описание слайда:

Слайд 7


Item 21: Use function objects to represent strategies
Описание слайда:
Item 21: Use function objects to represent strategies

Слайд 8


Function object is – An instance of a class that exports exactly one method performing operations on other objects, passed explicitly to the method...
Описание слайда:
Function object is – An instance of a class that exports exactly one method performing operations on other objects, passed explicitly to the method Example: Comparator

Слайд 9


Concrete strategy Comparator is concrete strategy for comparison Typical concrete strategy classes are stateless: has no fields => all instances of...
Описание слайда:
Concrete strategy Comparator is concrete strategy for comparison Typical concrete strategy classes are stateless: has no fields => all instances of the class are functionally equivalent => should be a singleton

Слайд 10


Concrete strategy classes are often declared as anonymous classes Note that using an anonymous class will create a new instance each time the call is...
Описание слайда:
Concrete strategy classes are often declared as anonymous classes Note that using an anonymous class will create a new instance each time the call is executed

Слайд 11


Item 22: Favor static member classes over nonstatic
Описание слайда:
Item 22: Favor static member classes over nonstatic

Слайд 12


Nested classes
Описание слайда:
Nested classes

Слайд 13


If you declare a member class that does not require access to an enclosing instance – always put the static modifier in its declaration Nonstatic...
Описание слайда:
If you declare a member class that does not require access to an enclosing instance – always put the static modifier in its declaration Nonstatic static member class has reference to enclosing instance: it costs time and resources; it makes enclosing instance not available for garbage collection.

Слайд 14


Anonymous and local classes should be short – ten a fewer lines
Описание слайда:
Anonymous and local classes should be short – ten a fewer lines



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