22. Single Responsibility Principle
Rectangle
Computation ----------------------- GUI
application Draw() application
Area()
GUI
What is the issue with this design?
25. 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
46. Dependency Inversion Principle
Copy program is NOT REUSABLE
Tightly bound to Keyboard and Printer
Read Keyboard and Write Printer are
REUSABLE
47. Dependency Inversion Principle
Copy program shouldn't be dependent on the
Low level Read/Write modules.
How can we correct this?
48. Dependency Inversion Principle
Copy
Reader Writer
Keyboard Reader Print Writer
Copy program now depends on Abstractions- Reader and Writer
49. 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
50. 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