ADT_Additional_Notes.pdf

ADT_Additional_Notes.pdf - Appendix A ABSTRACT DATA TYPES...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Appendix A ABSTRACT DATA TYPES IN JAVA ab-stract : That which comprises or concentrates in itself the es- sential qualities of a larger thing or of several things. – The New Merriam-Webster Pocket Dictionary In practice, the larger the program, the harder the debugging and the more limited the confidence in its correctness. One of the basic programming rules is that no method should ever exceed a page. The years of experience have shown that the best way is to split the program into small coherent and understandable pieces, or modules , and then fit them together. Generally speaking, a module is a unit in a larger software system that bundles together some data and some operations and has a carefully defined interface . The external users of the module can make use of the operations and data provided in the module interface, but the internal implementation of the module is concealed and is made inaccessible to external users. Thus the hidden internal data representation can be completely replaced without affecting the external users. This is called substitutability of data representations , and it permits us to improve the efficiency of a software system by replacing less efficient data representations with more efficient ones. Most of the algorithms in this handout are too small to involve this technique. Nonethe- less, it can be used to separate data structures from algorithms. Consider, for example, any above-mentioned algorithm for sorting a set of numbers. It is clear that the algorithm will work, even without specifying what data structure is used to represent the set. This separation of data structure from algorithm permits us to study each in isolation as well as to organize and simplify them. This concept is called data abstraction . An abstraction of a thing has two qualities: it suppresses irrelevant details and it seeks to isolate the essence of the thing being abstracted. 221
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
222 COMPSCI.220FT A.1 Abstract Data Types Abstract data types (ADT) are a way of organizing the objects and operations that de- fine a data type in such a way that the specifications and behaviours of the data type are rigorously separated from the data type’s implementation. Java provides strong, general- purpose support for modular programming through its classes , interfaces , and packages . A Java class is an example of an ADT. ADT’s externally accessible operations and data are given by public methods and data fields declared in the class. The ADT’s hidden implementation details are represented by the private data fields and methods of the class. Java interfaces can be used to define ADTs that can incorporate general pur- pose replaceable data components. The interface defines abstract behavioural characteristics that allowable components must implement. Any specific kinds of data components that implement the interface can then be used as plug- compatible components, suitable for plugging-in to the ADT.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern