Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - Singleton pattern (create only ONE instance)
- - Lazy or greedy (eager) loading
- Lazy loading is not threadsafe! Greedy is threadsafe.
- Lazy: not threadsafe but uses less resources.
- In case of greedy loading you create the instance at compiling, but you might not need it.
- Interface of a class consists of everything which is declared public (properties, methods, fields [but we do NOT ever use public fields).
- A class has interface, and it has an implementation!
- The implementation is not part of the interface, it's part of the implementation of the class.
- Fields are part of the implementation.
- The interface is the public part, the implementation is meant to be protected/private - secret, in other words.
- No one is supposed to know my implementation!
- So let us redifine ecapsulation...
- In a class we ecapsulate a public interface and a private implementation.
- Abstract classes and interfaces
- An interface has an interface (like classes) but no implementation.
- An abstract class has an interface and it can have implementation (fully, partially, or no implementation at all).
- class, interface, abstract class - these are types! Because they have interface, and they can be used as a type.
- GOF2.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement