Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now
1 of 7

How to get inspired by real word objects in OOP?

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.

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 back color 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, line weight....

I use such analogy and inspirations 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 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 and what is their relation, so I can consciously do it.