Abstraction layer

In computing, an abstraction layer or abstraction level is a way of hiding the working details of a subsystem, allowing the separation of concerns to facilitate interoperability and platform independence. Examples of software models that use layers of abstraction include the OSI model for network protocols, OpenGL and other graphics libraries.

In computer science, an abstraction layer is a generalization of a conceptual model or algorithm, away from any specific implementation. These generalizations arise from broad similarities that are best encapsulated by models that express similarities present in various specific implementations. The simplification provided by a good abstraction layer allows for easy reuse by distilling a useful concept or design pattern so that situations where it may be accurately applied can be quickly recognized.

A layer is considered to be on top of another if it depends on it. Every layer can exist without the layers above it, and requires the layers below it to function. Frequently abstraction layers can be composed into a hierarchy of abstraction levels. The OSI model comprises seven abstraction layers. Each layer of the model encapsulates and addresses a different part of the needs of digital communications, thereby reducing the complexity of the associated engineering solutions.

A famous aphorism of David Wheeler is "All problems in computer science can be solved by another level of indirection".[1] This is often deliberately misquoted with "abstraction" substituted for "indirection". It is also sometimes misattributed to Butler Lampson. Kevlin Henney's corollary to this is, "...except for the problem of too many layers of indirection."[2]

Computer architecture

In a computer architecture, a computer system is usually represented as consisting of several abstraction levels such as:

Programmable logic is often considered part of the hardware, while the logical definitions are also sometimes seen as part of a device's software or firmware. Firmware may include only low-level software, but can also include all software, including an operating system and applications. The software layers can be further divided into hardware abstraction layers, physical and logical device drivers, repositories such as filesystems, operating system kernels, middleware, applications, and others. A distinction can also be made from low-level programming languages like VHDL, machine language, assembly language to a compiled language, interpreter, and script language.[3]

Input/output

In the Unix operating system, most types of input and output operations are considered to be streams of bytes read from a device or written to a device. This stream of bytes model is used for file I/O, socket I/O, and terminal I/O in order to provide device independence. In order to read and write to a device at the application level, the program calls a function to open the device, which may be a real device such as a terminal or a virtual device such as a network port or a file in a file system. The device's physical characteristics are mediated by the operating system which in turn presents an abstract interface that allows the programmer to read and write bytes from/to the device. The operating system then performs the actual transformation needed to read and write the stream of bytes to the device.

Graphics

Most graphics libraries such as OpenGL provide an abstract graphical device model as an interface. The library is responsible for translating the commands provided by the programmer into the specific device commands needed to draw the graphical elements and objects. The specific device commands for a plotter are different from the device commands for a CRT monitor, but the graphics library hides the implementation and device dependent details by providing an abstract interface which provides a set of primitives that are generally useful for drawing graphical objects.

See also

References

  1. ^ Spinellis, Diomidis (2007). Beautiful Code: Leading Programmers Explain How They Think. Sebastopol, CA: O'Reilly and Associates. pp. 279–291.
  2. ^ @kevlinhenney (September 3, 2012). "Yes, that's my corollary" (Tweet) – via Twitter.
  3. ^ Tanenbaum, Andrew S. (1979). Structured Computer Organization. Englewood Cliffs, New Jersey: Prentice-Hall. ISBN 0-13-148521-0.
Architecture of Windows NT

The architecture of Windows NT, a line of operating systems produced and sold by Microsoft, is a layered design that consists of two main components, user mode and kernel mode. It is a preemptive, reentrant operating system, which has been designed to work with uniprocessor and symmetrical multiprocessor (SMP)-based computers. To process input/output (I/O) requests, they use packet-driven I/O, which utilizes I/O request packets (IRPs) and asynchronous I/O. Starting with Windows XP, Microsoft began making 64-bit versions of Windows available; before this, these operating systems only existed in 32-bit versions.

