Structuring the Program - Software Paradigms | CSCI 169, Study notes of Computer Science

Material Type: Notes; Professor: Bellaachia; Class: Software Paradigms; Subject: Computer Science; University: George Washington University; Term: Unknown 2006;

Typology: Study notes

Pre 2010

Uploaded on 08/16/2009

koofers-user-z4e
koofers-user-z4e 🇺🇸

8 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Structuring the Program
1. Objectives...................................................................................2
2. Software Design Methods...........................................................3
3. Support of Modularity.................................................................4
4. Separating Interface and Implementation...................................5
5. Separate and Independent Compilation......................................6
6. Libraries of Modules...................................................................7
A. Bellaachia Page: 1
pf3
pf4
pf5

Partial preview of the text

Download Structuring the Program - Software Paradigms | CSCI 169 and more Study notes Computer Science in PDF only on Docsity!

Structuring the Program

    1. Objectives...................................................................................
    1. Software Design Methods...........................................................
    1. Support of Modularity.................................................................
    1. Separating Interface and Implementation...................................
    1. Separate and Independent Compilation......................................
    1. Libraries of Modules...................................................................

1. Objectives

 How to structure large programs?

 How to create large applications from small program

units?

 So far we have covered requirements for simple

program units (Dealing with programming in the small).

 What are the requirements for developing large

applications (programming in the large)?  Mechanisms for multiple logical units  Multiple programmers, and  Translating design into implementation.

 In many cases, the approaches that are used for small

programs do not scale up to solve large problems

 We can use abstraction and modularity to assist us:

Abstraction o Allows us to concentrate on the major, important aspects of the problem, and leave the details for later o During problem analysis, we discover and invent abstractions that allow us to understand the problem  Modularity o Allows us to build programming pieces that can be assembled to construct larger programs

 The implementation can change without affecting the clients

3. Support of Modularity

 How to support efficient modularization?

 Different languages use different techniques for

building modules  Class: C++, Java  Package: Ada, Modula-  Module: C, Pascal

 Module Relationship:

 A module is a server or service provider and the caller is the client.

 Encapsulation:

 A unit is said to encapsulate the service  Combine program components that are necessary to provide the service  Only make those aspects visible to clients that are required  Language mechanisms provide a means for information hiding

 A unit is clearly defined by two parts:

 The interface describes what services are exported by the module, and imported by the client

 The implementation describes the module’s internal structure that provide the service

 Example: A dictionary data structure

 Clients may store and retrieve pairs of the form <name, id>  Operations include o Inserting a pair <"Pat", 23> o Retrieving elements by supplying the string component "Pat" o Deleting a pair based on a string  Encapsulation helps to hide the implementation (array, linked list, etc.)  Language Example:  Built-in Types: o How float type is implemented  Java: o How vector or set data types are implemented?

4. Separating Interface and Implementation

 In order to use a module, we only need its interface and not its internal implementation.  This clean separation contributes to the independence of the module.

 Unit of compilation  Order of compilation  Amount of inter-module checking

6. Libraries of Modules

 To control the complexity of very large programs, libraries were introduced  Common modules that are used by many other modules can be grouped into standard libraries  –Avoid name clashes  Avoid the need to recompile when an unused part of a library changes