Model the real world
m (Reverted edits by Ebybymic (Talk); changed back to last version by Jenny Harlow) |
|||
(3 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
:''Model the real world whenever possible. (This heuristic is often violated for reasons of system intelligence distribution, avoidance of god classes, and the keeping of related data and behavior in one place).'' --Riel's Heuristic 3.6, [[Arthur Riel 1996]] | :''Model the real world whenever possible. (This heuristic is often violated for reasons of system intelligence distribution, avoidance of god classes, and the keeping of related data and behavior in one place).'' --Riel's Heuristic 3.6, [[Arthur Riel 1996]] | ||
− | Object Oriented programming is all about modelling the real world. We do this because in theory it is easier to think about how something works if it exists in the real world. For example, a trivial ''Car'' class would be easy to implement, as most people know what a car is made up of, at a high level sense. Modeling real world objects is considered easier than modeling complex, artificial algorithms and control processes that only exist in the domain of the program they are being developed for. OO also gives programmers a way to decompose a problem into smaller components that "make sense". Of course, this all relies on being able to make good OO models (ie | + | Object Oriented programming is all about modelling the real world. We do this because in theory it is easier to think about how something works if it exists in the real world. For example, a trivial ''Car'' class would be easy to implement, as most people know what a car is made up of, at a high level sense. Modeling real world objects is considered easier than modeling complex, artificial algorithms and control processes that only exist in the domain of the program they are being developed for. |
+ | |||
+ | OO also gives programmers a way to decompose a problem into smaller components that "make sense". Of course, this all relies on being able to make good OO models (ie choosing good classes). The main guideline is to model what actually exists in the real world. For example, ''Car'' and ''Road'' may be good OO classes, but ''VehicleAndRoadController'' probably isn't very good. A class name that has no meaning outside of the computer program may be a sign you are not modeling the real world. Of course, exceptions will occur in certain domains, and it is not often as easy as just "modeling the real world". | ||
+ | |||
+ | ==See also== | ||
+ | [[Domain model pattern]] | ||
[[Category:Riel's heuristics]] | [[Category:Riel's heuristics]] |
Latest revision as of 03:11, 25 November 2010
- Model the real world whenever possible. (This heuristic is often violated for reasons of system intelligence distribution, avoidance of god classes, and the keeping of related data and behavior in one place). --Riel's Heuristic 3.6, Arthur Riel 1996
Object Oriented programming is all about modelling the real world. We do this because in theory it is easier to think about how something works if it exists in the real world. For example, a trivial Car class would be easy to implement, as most people know what a car is made up of, at a high level sense. Modeling real world objects is considered easier than modeling complex, artificial algorithms and control processes that only exist in the domain of the program they are being developed for.
OO also gives programmers a way to decompose a problem into smaller components that "make sense". Of course, this all relies on being able to make good OO models (ie choosing good classes). The main guideline is to model what actually exists in the real world. For example, Car and Road may be good OO classes, but VehicleAndRoadController probably isn't very good. A class name that has no meaning outside of the computer program may be a sign you are not modeling the real world. Of course, exceptions will occur in certain domains, and it is not often as easy as just "modeling the real world".