Advertisement
csaki

progtech gyak 1.

Feb 13th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 KB | None | 0 0
  1. - Singleton pattern (create only ONE instance)
  2. - Lazy or greedy (eager) loading
  3.  
  4. Lazy loading is not threadsafe! Greedy is threadsafe.
  5. Lazy: not threadsafe but uses less resources.
  6. In case of greedy loading you create the instance at compiling, but you might not need it.
  7.  
  8. Interface of a class consists of everything which is declared public (properties, methods, fields [but we do NOT ever use public fields).
  9. A class has interface, and it has an implementation!
  10. The implementation is not part of the interface, it's part of the implementation of the class.
  11. Fields are part of the implementation.
  12.  
  13. The interface is the public part, the implementation is meant to be protected/private - secret, in other words.
  14. No one is supposed to know my implementation!
  15.  
  16. So let us redifine ecapsulation...
  17. In a class we ecapsulate a public interface and a private implementation.
  18.  
  19. Abstract classes and interfaces
  20. An interface has an interface (like classes) but no implementation.
  21. An abstract class has an interface and it can have implementation (fully, partially, or no implementation at all).
  22.  
  23. class, interface, abstract class - these are types! Because they have interface, and they can be used as a type.
  24.  
  25. GOF2.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement