Fundamental Concepts in Software Design

Fundamental concepts of Software design include Abstraction, Structure, Information hiding, Modularity, Concurrency and Verification.

  1. Abstraction – Abstraction is the intellectual tool which enables us to separate the conceptual aspects of the System. For eg: we may specify the FIFO property of a source or stack and functional characteristics of the routines (new, push, pop, top, empty) without concern for the algorithmic details of the routine. The 3 types of abstraction mechanisms used are Functional abstraction, Data abstraction, Control abstraction.
    • Functional Abstraction – Functional abstraction involves the use of parameterized subprograms. Functional abstraction allows to bind different parameter values on different invocations of the subprogram. Functional abstraction can be generalized to collections of subprograms called groups which may be visible or hidden.
    • Data abstraction or Abstract data hiding – Data abstraction involves specifying a data type or a data object by specifying legal operation on objects, representation and manipulation details are suppressed. Thus, we may define the type ‘stack’ abstractly as a LIFO mechanism in which the routines New, Push, Pop, Top and Empty are defined abstractly. The term abstract data type is used to denote declaration of a datatype or object like ‘stack’ from which numerous instances can be created.

In object oriented languages like C++, we may implement the abstract data typing using class abstractions. Classes in C++ are logical abstractions of a particular data type (eg: stack) from which numerous instances of stack objects may be created. Such an abstract data type declaration for the stack data type implemented in C++ is as shown below –

# define MAXSIZE 100
Class Stack {
              Private:
                  int stk[MAXSIZE];
                  int stk top;
              Public:
                  void initialize();
                  void push(int i);
                  int pop();
                  int empty(stack s);
         }stack1, stack2;

.......

stack1.init();
stack2.init();
stack1.push(4);
stack2.push(5);
stack2.pop();
stack1.pop();
B = empty(stack1);

As shown above, the data type ‘stack’ is defined abstractly within class ‘stack’. Its data attributes are detailed in the private part and its functions are declared in the public part. In such a method of abstract data-typing, the representation details of the data items and implementation details of the functions that manipulate the data items are hidden within the group that implements the abstract type ‘stack’. Only the objects defined of the type ‘ ‘stack’ (stack1, stack2) can access the internal details of the abstract type ‘stack’ via the public functions. No other groups (data items or objects) are allowed to do so.

Other advantages of such abstract data typing is that it enables to represent the data object at various level of abstraction, implement data encapsulation, polymorphism by virtual function, abstract classes and concrete classes.

2. Information Hiding – While using information hiding approach, each module/function in the system hides the internal details of its processing activities and modules communicate only through well-defined interfaces. Information hiding may be applied to hide –

  • Data structure, Internal linkage and the implementation details of the classes/interfaces that manipulate it
  • The format of central blocks such as queues in an Operating System
  • Character codes and their implementation details
  • Shifting, masking and other machine dependent details

3. Structure – Structure is a fundamental characteristic of computer software and its most general form the Network structure. A computing network can be represented as a directed graph consisting of nodes and arcs. The nodes representing the processing elements that transforms data and the arcs can be used to represent data links between nodes. Also, nodes can represent data stores and the arcs data transformations.

In its simplest form, a network may specify data flow and processing steps within a single subprogram or data flow among a collection of sequential subprograms. The process network view of software structures is as shown below –

 

As shown above, the Network consists of Nodes and Links. The Network consists of concurrently and sequentially executing process involved in synchronous or asynchronous message passing. Each process consists of various groups or objects and various processing routines. Each group consists of visible part, static area and hidden part which refers to its representation details.

4. Modularity – Modularity refers to the desirable property of software to be represented as modules or classes or interfaces each having operational characteristics that could be reused in different locations of software so we can reduce code duplication and reduce code dependency when a huge amount of code need to be modified when something changes. For eg:, we may save a set of code as a function/method, a group of similar functions/methods as a compiled module (like the Header .H files in C) or the VehicleControllers.class in C#. Also similar classes/interfaces may be compiled as an assembly or a set of modules can be compiled as a software package or a Visual Studio project file or as .PRJ files as in C programming.

