Abstraction, Syntax, and Semantics in Software Design
Classified in Computers
Written on in
English with a size of 3.51 KB
What is Abstraction? Types and Principles
Abstraction is a mental process involving the understanding of phenomena or situations that involve many details. It consists of two key aspects:
- Highlighting the most relevant details of the object under study.
- Ignoring irrelevant details of the object (at that specific level of abstraction).
Abstraction is fundamental for designing programs that are shorter, readable, easy to maintain, and reliable—i.e., quality software.
Programming languages are the tools used by programmers to implement these abstract models. Abstraction in programming is typically divided into two types:
- Operational Abstraction: It is based on the use of procedures and/or functions without worrying about how they are implemented. It focuses on what the operation does, not how it achieves it.
- Data Abstraction: This is the programming technique that allows you to invent or define new data types appropriate to the desired application (Abstract Data Types).
Semantic Specification in Abstract Data Types
The semantic specification is a set of guidelines that expresses the meaning of each of the operations of an Abstract Data Type (ADT). It can be expressed in several ways:
- Using natural language (although this may result in ambiguity).
- Using an algebraic language, which provides a set of axioms that verify operations associated with the objects in question.
- Using abstract models (where we define the domain and the operations of a type).
In any case, semantics are often defined using preconditions and postconditions. The operation can be performed only upon the fulfillment of the preconditions, and the postconditions must be met after the execution of the operation.
Behavioral Definition (Test Scenario)
The semantic specification, often represented by a test scenario, defines the behavior of each method specified in the syntactic specification, including the values or results they must yield upon each invocation executed on an instance of the ADT.
Defining Syntactic Specification (ADT Interface)
The syntactic specification is a series of rules that determine how to write operations, defining the order and type of operands and the result. It refers to the formal definition of all valid procedures or methods that can uniquely access the data elements or structure of the Abstract Data Type (ADT).
The set of methods defined by the syntactic specification can be classified as follows:
Default Constructor
Initializes the instance with static values defined by the user code. It allocates main memory for the instance.
Parametric Constructor
Initializes the instance with values supplied by the user via parameters.
Access Method (Observer/Consultant)
Accesses the values stored in each of the data components that make up the ADT.
Processing Method (Mutator/Modifier)
Allows you to modify and alter the current contents of the components of the ADT.
Destructor Method
Frees the memory occupied by an instance of the ADT, releasing main memory.
These methods generally fall into categories such as creative (constructors), consultant/accessor, destructive (destructors), and modifier (mutators) operations.