A software abstraction is computer code or software that conceptually represents something and provides access to functionality and/or data. Two fundamental benefits of abstractions:
Example An example of an abstraction is a button in a software application for opening files. The "open file" button is an abstraction because it represents functionality for opening files and provides access to functionality for opening files. Multiple "open file" buttons could exist in different places in a software application and each button could access and use a single implementation for opening files. Someone using the "open file" button would not need to know many technical details of opening a file. Generality of Abstractions Abstractions exist on a scale from very specific to very general. An "open csv file from usb drive" button is a fairly specific abstraction. An "open file" button is a more general abstraction. General abstractions provide access to multiple possible implementations of functionality. A specific implementation of functionality will be used depending on the circumstances. Think about the different places a file can exist: it can exist on a hard drive, on a USB Drive, on a DVD, on a network drive. The technical specifics for opening a file are different for each physical medium. The "open file" button provides a single general interface to users and handles the varying specifics of opening files. In reality the "open file" button is likely to call an "open file" abstraction provided by the operating system. It is the operating system's abstraction that will access the implementation to open files. Abstractions in Programming Languages Programming languages provide many tools of abstraction: functions, objects, methods, properties, variables, types, classes, interfaces, modules, libraries and more. Programmers use abstractions to prevent code duplication, add flexibility and extensibility, and to reduce complexity. Abstractions often use other abstractions, creating layers of abstractions. Programmers assign descriptive names to abstractions to help describe programs, making them easier to read and understand.
0 Comments
Leave a Reply. |
AuthorNick Mudge See our blogs here
http://blog.perfectabstractions.com Links
Archives
March 2017
Categories
All
|