Get inspired by real world objects and their interactions [closed]

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.

13

You’re conflating multiple things when you over analyse the problem.

For example, when designing a page object that reflects a real-world sheet of paper you start to consider pens. Don’t!

Take just the sheet of paper and consider its properties. It has a paper colour, texture, size. Then do not try to map your preconceptions of computing terms to the object. A sheet of paper does not have a ‘backcolour’. It has a colour, of the dye or material used in the manufacture of the paper. This is different to any concept of drawing using a pen that has 2 inks (assuming a very unusual pen that draws both a wide underlay and a ink nib).

Its important to try not to ‘map’ your concepts to the item. and simply look at the entity as an independant thing. consider what only it does, not what can be done to it or any other item. Then you’ll find the properties fall into place, and you can move onto the next item, eg a pen and what properties it has.

When considering the object, also forget the methods you’ll use to modify it. Start with the properties only. Methods are added as ways to interact and modify those properties so they are not really important in the design stage. eg. your paper can hold writing on it, so its property is that it can maintain text blocks in particular positions. You’ll add a method to add new writing to it but when designing its the writing held by the paper that is much more important than how that writing gets written.

Hopefully this’ll help clear your thoughts, design can be a bit vague and loose at the best of times!

2

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật