Table of Contents
Natural Class
Meaning 1
Alternative Terms
Definition
A natural class is a class which was not artificially created as part of the solution but derived from the problem domain of the software.
Description
Someone with no technical knowledge but knowledge about the application domain can come up with natural classes as they are just concepts and abstractions derived from the problem domain. Software typically also requires some artificial classes for its solution but the Model Principle tells to avoid them in favor of natural classes if there is no greater benefit from introducing an artificial class. According to MP and TdA/IE functionality is mapped to natural classes and artificial ones are only created for special purposes. Often patterns make creating artificial classes necessary, although this is not always the case.
Note that natural classes and domain classes are related but not the same notions. Each domain class is a natural class but not the other way around. A domain class is a class which is part of a domain model (typically stored in a database, etc.) whereas a natural class is just one which is not artificially created. Even classes like DatabaseConnection
or HttpRequest
are natural classes, because they represent a natural concept which exists independent of the software. Classes like BeanFactory
or InvocationHandler
on the other hand are not meaningful outside the context of the software, of the solution. So these are artificial classes.
Examples
- Classes like
Book
,User
,Contract
,Order
,OrderItem
, etc. are natural classes and also domain classes. - Classes like
Button
,TextField
,DatabaseConnection
,HttpRequest
,Time
,Integer
,Velocity
,Voltage
, etc. are also natural classes but typically not domain classes. - Classes like
ActionListener
,ConnectionAdapter
,BeanFactory
,InvocationHandler
, etc. are not natural but artificial classes.
Alternative Definitions
See Also
Further Reading
Other Meanings
Discussion
Discuss this wiki article and the term on the corresponding talk page.