Computer Science

Java Abstraction

Java Abstraction is a technique used to hide the implementation details of a program and only show the necessary information to the user. It allows developers to create complex systems by breaking them down into smaller, more manageable parts. Abstraction is achieved through the use of abstract classes and interfaces.

Written by Perlego with AI-assistance

5 Key excerpts on "Java Abstraction"

  • Book cover image for: Concepts in Programming Languages
    9.2 Language Support for Abstraction 243 entity that makes sense apart from its specific use on these specific variables. In grandiose terms, enclosing code inside a function makes the code generic and reusable. This is an idealistic description of the advantages of enclosing code inside a function. In most programming languages, a function may read or assign to global variables. These global variables are not listed in the function interface. Therefore, the behavior of a function is not always determined by its interface alone. For this reason, some purists in program design recommend against using global variables in functions. Data Abstraction Data abstraction refers to hiding information about the way that data are repre-sented. Common language mechanisms for data abstractions are abstract data-type declarations (discussed in Subsection 9.2.2 ) and modules (discussed in Section 9.3 ). We saw in Subsection 9.1.2 how a sorting algorithm can be defined by using a data structure called a priority queue. If a program uses priority queues, then the writer of that program must know what the operations are on priority queues and their interfaces. Therefore, the set of operations and their interfaces is called the interface of a data abstraction. In principle, a program that uses priority queues should not depend on whether priority queues are represented as binary search trees or sorted arrays. These implementation details are best hidden by an encapsulation mechanism. As for procedural abstraction, there are three main goals of data abstraction: 1. Identifying the interface of the data structure. The interface of a data abstrac-tion consists of the operations on the data structure and their arguments and return results. 2. Providing information hiding by separating implementation decisions from parts of the program that use the data structure. 3. Allowing the data structure to be used in many different ways by many different programs.
  • Book cover image for: Java Programming Fundamentals
    eBook - PDF

    Java Programming Fundamentals

    Problem Solving Through Object Oriented Analysis and Design

    • Premchand S. Nair(Author)
    • 2008(Publication Date)
    • CRC Press
      (Publisher)
    355 C H A P T E R 7 Object-Oriented Software Design In this chapter you learn Object-oriented concepts Encapsulation, information hiding, interface, service, message passing, responsibil-ity, delegation, late binding, inheritance hierarchy, composition, and abstract class Java concepts Subclass, superclass, reference super, access modifiers, final class, abstract method, abstract class, and interface Programming skills Design, create, execute, and test Java programs having many classes related through superclass/subclass relationship or composition Reliable, error-free, maintainable, and flexible software is very diffi cult to produce. Today’s software systems are quite complex and no level of abstraction can eliminate the complexity completely. However, certain abstractions are more natural to human thinking compared to other forms of abstractions. In the case of object-oriented paradigm, real-world entities are modeled as objects. This form of abstraction enables the software developer to divide the software into a collection of mutually collaborating objects working toward achieving a common goal of solving the problem. In this chapter, you will explore object-oriented para-digm in a more comprehensive fashion. Further, examples and analogies presented in this chapter will help you understand the object-oriented way of developing Java programs. OBJECTS The most fundamental concept of the object-oriented paradigm is that of an object. An object can be perceived in three different ways. In fact, these are not contradictory views; rather, they complement each other to enhance our ability to model the real world. • • • • • • 356 ■ Java Programming Fundamentals Three perspectives of an object are Data-centric view Client–server view Software design view Data-Centric View From a data-centric perspective, an object is a collection of attributes and operations that manipulate the data.
  • Book cover image for: Putting Information First
    eBook - ePub

    Putting Information First

    Luciano Floridi and the Philosophy of Information

    As levels of programming language abstraction increase, the languages become more expressive in the sense that programmers can manipulate direct analogs of objects that populate the world they are modeling, like shopping carts, chat rooms, and basketball teams. This expressiveness is only possible by hiding the complexity of the interaction patterns occurring at lower levels. It is no accident that these levels mirror the history of computer programming language development, for hiding low-level complexity can only be accomplished through a combination of more sophisticated language translators and runtime systems, along with faster processing hardware and more abundant storage.
    We have shown that other forms of computer science abstraction besides language abstraction, for example procedural abstraction (Colburn 2003) and data abstraction (Colburn and Shute 2007), are also characterized by the hiding of details between levels of description, which is called information hiding in the parlance of computer science.
    Floridi proposes to use levels of abstraction to moderate long-standing philosophical debates through a method that “clarifies assumptions, facilitates comparisons, enhances rigour and hence promotes the resolution of possible conceptual confusions” (Floridi 2008a, 326). These features are certainly advantages in a philosophical context, and there is no doubt that abstraction through information hiding in computer science goes a long way toward mitigating “conceptual confusions,” but how similar are Floridi’s and computer science’s levels of abstraction provided by programming languages?
    In Floridi’s view, a level of abstraction is, strictly speaking, a collection (or “vector”) of observables, or interpreted typed variables. What makes the collection an abstraction is what the variables’ interpretations choose to ignore. For example, a level of abstraction (LoA) of interest to those purchasing wine may consist of the observables maker, region, vintage, supplier, quantity , and price , while a LoA for those tasting wine may consist of nose, robe, color, acidity, fruit , and length
  • Book cover image for: Logic/Object-Oriented Concurrent Robot Programming and Performance Aspects
    • Alfried Pollmann(Author)
    • 2020(Publication Date)
    • De Gruyter
      (Publisher)
    32 Chapter 3. Object-Orientation and Logic Programming details. Data abstraction actually covers two separate but closely related concepts: • modularization and • information hiding. Modularization is concerned with the splitting of complex systems into a number of self-contained entities (or modules). All information relating to a particular entity in the system is held within that module. Thus, a module is a self-contained and complete description of a part of the overall structure. In connection with computing, this means that a module will con-tain all the data structures and algorithms required for the implementation of the respective part of the system. The modularization benefits the pro-grammer as there is an obvious place to go to if changes have to be made or problems occur. More fundamentally, modularization supports a particular design approach whereby the programmer splits the problem domain to be implemented into a number of recognizable conceptual modules and forms the essence of object-oriented computing. Information hiding provides abstraction by hiding the implementation details of a module from the user. Using information hiding, the access of an object must be done through a protected interface. This interface normally consists of a number of operations which collectively define the behaviour of an entity. For the user, these internal details such as local procedures and data structures are unvisible. To handle complexity, information hiding enables the user to abstract over a level of detail in the system. Furthermore, the development of more reliable programs is supported by strictly controlling the entry points to a module. Thus, it is not possible to access data struc-tures directly and hence not possible to perform unexpected actions on the data. The only way of accessing data structures is through the operational interface. Behaviour Sharing A further concept of object-orientation is connected with behaviour sharing.
  • Book cover image for: Introduction to Programming Languages
    121 C H A P T E R 4 Abstractions in Programs and Information Exchange BACKGROUND CONCEPTS Abstract syntax (Section 3.2.6); Abstract concepts in computations (Section 2.4); Grammars (Section 3.1); Control flow (Section 1.4.2); Data structure concepts (Section 2.3); Discrete structures (Section 2.2); Graphs (Section 2.3.6); Programming background; Trees (Section 2.3.5); Syntax diagrams (Section 3.3). A program is about the manipulation of structured data to achieve an intended computa-tional state that satisfies the final intended condition. Programming can be done at multi-ple levels: machine-level programming, assembly-level programming, low-level procedural programming, high-level procedural programming, declarative programming, and so on. The amount of abstraction and the level of explicit control separate high-level program-ming languages from low-level programming languages. One of the goals of abstractions is to make the software reusable with minimal change, so that software evolution has minimal overhead as the needs evolve or technology changes. There are two types of abstractions as described earlier: data abstractions and control abstractions. Data abstractions are used to model real-world entities using a required subset of their attributes, and control abstractions are used to structure the sequence of instructions for better comprehension and maintenance. A data entity can be characterized by a set of attributes and can be abstracted by a relevant subset of those attributes needed to solve a prob-lem at hand. Data entities are generally expressed in the declaration part of a program, and the control part is expressed in the body of the program. As described earlier, the declaration part of the program modifies the program environment, and the control part of the pro-gram that involves assignment statement modifies the program store.
Index pages curate the most relevant extracts from our library of academic textbooks. They’ve been created using an in-house natural language model (NLM), each adding context and meaning to key research topics.