FACTOID # 112: Don't start a company in Australia. More than 20% of the tax collected in Australia is corporate income tax.
 
 Home   Encyclopedia   Statistics   Countries A-Z   Flags   Maps   Education   Forum   FAQ   About 
 
 
 
WHAT'S NEW
RECENT ARTICLES
More Recent Articles »
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Abstract base class

In software engineering, an abstract type is a type in a nominative type system which is declared by the programmer, and which has the property that it contains no members which are not also members of some declared subtype. In many object oriented programming languages, abstract types are known as abstract base classes, interfaces, traits, mixins, flavors, or roles. Note that these names refer to different language constructs which are (or may be) used to implement abstract types. Software Engineering (SE) is the design, development, and documentation of software by applying technologies and practices from computer science, project management, engineering, application domains, interface design, digital asset management and other fields. ... A nominative type system is a major classes of type system, in which type compatibility and equivalence is determined by explicit declarations and/or the name of the types. ... In computer science, a subtype is a datatype that is generally related to another datatype (the supertype) by some notion of substitutability, meaning that computer programs written to operate on elements of the supertype can also operate on elements of the subtype. ... In computer science, object-oriented programming, OOP for short, is a computer programming paradigm. ...

Contents

Signifying abstract types

Abstract classes can be created, signified, or simulated in several ways:

  • By use of the explicit keyword abstract in the class definition, as in Java.
  • By including, in the class definition, one or more methods (called pure virtual functions in C++); methods which the class is declared to accept as part of its protocol, but for which no implementation is provided.
  • By inheriting from an abstract type, and not overriding all missing features necessary to complete the class definition.
  • In many dynamically typed languages such as Smalltalk, any class which sends a particular method to this, but doesn't implement that method, can be considered abstract. (However, in many such languages, the error is not detected until the class is used, and the message send results in an error such as doesNotUnderstand).

Used mainly in object-oriented programming, the term method refers to a piece of code that is exclusively associated either with a class (called class methods or static methods) or with an object (called instance methods). ... C++ (pronounced see plus plus, IPA: ) is a general-purpose, high-level programming language with low-level facilities. ... In object-oriented programming, inheritance is a way to form new classes (instances of which are called objects) using classes that have already been defined. ... Smalltalk is an object-oriented, dynamically typed, reflective programming language. ... In many object-oriented programming languages, this (or self) is a keyword which is used to refer to the object on which the currently executing method has been invoked. ...

Use of abstract types

Abstract types are an important feature in statically typed OO languages. They do not occur in languages without subtyping. Many dynamically typed languages have no equivalent feature (although the use of duck typing makes abstract types unnecessary); however traits are found in some modern dynamically-typed languages. On computer science, a datatype (often simply type) is a name or label for a set of values and some operations which can be performed on that set of values. ... On computer science, a datatype (often simply type) is a name or label for a set of values and some operations which can be performed on that set of values. ... In computer science, duck typing is a form of dynamic typing in which a variables value itself implicitly determines what the variable can do. ...


Many authors argue that classes should be leaf classes (have no subtypes), or else be abstract. In class-based object-oriented programming languages, a leaf class is a class that should not be subclassed. ...


Abstract types are useful in that they can be used to define and enforce a protocol; a set of operations which all objects that implement the protocol must support. The fact that many languages disallow instantiation of abstract types (and force subtypes to implement all needed functionality) further ensures program correctness. In computer sciences object-oriented programming, a protocol (Java: interface) is what or how unrelated objects use to communicate with each other. ... Instantiation is the process of creating a specific object (computing) which is a member or instance of a class (computing). ...


Types of abstract types

There are several mechanisms for creating abstract types, which vary based on their capability.

  • Full abstract base classes--classes either explicitly declared to be abstract, or which contain abstract (unimplemented) methods, have the same capabilities (apart from instantiation) as a concrete class or type. Full abstract types were present in the earliest versions of C++; and the abstract base class remains the only language construct for generating abstract types in C++.

Due to technical issues with multiple inheritance in C++ and other languages; many OO languages sought to restrict inheritance to a single direct base class. In order to support multiple subtyping, several languages added other features which can be used to create abstract types, but with less power than full-blown classes. C++ (pronounced see plus plus, IPA: ) is a general-purpose, high-level programming language with low-level facilities. ... Multiple inheritance refers to a feature of object-oriented programming languages in which a class can inherit behaviors and features from more than one superclass. ... In computer science, a subtype states that if given type A is compatible with type B, then A is a subtype of B while not always vice versa. ...

  • Java includes interfaces, an abstract type which may contain method signatures and constants (final variables), but no method implementations or non-final data members. Whereas a class in Java may have inherit from (extend) a single base class; Java classes may implement multiple interfaces.
  • Traits are a more recent approach to the problem, found in Scala and Perl 6 (there known as roles), and proposed as an extension to Smalltalk (wherein the original implementation was developed). Traits are unrestricted in what they include in their definition, and multiple traits may be composed into a class definition. However, the composition rules for traits differ from standard inheritance, to avoid the semantic difficulties often associated with multiple inheritance.

The Common Lisp Object System (CLOS) is the facility for object-oriented programming which is part of Common Lisp (CL). ... In object-oriented programming languages, a mixin is an approach to implementing classes that differs from the most widely-used approach coming from the programming language Simula. ... Flavors, an early object-oriented extension to Lisp developed by Howard Cannon at the MIT Artificial Intelligence Laboratory for the Lisp machine, was the first programming language to include mixins. ... David A. Moon is a programmer and computer scientist, well known for his work on the Lisp programming language and related topics. ... Lisp Machine Lisp is a dialect of the Lisp programming language, a direct descendant of MacLisp, and was initially developed in the mid to late 1970s as the systems programming language for the MIT Lisp machines. ... In certain systems for object-oriented programming such as the Common Lisp Object System and Dylan, a generic function is an entity made up of all methods having the same name. ... Used mainly in object-oriented programming, the term method refers to a piece of code that is exclusively associated either with a class (called class methods or static methods) or with an object (called instance methods). ... Java is an object-oriented programming language developed by James Gosling and colleagues at Sun Microsystems in the early 1990s. ... lkfnfj cdac ... Traits are a type of abstract type, used as a simple conceptual model for structuring object oriented programs. ... Scala is a multi-paradigm programming language designed to express common programming patterns in a concise, elegant, and type-safe way. ... Perl 6 is a new major revision of the Perl programming language. ... Smalltalk is an object-oriented, dynamically typed, reflective programming language. ...

External links

  • Types and Programming Languages by Benjamin Pierce (MIT Press 2002) [1]
  • More Effective C++: 35 New Ways to Improve Your Programs and Designs by Scott Meyers (1995) ISBN 0-201-63371-X
  • Traits: Composable Units of Behavior by Nathanael Schärli, Stéphane Ducasse, Oscar Nierstrasz and Andrew Black


 
 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments

Want to know more?
Search encyclopedia, statistics and forums:

 


Lesson Plans | Student Area | Student FAQ | Reviews | Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms, 1022, m