Single Responsibility Principle JDK follows this (java.awt package) Graphics2D – drawing shapes Shape – for representing the geometrical shapes Some other examples: Task to download a file, parse it, and store it in a database UserSetting- provide customisation feature, check Access
Dependency Inversion Principle”High level modules should not depend on the lowlevel details modules, instead both should depend on abstractions”
Dependency Inversion Principle Copy Read Keyboard Write PrinterWhats GOOD or BAD about this design?
Dependency Inversion Principle Copy program is NOT REUSABLE Tightly bound to Keyboard and Printer Read Keyboard and Write Printer are REUSABLE
Dependency Inversion Principle Copy program shouldnt be dependent on the Low level Read/Write modules. How can we correct this?
Dependency Inversion Principle Copy Reader Writer Keyboard Reader Print WriterCopy program now depends on Abstractions- Reader and Writer
Resources Wikipedia – SOLID OO Design Robert C Martin articles. Jim Weirich SOLID Ruby talk at Ruby Conference 2009. Rob Martin interview at Hansel Minutes. … and various other small articles, presentations
Ideas for next learning sessions? GoF Design Patterns One or two patterns each week with code samples JVM Internals NoSQL Java and Concurrency Functional programming in Java