Programs and subsystems in user mode are limited in terms of to what system resources they have access, while the kernel mode has unrestricted access to the system memory and external devices. Kernel mode in Windows NT has full access to the hardware and system resources of the computer. The Windows NT kernel is known as a hybrid kernel. The architecture comprises a simple kernel, hardware abstraction layer (HAL), drivers, and a range of services (collectively named Executive), which all exist in kernel mode.User mode in Windows NT is made of subsystems capable of passing I/O requests to the appropriate kernel mode device drivers by using the I/O manager. The user mode layer of Windows NT is made up of the "Environment subsystems", which run applications written for many different types of operating systems, and the "Integral subsystem", which operates system-specific functions on behalf of environment subsystems. The kernel mode stops user mode services and applications from accessing critical areas of the operating system that they should not have access to.

The Executive interfaces, with all the user mode subsystems, deal with I/O, object management, security and process management. The kernel sits between the hardware abstraction layer and the Executive to provide multiprocessor synchronization, thread and interrupt scheduling and dispatching, and trap handling and exception dispatching. The kernel is also responsible for initializing device drivers at bootup. Kernel mode drivers exist in three levels: highest level drivers, intermediate drivers and low-level drivers. Windows Driver Model (WDM) exists in the intermediate layer and was mainly designed to be binary and source compatible between Windows 98 and Windows 2000. The lowest level drivers are either legacy Windows NT device drivers that control a device directly or can be a plug and play (PnP) hardware bus.

Cocoa Touch

Cocoa Touch is a UI framework for building software programs to run on iOS for the iPhone, iPod Touch, and iPad, watchOS for the Apple Watch, and tvOS for the fourth-generation Apple TV, from Apple Inc.

Cocoa Touch provides an abstraction layer of iOS, the operating system for the iPhone, iPod Touch, and iPad. Cocoa Touch is based on the macOS Cocoa API toolset and, like it, is primarily written in the Objective-C language. Cocoa Touch allows the use of hardware and features that are not found in macOS computers and are thus unique to the iOS range of devices. Just like Cocoa, Cocoa Touch follows a Model-View-Controller (MVC) software architecture.

Cocoa Touch contains a different set of graphical control elements to Cocoa. Tools for developing applications based on Cocoa Touch are included in the iOS SDK.

Database abstraction layer

A database abstraction layer (DBAL) is an application programming interface which unifies the communication between a computer application and databases such as SQL Server, DB2, MySQL, PostgreSQL, Oracle or SQLite. Traditionally, all database vendors provide their own interface tailored to their products, which leaves it to the application programmer to implement code for all database interfaces he or she would like to support. Database abstraction layers reduce the amount of work by providing a consistent API to the developer and hide the database specifics behind this interface as much as possible. There exist many abstraction layers with different interfaces in numerous programming languages. If an application has such a layer built in, it is called database-agnostic.

Doctrine (PHP)

The Doctrine Project (or Doctrine) is a set of PHP libraries primarily focused on providing persistence services and related functionality. Its prize projects are an object-relational mapper (ORM) and the database abstraction layer it is built on top of.

One of Doctrine's key features is the option to write database queries in Doctrine Query Language (DQL), an object-oriented dialect of SQL.

Flask (web framework)

Flask is a micro web framework written in Python. It is classified as a microframework because it does not require particular tools or libraries. It has no database abstraction layer, form validation, or any other components where pre-existing third-party libraries provide common functions. However, Flask supports extensions that can add application features as if they were implemented in Flask itself. Extensions exist for object-relational mappers, form validation, upload handling, various open authentication technologies and several common framework related tools. Extensions are updated far more regularly than the core Flask program.Applications that use the Flask framework include Pinterest, LinkedIn, and the community web page for Flask itself.

GnomeVFS

GnomeVFS (short for GNOME Virtual File System) was an abstraction layer of the GNOME platform for the reading, writing and execution of files. Before GNOME 2.22 GnomeVFS was primarily used by the appropriate versions of Nautilus file manager (renamed to GNOME Files) and other GNOME applications.

