practices for different design partterns written in JAVA