A-level Computing/AQA/Paper 1/Theory of computation/Composition

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Composition is putting pieces back together the opposite of the decomposition

In computing there are 2 types of composition: (1) Object Composition and (2) Function Composition

Generally speeking, both types of composition involve incorporating multiple objects/functions to create a single, more complex object/function. The process of determining objects/functions to be 'composed' is part of the abstraction process (see computational thinking), and could be the direct result of decomposition (see decomposition). This is a requred process of the Software Development Lifecycle, but can be applied to any other activity where Computational Thinking is applied.

The following function could be decomposed:

Function PrintCustomerBankAccounts


Function PrintCustomerSavingsAccount

Function PrintCustomerBankAccount

if there were different attributes (see attributes) for the 2 account types.

However it may be determined