A cause of confusion is the fact that the file system abstraction used by the Linux kernel is also called the virtual file system (VFS) layer. This is however at a lower level.

Due to perceived shortcomings of GnomeVFS a replacement called GVfs was developed. GVfs is based on GIO and allows partitions to be mounted through FUSE.With the release of GNOME 2.22 in April 2008, GnomeVFS was declared deprecated in favor of GVfs and GIO, requesting that developers do not use it in new applications.

HAL (software)

HAL (Hardware Abstraction Layer or rather Hardware Annotation Library) is a software subsystem for UNIX-like operating systems providing hardware abstraction.

HAL is now deprecated on most Linux distributions and on FreeBSD. Functionality is being merged into udev on Linux as of 2008–2010 and devd on FreeBSD. Previously, HAL was built on top of udev.Some other OS-es which don't have an alternative like udev or devd still use HAL.

The purpose of the hardware abstraction layer was to allow desktop applications to discover and use the hardware of the host system through a simple, portable and abstract API, regardless of the type of the underlying hardware.HAL for Linux OS was originally envisioned by Havoc Pennington. It became a freedesktop.org project, and was a key part of the software stack of the GNOME and KDE desktop environments. It is free software, dual-licensed under both the GNU General Public License and the Academic Free License.HAL is unrelated to the concept of Windows NT kernel HALs, which handle some platform-specific core functionality within the kernel, such as interrupt routing.

Hardware abstraction

Hardware abstractions are sets of routines in software that emulate some platform-specific details, giving programs direct access to the hardware resources.

They often allow programmers to write device-independent, high performance applications by providing standard operating system (OS) calls to hardware. The process of abstracting pieces of hardware is often done from the perspective of a CPU. Each type of CPU has a specific instruction set architecture or ISA. The ISA represents the primitive operations of the machine that are available for use by assembly programmers and compiler writers. One of the main functions of a compiler is to allow a programmer to write an algorithm in a high-level language without having to care about CPU-specific instructions. Then it is the job of the compiler to generate a CPU-specific executable. The same type of abstraction is made in operating systems, but OS APIs now represent the primitive operations of the machine, rather than an ISA. This allows a programmer to use OS-level operations (e.g. task creation/deletion) in their programs while retaining portability over a variety of different platforms.

Instrument Driver

An instrument driver, in the context of test and measurement (T&M) application development, is a set of software routines that simplifies remote instrument control. Instrument drivers are specified by the IVI Foundation and define an I/O abstraction layer using the virtual instrument software architecture (VISA). The VISA hardware abstraction layer provides an interface-independent communication channel to T&M instruments. Furthermore, the instrument drivers encapsulate the Standard Commands for Programmable Instruments (SCPI) commands, which are an ASCII-based set of commands for reading and writing instrument settings and measurement data. This standard allows an abstract way of using various programming languages to program remote-control applications instead of using SCPI commands. An instrument driver usually has a well-defined API.

JWt (Java web toolkit)

JWt (pronounced "jay-witty") is an open-source widget-centric web application framework for the Java programming language developed by Emweb. It has an API that uses established GUI application development patterns. The programming model is component-based and event-driven, similar to Swing.

The goal of the library is to benefit from the stateful component model used in desktop applications APIs, applied to web development, instead of the traditional model–view–controller (MVC) model. Rather than using MVC at the level of a page, MVC is pushed to the level of individual components.

While the library uses a desktop application development model, it does support web-specific features including semantic URLs, browser history navigation support, internationalization, themes and styling, ...