Modularity enhances design clarity and eases implementation, debugging, testing, documentation, debugging, testing, documentation and maintenance of the Software product. Some of the desirable properties of a modular Software System include – 

  • Each processing abstraction should be well defined so that it may be applicable in various situations.
  • Each function/method in each abstraction has well defined purpose
  • Each function/method manipulates no more than one major data structure
  • Functions/methods those share global data structures selectively may be grouped together
  • Functions/methods that manipulate instances of abstract data types are encapsulated with the data structure being manipulated.

5. Modularization criteria – There are various modularization criteria to represent the Software as modules and depending on the criteria, various system structures may result. Various modularization criteria include – 

  •  Conventional criteria refers to modularization in which each module and its submodules correspond to a processing step in the program execution sequence.
  •  Information hiding criteria refers to modularization in which each module hides a difficult or changeable design decision from other modules.
  • Data abstraction criterion refers to modularization in which each modules hides the representation details of major data structure behind functions that access and modify the data structure.
  • Levels of abstraction in which modules and collections of modules provide a hierarchical set of increasingly complex services.
  • Coupling and Cohesion in which a system is structured to maximize the cohesion of elements in each modules and to minimize the coupling between modules.
  • Problem Modelling in which the modular structure of the system matches the structure of problem being solved.

6. Concurrency – Concurrent processes are those processes executing concurrently or in parallel utilizing the concurrent and scheduling mechanism of the processor. Like concurrent processes, we may implement concurrent threads or code segments of execution which may execute concurrently utilizing the concurrent processing power of the processor and the concurrency mechanism of the programming language used (eg: C#, Java).

7. Coupling and Cohesion – Coupling and Cohesion are applied to support the fundamental goal of software design to structure the Software product so that the number and complexity of interconnections between various modules and classes is minimized.

  • Coupling – Coupling is defined between two modules and it relates to the degree of linkage between the coupled module s. The strength of coupling between two module is influenced by the complexity of the interface, type of connection and type of communication. If all modules communicate only by parameter passing, then the internal details of the modules can be modified without modifying the functions used in each modules. Module references by their content is stronger than those by modules names and in the former case, the entire content will have to be taken into account while referring to it. Communication between modules involves passing of data, passing elements of control like flags, events, switches, labels, objects etc and modification of one module/interface’s code by another. The degree of coupling is highest for modules that modify other modules, higher for control communication and lowest for data communication system. The major types of coupling are as follows –

              – Content Coupling – Occurs when one module modifies local data values or instructions in another modules and usually occurs in assembly language programs.

              – Common Coupling – Occurs when a set of routines reference a common data block.

              – Stamp Coupling – Stamp coupling is similar to common coupling except that the global data items are shared collectively among the routines. Stamp coupling is more desirable than common coupling since fewer modules will have to be modified if a shared data structure is modified.

             – Data coupling – involves the use of parameters lists to pass data items between routines.

       The most desirable form of coupling between modules is combination of Stamp and Data coupling.

  • Cohesion – Cohesion or internal Cohesion between two modules is measured in terms of the strength of binding of elements within the module. The following are the various cohesion mechanisms –

           – Coincidental Cohesion – occurs when the elements with a module have no apparent relationship to one another

           – Logical Cohesion – refers to some relationship among the elements of the module such as those perform all input / output operation or those edit or validate data. Logically bound modules often combines several related functions in a complex and interrelated fashion.

           – Temporal Cohesion – forms complex connections as logical cohesion but are on the higher scale of binding since all elements are executed at one time and no parameter logic are required to determine which elements to execute such as in the case of a module performing program initialization.

           – Communicational Cohesion -refers to same set of input / output data and the binding is higher on the binding scale than temporal binding since the elements are executed at one time and also refer to the same data.

           – Sequential Cohesion – occurs when the output of one element is the input of another element. Sequential cohesion has higher binding levels since the module structure usually represents the problem structure.

           – Functional Cohesion – is a situation in which every elements function towards the performance of a single method such as in the case of data elements of a method performing sqrt().

           – Informational Cohesion – of elements in a module occurs when a complex data structure manipulated by several routines in that module. Also each routine in the module exhibits functional binding.

Add a Comment

Your email address will not be published. Required fields are marked *