.

Sunday, February 24, 2019

Data Abstraction

According to the Merriam-Webster online dictionary, the word cop is defined as disassociated from any(prenominal) specific instance or expressing a quality apart from an disapprove, or having only intrinsic form with little or no attempt at pictorial representation or narrative issue.From these definitions, it merchantman be possible to get an brain that to abstract an butt implies several(prenominal)thing ethereal and nebulous, completely disjoint from a concrete instance of that object. In an idea reminiscent of Plato, the world fire be separated into two things the abstract idea and the concrete instance.Understanding the concept of the abstract info sign or ADT is easier spanging the definitions of abstraction. An ADT is a representation of a concrete instance. Computers can only process iodines or zeros and can only store keen-sighted ones and zeros.However, in building programs a programmer force want to expand code that interacts or models real world object s or processes. ADTs are invented information types data types that are modeled after the abstract idea of the concrete instance. An example is the string data type found in some programming nomenclatures.A computer cannot store a string (only ones and zeros) yet programmers can do operations on a string like chemical chain (using the + operator) effortlessly as if the computer or compiler understands that the user is works with sentences.This brings to light an important concept when dealing with ADTs the concept of information hiding. A compiler designer might engineer a programming language to handle string in many ways. He may favour to use ASCII or EBCDIC, use 8 bits per character or a full 32 bit word, use little endian or big(a) endian storage.All these choices are invisible to the user. All the developer acquires to understand is that to concatenate strings uses a + operator. Indeed, for an abstracted data type to be functional the functionality of that data type should reflect that what that ADT represents independent of the implementation.The nitty gritty of its workings is hidden empennage a wall called the interface. The interface (associated operations, properties, etc) is all that the programmer gather ups and should need to know. A good wall is a prerequisite of good ADT design.So farther the paper has discussed about ADTs as data types that represent an idea (such as a string) that is not natively supported by the hardware. A developer might alike make his or her own ADTs through the use of data structures.A data structure is basically just an ordered way of organizing data. An example of a data structure is the struct in C, linked lists, and trees. A developer may pack to create one of these data structures in order to represent an abstract idea. He may choose to use a tree in order to represent a family tree.In designing user created ADTs, the concept of information hiding should still be remembered. The ADT should provide a c onstant bar interface for every method or subroutine that chooses to call it. Additionally, it goes without utter that the data structure of choice should efficiently model the abstract idea it represents. Using a tree to represent genealogy is easier and makes more sensory faculty compared to using linked lists.A soda vending machine, even though it is instead simple is a good illustration of the many aspects of ADT design. The developer might need to store the types of sodas the machine is selling. As there is no soda data type, the programmer might use strings. When the machine vends, the machine should also know that there is one less soda in its storage.A programmer might then choose to implement the sodas as a stuct composed of one string (for the soda name) and an integer representing the number of soda cans left. When the customer presses a button corresponding to a soda, the soda name is displayed on the harbor and the machine checks if there are still soda cans left.I f there are cans left, the vend process continues through with the customer getting his soda (after requital of course) and the integer counter for the soda is decremented by one. However if the counter is of economic value zero already, the machine halts the operation and tells the customer to pick another soda.BibliographyCarrano, Frank, and Janet Prichard. information Abstraction and Problem Solving with C++ Walls and Mirrors. 3rd ed. Boston Addison-Wesley, 2001.Sedgewick, Robert. Algorithms in C. 3rd ed. Boston Addison-Weslet, 1998.Sun Developer Network Website, java.sun.com

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.