Based on this question I think while the aim of OOP is not necessarily to copy real world objects, they could be source of inspiration to design a software or solve a problem or even learn the OOP itself.
For example for an application which deals with drawing, a Bitmap
could be regarded like a Page
, then as a page has back color, we can define a BackColor
attribute for it. But we may realize a real page has not text color and it's the attribute of the pen, so we can define a class named Pen
which is used for drawing and has a Color
, LineWeight
or ..
I always look for such analogy and inspirations of objects and their interactions when I develop a software, but I don't have a systematic or clear definition for what I am doing. I don't know which aspects of OOP I am copying.
Is it an acceptable technique in OOP? Do you use it? Is it possible that I violate an OOP guideline while I am using this technique?
I would like to know how this technique may help me to follow OO principles, so I can consciously use it.