I finished reading the book today and thought it was too good to write. In a simple example, the application of encapsulation is explained in detail. I think this idea can be applied to the Linux operating system design completely. For example, the relationship between NAND MTD and NAND chip info is the concept of encapsulation. Why do you want to disassemble the guitar guitarspec? Because something in Guitarspec is a mutable property in guitar. And what serialnumber is actually not guitarspec innate attribute, is the system artificially added.
The second chapter to the fourth chapter is about how to gather requirement and analysis. The fifth chapter good design, is actually the first chapter to optimize, instrument, Instrument spec (for abstract class) guitar, guitar spec mandolin, mandolin spec equivalent to each additional instrument, I We are going to add two more classes. We can encapsulate the instrument spec again and use a map to represent it. This way we don't need to add two class objects at a time. There is a principle more important, less use of inheritance, multi-use combinations, and sometimes can be delegated instead of inheritance.
Object-oriented analysis and design read Note 02