Item 1. Data Abstraction
A “type” is a set of operations, and an “abstract data type” is a set of operations with an implementation. When we identify objects in a problem domain, the first question we should ask about them is, “What can I do with this object?” not “How is this object implemented?” Therefore, if a natural description of a problem involves employees, contracts, and payroll records, then the programming language used to solve the problem should contain Employee
, Contract
, and PayrollRecord
types. This allows an efficient, two-way translation between the problem domain and the solution domain, and software written this way has less “translation noise” and is simpler and more correct.
In a general-purpose programming language like ...
Get C++ Common Knowledge: Essential Intermediate Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.