Tuesday, October 11, 2016

Ruby - Use Struct for "Reification" / OO

http://blog.steveklabnik.com/posts/2012-09-01-random-ruby-tricks--struct-new

Ruby has the Struct construct which author makes use of to "reify" objects to be more Object Oriented. In Java, we'd have to create a separate class for these tiny strongly typed data objects, e.g. by using the "parameter object" pattern.

Saturday, July 23, 2016

Refactoring for SOLID

I read the two articles below on refactoring and SOLID principles.


In the OOP section of the above article, the interesting takeaway is the encapsulation of logic in a "policy" class which is used along "doer" classes to be invoked and thus abstract away and remove cyclomatic complexity from methods.


This one lends credence to the notion of the "large set of small classes" to abide by the Single Responsibility Principle. The emphasis is on composition of behavior, and using seams or interfaces to swap out or extend (by using decorators) existing behaviors to add new features.

Saturday, January 16, 2016

Servlet Filters

Understanding and Using Servlet Filters

On calling doFilter() for pre and post processing around the target servlet service() method.