A unique feature of the library is its abstraction layer of the browser rendering model. The library uses Ajax for communicating with Ajax-capable browsers, while using plain HTML form post-backs for other user agents (for accessibility and search engines). Using a progressive bootstrap method, the user interface is initially rendered as plain HTML, and for Ajax-capable browsers, it is automatically upgraded to use Ajax for increased interactivity. In this way, it is the only server-side framework that implements progressive enhancement automatically, and the only Ajax framework with search engine optimization (SEO) qualities.JWt is distributed as a jar file. A JWt application is a war file that is deployed in a standards-compliant servlet container.

Linux framebuffer

The Linux framebuffer (fbdev) is a graphic hardware-independent abstraction layer to show graphics on a computer monitor, typically on the console. The word framebuffer means a part of video memory containing a current video frame, and the Linux framebuffer means “access method to the framebuffer under the Linux kernel”, without relying on system-specific libraries such as SVGALib or another user space software.

Message Abstraction Layer

The Spacecraft Monitoring & Control (SM&C) Working Group of the Consultative Committee for Space Data Systems (CCSDS), which sees the active participation of 10 space agencies and of the Space Domain Task Force of the Object Management Group (OMG), is defining a service-oriented architecture consisting of a set of standard end-to-end services between functions resident on board a spacecraft or based on the ground, that are responsible for mission operations.

The CCSDS Message Abstraction Layer (MAL) provides message abstraction and generic service patterns to the Mission Operation (MO) services defined in the CCSDS Mission Operations Services Concept.

Microsoft CryptoAPI

The Microsoft windows platform specific Cryptographic Application Programming Interface (also known variously as CryptoAPI, Microsoft Cryptography API, MS-CAPI or simply CAPI) is an application programming interface included with Microsoft Windows operating systems that provides services to enable developers to secure Windows-based applications using cryptography. It is a set of dynamically linked libraries that provides an abstraction layer which isolates programmers from the code used to encrypt the data. The Crypto API was first introduced in Windows NT 4.0 and enhanced in subsequent versions.

CryptoAPI supports both public-key and symmetric key cryptography, though persistent symmetric keys are not supported. It includes functionality for encrypting and decrypting data and for authentication using digital certificates. It also includes a cryptographically secure pseudorandom number generator function CryptGenRandom.

CryptoAPI works with a number of CSPs (Cryptographic Service Providers) installed on the machine. CSPs are the modules that do the actual work of encoding and decoding data by performing the cryptographic functions. Vendors of HSMs may supply a CSP which works with their hardware.

Network Abstraction Layer

The Network Abstraction Layer (NAL) is a part of the H.264/AVC and HEVC video coding standards. The main goal of the NAL is the provision of a "network-friendly" video representation addressing "conversational" (video telephony) and "non conversational" (storage, broadcast, or streaming) applications. NAL has achieved a significant improvement in application flexibility relative to prior video coding standards.

OPAL (software)

The Open Physics Abstraction Layer (OPAL) is an open source realtime physics engine API similar to PAL. It is currently supported only by ODE, but can be extended to run off of other engines. OPAL is free software, released under both the LGPL and the BSD license. It was originally designed and written by Tyler Streeter, Andres Reinot, and Alan Fischer while working at Iowa State University's Virtual Reality Applications Center (VRAC).

OPAL is a high-level interface for low-level physics engines used in games, robotics simulations, and other 3D applications. Features a simple C++ API, intuitive objects (e.g. Solids, Joints, Motors, Sensors), and XML-based file storage for complex objects.

The latest version of OPAL is 0.4.0. On June 23, 2010, OPAL development officially ended.

Operating system abstraction layer

An operating system abstraction layer (OSAL) provides an application programming interface (API) to an abstract operating system making it easier and quicker to develop code for multiple software or hardware platforms.

OS abstraction layers deal with presenting an abstraction of the common system functionality that is offered by any Operating system by the means of providing meaningful and easy to use Wrapper functions that in turn encapsulate the system functions offered by the OS to which the code needs porting. A well designed OSAL provides implementations of an API for several real-time operating systems (such as vxWorks, eCos, RTLinux, RTEMS). Implementations may also be provided for non real-time operating systems, allowing the abstracted software to be developed and tested in a developer friendly desktop environment.

