What is Object Decomposition?

安稳与你 提交于 2019-12-03 11:48:24

Imagine, you have Car object. It is very large object, hard to support. You break this objects into smaller responsible for some part of the problem domain:

  • Engine
  • Сabin
  • Boot
  • ...

That's the decomposition, each of that objects can be broken again, like Cabin consist of Board, Sits, Wheel... Or probably Board consist of Wheel and other parts. Etc.

I think you've basically got it correct -- mapping the "real world" things you'll be working with to representations as objects in your code.

Sometimes people call this modeling, because they are creating a "model," in code, for things and concepts in the real world, like employees, accounts, birthdays, cameras, etc. -- some physical, others ephemeral, but all needing to be represented as objects in code.

By saying composition, in C++, it means you set a object from a class that I named it A (maybe containing three data members, for example three built in type as integers to not make things too complicated) into another class that I named B (and possibly together to others data members belonging to class B).

In turn, muy actual puzzle is to figure out how to decompose this object from class A that was included in class B. As almost 50% of the time,(not refering& to this site because this is my first active participation) let me go because I khnow I won´t have a concrete help...so let me go to dig down into my collection two feet height C++ books and study

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!