Sunday, March 7, 2010

Lost in OO

object oriented couldn't be violated more after the rise of enterprise frameworks.
everyone talks about OO, encourage OO, embrace OO, love OO. all new languages are fully OO, and even the old ones are moving to OO.
if your are a developer you will see OO here, there, and everywhere..

but at its heart OO never been applied !!!! at least in the business domain

classes in any business application are divided into two types:
  1. Model classes, or Entities, or POJO's (in java): they are classes with properties only (and some getters and setters). they don't hold any behavior.
  2. Service classes, or Controllers: the classes which provide business logic, services, or control the application flow, or orchestrate the whole application behavior and interaction. these classes have a behavior but hold no state !!. almost they will be exposed as singleton or the behavior will be exposed as static methods.
we all forgot the essence of object oriented programming and the main principle which the OOP was originally built on: Encapsulation
which is the main difference from procedural languages which have separate data, and separate functions work on this data.



No comments:

Post a Comment