Interface Implicit
- Interaces are satisfied implicitly.
- User defined data types just need to possess the methods defined in interface to be considered an instance of interface.
- We are not locking us with abstration at the start of a project.
- We can define interfaces as and when abstractions become apparent.
- This design lets us create new interfaces that are satisfied by existing concrete types, without changing the existing types.
- Interface definition and concrete type definition could appear in any package without prearrangement(預先做妥的安排).
- It makes it easier to abstract dependencies.
conventional
- Keep interfaces simple and short.
- Define interfaces when there are two or more concrete types that mush be dealt(處理) with in a uniform way.
- Create smaller interfaces with fewer, simpler methods. ask only for what is needed