22. Subject Observer - 1 Observer - 2 Observer - n “ When the subject’s state changes, the subject notifies all the observers about the event” notifies
33. Dictionary a person autorized to act for another OOP an Object autorized to act for another Eclipse “ IFile” is autorized to act for “ file system” Proxy
The common form of pattern we see is Inheritance and composition.
The common form of pattern we see is Inheritance and composition.
All the objects communicate with each other using composition. And we define the structure of objects using inheritance. These two mechanisms are used to created loosely coupled systems. So that the changes in one area of the software will not propagate to the other areas.
How to structure your objects to get the best yield out of it.
Question – How manyof you believe that I will be able to cover all these patterns in next 40 mins? (4 mins for each pattern).
The singleton pattern ensures that a class has only one instance and provides a global point of access to it.
Code Walkthrough Singleton pattern ensures only one instance of a class exists. One global point of access. Prevent creation of multiple instances.
Code Walkthrough Singleton pattern ensures only one instance of a class exists. One global point of access. Prevent creation of multiple instances.
Right now, all of you are the observers, and I am the subject. You people are watching me. Ie, a 100 observers are watching one subject. This is the concept of Observer Pattern.
Resources in the workspace can change either as a result of manipulating them inside eclipse or from changes from the local file system. (if time is there, include NotificationManager)
This kind of design is not scalable, as the no: of sort behaviour increases, you need to increase the sub classes. Moreover, design principles says to ‘favour composition over inheritance’. Your table viewer changes when ever a new sort mechanism is added. Soln – Move the sorting logic out of table viewer.
You have a treeViewer or TableViewer and you want to add behaviours like sorting and filtering to the viewer. One way to add behavior is to subclass the viewer like ‘SortedTableViewer’ or ‘FilteredTableViewer’. But this will just add to the complexity. The solution is implemented using the strategy pattern. Strategy pattern allows you to customize the behavior of an object without subclassing.
A proxy is a class functioning as an interface to another class. We need a proxy b’cos access the file directly from file system is an expensive affair. And IFile represents an in-memory represenation on a file.
IFile implementation knows only the path to the resource.
Clients need a way track to the resources in the file system. These can be files or folders. The files can change over its life time. Files can be created, modified or deleted. Eclipse gives a handle to the resouce, not the actual resource in the file system. This design is achieved using the Proxy and Bridge patterns. We will see only th proxy pattern here.
VO – once created none of their fields change.
You can naigate the tree of files in almost no time. When yo use the file system you have to make many queries to the undelying OS.
The filter method is added in a visitor object. The visitor object traverses through the tree.
Explain all four classes. Show the elementTree in eclipse.
StandardPropertiesAdapterFactory
Details training session on pattersn – where the design patterns are explored and usecases are taken from eclipse.