Абстракция и декомпозиция
Отделение интерфейса от реализации можно рассматривать, с одной стороны как частный случай абстракции, а с другой как частный случай декомпозиции.
Определенная задача разделяется на несколько подзадач:
- Формирование некоторой промежуточной абстракции (например, выбор абстрактного типа данных)
- Решение задачи с помощью этой абстракции
- Реализация абстракции
Таким образом снижается сложность задачи.
What we desire from an abstraction is a mechanism which permits the expression of relevant details and the suppression of irrelevant details. In the case of programming, the use which my be made of an abstraction is relevant; the way in which the abstraction is implemented is irrelevant. If we consider conventional programming languages, we discover that they offer a powerful aid to abstraction: the function or procedure. When a programmer makes use of a procedure, he is (or should be) concerned only with what it does — what function it provides for him. He is not concerned with the algorithm executed by the procedure. In addition, procedures provide a means of decomposing a problem — performing part of the programming task inside a procedure, and another part in the program which calls the procedure. Thus, the existence of procedures goes quite far toward capturing the meaning of abstraction.[1]
Ссылки на эту заметку
Programming with abstract data types. Barbara Liskov. 1974. The Meaning of Abstraction ↩︎