Showing posts with label design. Show all posts
Showing posts with label design. Show all posts

Design pearls

Head first design pattern is a must must READ. Some of the principles are
# Encapsulate that varies.
# Every class has single responsibility to change.
# Keep interacting objects loosely coupled.
# Favour composition over inheritance. If required, inheritance should be used for type hierarchy and not behaviour.
# Use abstractions instead of concrete classes.
# Classes should be open for extension and closed for modification. This minimizes any changes to existing code / class hierarchy and new classes designed for changes. Decorator Pattern uses this principle, for example famous java IO API's.
More principles next time. Until then...
Jai ho.