[Lecture Notes by Prof Yuen and possibly others 2000-2001] Abstraction ----------- You learned the logical AND relation: 0&0 = 1&0 = 0&1 = 0; 1&1 = 1. Pretty simple and obvious right? What does the formulae mean, besides the obvious "logical AND - both parts must be true to make the combination true"? (a) Multiplication: 1 times 0 = 0 times 1 = 0 times 0 = 0; 1 times 1 = 1; (b) Carry bit in addition: 1+1 causes a carry to the left; 0+0, 1+0, 0+1 produces no carry left; (c) Control: If A is 0, then the output is 0 whether B is 0 or 1, i.e., path is closed; if A is 0, then the output is equal to B, i.e., path is open. So you see the same formulae have different meanings (interpretations) in different contexts, which is what abstraction is all about: a single formalism that can be applied to different situations for different purposes that have the same underlying logic. You saw earlier in the course that you can synthesize a binary arithmetic device, when given an input-output specificat- ion, as a connection of AND/OR gates, but the same Boolean function can be interpreted to have some other meaning, such as a set of decisions to be made using some input data, which would be implemented as a computer program containing a set of If..Then..Else.. statements. Within the domain of software design and implementation itself, the idea of abstraction takes a particular form, of finding common structures that arise in different situations. For example, the idea of an employee is very common, and arises whenever we build systems for managing companies. Employees in different organizations, with different people, operations and environments, would nevertheless have common information structures and processing sequences. They get paid, promoted and fired, and the same procedures for filing documents, holding meetings, getting permission/ decision from managers, calculating holiday leaves or bonuses, etc, are followed across companies. Occasionally, a software contractor writing code or building databases for one company can re-use its record and file structures or software modules for another client later with slight changes; more frequently, there are just common frameworks for defining information and processing relating to common ideas. An widely use approach is object-oriented system analysis and design. To computerize some apsect of the operation of an organization, the designer identifies the objects involved in the operation, grouping objects into classes with standard data attributes, with a superclass-subclass hierarchy such that a subclass contains data attributes of a superclass plus additional attributes unique to the subclass, which simplifies the definition of objects in comparison to defining objects and classes individually. The objects invoke methods, sequences of program execution that cause an object to receive information, produce new information, and modify their own attribute values (like an employee executing a Promotion method which raises its Rank attribute, after checking various relevant information and making related changes). Objects interact by invoking methods of other objects. In this process, individual objects are abstracted into the smallest subclasses (e.g., the class of Clerks abstracts information common to any clerk like pay rank, with individual objects containing non-common like name, age, address, phone no., etc) whose common information is abstracted into larger superclasses (e.g., Clerks is a subclass of Adminstaff whic has attributes common to Clerks, Secretaries, Supervisors.., while Adminstaff, Engineers, Assembly, Managers, etc. are subclasses of the Employee class.) Just as attributes are relevant to particular classes, methods have their hierarchy of relevance, like all employees are paid and promoted, but allocation to a production line is only relevant to Assembly workers, while typing up Form A is only relevant to Clerks. This kind of object- method identification not only helps to simplify the writing of the code for the methods, it is also useful in error checking since trying to execute a non-relevant method on an object can be detected and stopped to prevent incorrect processing.