Java Interview Guide: How to Build Confidence With a Solid Understanding of Core Java Principles pdfdrive com



Yüklə 0,53 Mb.
Pdf görüntüsü
səhifə32/47
tarix06.05.2023
ölçüsü0,53 Mb.
#108601
1   ...   28   29   30   31   32   33   34   35   ...   47
Java Interview Guide

Behavioral Design Patterns
Behavioral design patterns solve common problems that arise due to the
interaction of different objects.


Command Pattern
The command pattern encapsulates all of the information needed to execute
an action. This is useful for operations that need to be invoked outside of the
context in which they were created. The Runnable interface is an example
of the command pattern.


Observer Pattern
The observer pattern notifies a collection of observers about state changes
to a subject of interest. This is useful for decoupling a subject from the concerns
of its followers. The Observer class and Observable interface are
examples of the observer pattern.


Strategy Pattern
The strategy pattern dynamically chooses the behavior of an algorithm
at runtime. This is useful for operations that have a variety of custom
implementations. The Collections#sort(List, Comparator)
method is an example of the strategy pattern.


Visitor Pattern
The visitor pattern separates an algorithm from the object structure on which
it operates. This is useful when different algorithms need to traverse a similar
path through a complex object. The ElementVisitor interface is an example
of the visitor pattern.


Null Object Pattern
The null object pattern represents an object with neutral or empty behavior.
This is useful to prevent excessive null checks in an application.
The Collections#emptyList() method is an example of the null
object pattern.



Yüklə 0,53 Mb.

Dostları ilə paylaş:
1   ...   28   29   30   31   32   33   34   35   ...   47




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin