Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. On the slides: names of template fields in red are important, and in green only mildly so.
  2.  
  3. The consequences attribute is largely misused:
  4. Every design decision has certain consequences on other solutions, further development etc. We have to provide the possibilities of blockages etc.
  5.  
  6. There are 23 patterns devised by the gang of four.
  7.  
  8. The singleton
  9. Ensures a class has a single instance.
  10. The singleton creates an access point for the instance as well!
  11. The singleton is responsible for managing the lifecycle of the class.
  12. Might also be responsible for subclasses as well.
  13. Can be transformed into a pool of objects - i.e. instead of one class create a set number of classes.
  14. The singleton is stateless - it does not have any data of its own or of the client.
  15. It is a sort of global variable - which we all know is bad. Side effects appear.
  16. A sort of a lighthouse.
  17. Multi-threaded singleton? 2PL locking with the synchronised statement in java. Class loadres.
  18. Singleton should not be used that much.
  19. Why not use the Context pattern instead?
  20.  
  21. Pool of objects (not defined by the Gang of Four)
  22. Lifecycle of objects: create, reset, close
  23. Management of lifecycle: create objects, reset objects (remove data from other clients), check if the connection is open.
  24. High efficiency solution.
  25. Provides management of the objects for the client.
  26.  
  27. Obsever (Listener)
  28. Performance leaks: observer steals control from the observed object!
  29. Limits coupling (or loosens).
  30.  
  31. Adapter
  32. Adapts an interface into an another interface.
  33.  
  34. Composite
  35. Tree specification, where both nodes and leaves are implement a shared interface.
  36.  
  37. Proxy
  38. Similar to adapter, but we don't want to translate
  39. but instead we want an object that will pretend to be the real object.
  40. Proxy implements the SAME interface as the subject.
  41. The proxy can imitate cals to the subject and calls the subject only if this is strictly necessary.
  42. Can help security (authorization), performance (cache, write buffer).
  43.  
  44. Command
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement