What is the difference between procedural abstraction and data abstraction
With a processor chip there will be larger functional units, e. For each level of abstraction there are two separate problems to be addressed Implementing that level of abstraction. Using that level of abstraction. These are very different activities. Using ought to be very much easier than implementing if the abstraction is worthwhile.
Building Levels of Abstraction within Scheme. While car , cdr and cons provide a base abstract view of the machine store, they operate at a low conceptual level, not related to what most programs are about.
We can use them, and other facilities of Scheme, as building blocks to provide abstractions appropriate to the requirements of a given program by Defining functions which implement the concepts which are needed for the program. For example, if we are interested in geometric computations, we will need functions to implement points, lines, planes, circles, spheres Writing the rest of the program using only this basic set of functions.
Within a purely functional approach, implementation requires us to define constructor functions to build representations of the objects and selector functions to access such representations. At the base-level, cons is a constructor function car, cdr are the selectors. The parameter spec is a list of field specifiers. A field specifier says what kind of data can be held in a field. The only kind of specifier we will use is the symbol 'object , which creates a field able to hold any Scheme object.
Historical Note: The record-class capability is non-standard for Scheme. The record-class function returns a list of four items: The first is a constructor function for the record-class.
This takes as many arguments as there are field-specifier in the spec and builds a record containing them. The second is a destructor function for the record-class. This takes a record created by the constructor and makes a list of the objects out of which the record was constructed. The third is a list of selector functions for the record-class, one for each field-specifier in the spec.
Each selector function extracts the contents of the appropriate field. The fourth is a function for recognising members of the record-class. The record-class capability allows to create opaque data-structures which can only be accessed by the appropriate selector functions. When we write the procedure, we need have no knowledge of the code which is going to make use of the procedure. This helps us break programs down into small manageable parts, perhaps handled by different programmers.
Then if we know the only way different pieces of a program can interact is through procedure calls which have a carefully defined effect, it is easier for us to debug and modify program with less chance that changing one part will have an unexpected effect on another part. Procedural abstraction is all about generalising doing some action.
A procedure is called, performs the action, and is then finished. In software maintenance, the following three levels of reverse engineering abstraction are defined: implementation abstraction, design abstraction, specification abstraction.
Various factors affect how good the abstraction is, such as the level and consistency, and additional things like encapsulation. The main point is that the abstraction should provide a consistent set of methods. Consistency in abstraction means that the abstraction stays at the same level.
Shahrivar 6, AP. It is achieved by using an access specifier- a private modifier. Here account balance of each say employee is private to each other being working in the same organization. No body knows account balance of anybody. Aban 27, AP. Data hiding is a process of combining data and functions into a single unit. The data is hidden, so that it will be safe from accidental manipulation. Azar 5, AP.
0コメント