Many developers
write procedural code in object-oriented languages like Java and C#. Telling them
"write object-oriented code" is very easy than implementing it,
especially for three classes of developers.
1. Interns
and novices who don't know exactly what it is and not have sufficient practical
knowledge.
2. Experienced
developers but never got it right. Nobody told them that whether it is correct or
not by reviewing their code base
3. People came
from other engineering stream and curriculum for example studied non-computer science
groups and entered into software development without having a formal training etc.
The theory they
learned and the examples they used in academics are not enough to know the
differences. The examples they used for practicing are vary depending the stream
they studied. For example: Engineering stream and IT stream. Engineering stream
uses technical examples. IT stream uses the business information processing example.
It is easy to understand them from real world examples like Birds, Animals,
Geometrical Shapes etc. but it is very hard to apply these principles and
techniques in business entities and information processing etc.
Classes are
blue prints of objects. Objects are instances
of those classes having an Identity, State, and Behavior. Objects are
collections of roles and responsibilities. Objects play roles and roles
will have responsibilities to carry-out some job. Objects are mostly about behavior
to carry out some task. They are not bundles of data. The object’s state should
be always hidden from the outside the world.
Decomposing
and distributing the responsibilities among small-small objects is an art that
should be deliberately practiced over and over and constantly reviewed to know
whether there are multiple things in going into single object.
I’ll write more in detailed on this subject in coming posts.
No comments:
Post a Comment