Model the real world

From CSSEMediaWiki
(Difference between revisions)
Jump to: navigation, search
(New page: Object Oriented programming is all about modeling 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,...)
 
m
Line 1: Line 1:
Object Oriented programming is all about modeling 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 picking classes). The main guideline is to model what agtually 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 it is part of 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".
+
Object Oriented programming is all about modeling 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 picking 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 it is part of 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".

Revision as of 23:36, 29 August 2008

Object Oriented programming is all about modeling 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 picking 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 it is part of 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".

Personal tools