In addition to the OS APIs, the OS Abstraction Layer project may also provide a hardware abstraction layer, designed to provide a portable interface to hardware devices such as memory, I/O ports, and non-volatile memory. To facilitate the use of these APIs, OSALs generally include a directory structure and build automation (e.g., set of makefiles) to facilitate building a project for a particular OS and hardware platform.

Implementing projects using OSALs allows for development of portable embedded system software that is independent of a particular real-time operating system. It also allows for embedded system software to be developed and tested on desktop workstations, providing a shorter development and debug time.

Physics Abstraction Layer

The Physics Abstraction Layer (PAL) is an open-source cross-platform physical simulation API abstraction system. It is similar to a physics engine wrapper, however it is far more flexible providing extended abilities. PAL is free software, released under the BSD license.

PAL is a high-level interface for low-level physics engines used in games, simulation systems, and other 3D applications. It supports a number of dynamic simulation methodologies, including rigid body, liquids, soft body, ragdoll, and vehicle dynamics. PAL features a simple C++ API and intuitive objects (e.g. Solids, Joints, Actuators, Sensors, and Materials). It also features COLLADA, Scythe Physics Editor, and XML-based file storage.

The Physics Abstraction Layer provides a number of benefits over directly using a physics engine:

Flexibility – It allows developers to switch between different physics engines to see which engine provides their needs, as well as quickly testing a new engine.

Portable – Developers are able to use the physics engine which provides the best performance for different platforms, and are able to write platform independent code.

Security – If a middleware provider is acquired by another company or development is discontinued, developers can switch engines.

Scalable – The abstraction layer allows developers to run their code on handheld console platforms up to supercomputers.

Ease of use – Implementation details of the physics engine are abstracted, providing a cleaner interface to the developer.

Benchmarking – Researchers can directly compare the performance of various dynamic simulations systems.PAL is designed with a pluggable abstract factory allowing code to be written and compiled once and allowing runtime selection of different physics engines, as well as feature upgrades.

Query Abstraction Layer

QAL is an open source development project that aims to create a collection of libraries for mixing, moving, merging, substituting and transforming data; also in some cases, such as MongoDB, schemas.

Sources and destinations include different database backends, file formats like .csv, XML and spreadsheets. Even untidy HTML web pages can be used as both a source and destination.

For SQL/RDBMS backends, it has a database abstraction layer that supports basic connectivity to Postgres, MySQL / MariaDB, DB2, Oracle and MS SQL Server. It uses XML formats (the SQL schema is self-generated) for representation of queries, transformation and merging, making it all processable by scripts.

With regards to SQL, QAL uses a subset of SQL features and data types, which while obviously not complete however is sufficient for most usages. It is however easy to instead use backend-specific SQL when the queries do not have to be backend-agnostic.

It is currently distributed as a Python Library (.egg) and a Debian package file (.deb).It is related to the Optimal BPM (Business Process Management) project. The Optimal BPM SourceForge project used to be DAL/QAL.

Service locator pattern

The service locator pattern is a design pattern used in software development to encapsulate the processes involved in obtaining a service with a strong abstraction layer. This pattern uses a central registry known as the "service locator", which on request returns the information necessary to perform a certain task. The main criticism of service location is that it obscures dependencies. Meanwhile, its proponents say the approach should not be discarded as it simplifies component-based applications where all dependencies are cleanly listed at the beginning of the whole application design, consequently making traditional dependency injection a more complex way of connecting objects. The usual criticism of service locator pattern as being the one which is "much harder to test" actually becomes a benefit in such applications.

This page is based on a Wikipedia article written by authors (here).
Text is available under the CC BY-SA 3.0 license; additional terms may apply.
Images, videos and audio are available under their respective licenses.