Chapter Goals
Generalities
Procedures, modules and classes
Other concepts
Exercises
Programming Language
Program Structure
MESSI NGUELE Thomas (PhD)
Yaoundé, May 11th 2024
May 11th 2024, Dr.Thomas MESSI NGUELE Programming Languages – Program Structure 1 / 16
Chapter Goals
Generalities
Procedures, modules and classes
Other concepts
Exercises
Chapter Goals
1 Define procedure, module, class
2 Give the difference between independent compilation and separate
compilation.
May 11th 2024, Dr.Thomas MESSI NGUELE Programming Languages – Program Structure 2 / 16
Chapter Goals
Generalities
Procedures, modules and classes
Other concepts
Exercises
Agenda
1 Chapter Goals
2 Generalities
3 Procedures, modules and classes
4 Other concepts
5 Exercises
May 11th 2024, Dr.Thomas MESSI NGUELE Programming Languages – Program Structure 3 / 16
Chapter Goals
Generalities
Procedures, modules and classes
Other concepts
Exercises
Agenda
1 Chapter Goals
2 Generalities
3 Procedures, modules and classes
4 Other concepts
5 Exercises
May 11th 2024, Dr.Thomas MESSI NGUELE Programming Languages – Program Structure 4 / 16
Chapter Goals
Generalities
Procedures, modules and classes
Other concepts
Exercises
Generalities
1 Chapter 3 looked at the scope rules governing the visibility of identifiers
within a module.
2 This chapter looks at inter-module visibility.
3 Originally, program design concentrated on algorithms
Sequence of operations or procedures required to carry out a problem.
But it becomes hard when dealing with complex problem.
4 They are two main approaches to design programs :
Procedural approach.
Object-oriented approach.
May 11th 2024, Dr.Thomas MESSI NGUELE Programming Languages – Program Structure 5 / 16
Chapter Goals
Generalities Procedures
Procedures, modules and classes Modules
Other concepts Classes
Exercises
Agenda
1 Chapter Goals
2 Generalities
3 Procedures, modules and classes
Procedures
Modules
Classes
4 Other concepts
5 Exercises
May 11th 2024, Dr.Thomas MESSI NGUELE Programming Languages – Program Structure 6 / 16
Chapter Goals
Generalities Procedures
Procedures, modules and classes Modules
Other concepts Classes
Exercises
Procedure
1 Procedure is a mayor abstraction mechanism.
2 It encapsulates a series of program instructions that are hidden from the user.
3 The signature of the procedure (its name and parameters) provides a small
well-defined public interface through which the user can make a procedure
call and cause the hidden instructions to be executed.
4 The are too small a unit for structuring large Programs.
5 Examples : Pascal, C.
May 11th 2024, Dr.Thomas MESSI NGUELE Programming Languages – Program Structure 7 / 16
Chapter Goals
Generalities Procedures
Procedures, modules and classes Modules
Other concepts Classes
Exercises
Modules
1 A development of the procedural approach is to have modules in which
groups of related procedures and type definitions can be encapsulated.
2 Modules have :
a public interface which gives the information than may be seen and used from
outside the module
a private implementation part whose details are hidden.
3 Modules allow a large system to be designed by specifying what each module
is to and what its interface with the rest of the system is to be.
4 Different programmers may then implement each of the modules with any
need for consultation.
May 11th 2024, Dr.Thomas MESSI NGUELE Programming Languages – Program Structure 8 / 16
Chapter Goals
Generalities Procedures
Procedures, modules and classes Modules
Other concepts Classes
Exercises
Classes
1 In object oriented languages, a module is a class.
2 An object is an instance of a class. A class is defined by :
The attributes of an object.
The services (operations) offered to other objects.
The behavious of an object when one of its services is called.
3 An object-oriented program consists of a set of class definitions.
4 Examles : Java, C++.
May 11th 2024, Dr.Thomas MESSI NGUELE Programming Languages – Program Structure 9 / 16
Chapter Goals
Generalities
Procedures, modules and classes
Other concepts
Exercises
Agenda
1 Chapter Goals
2 Generalities
3 Procedures, modules and classes
4 Other concepts
5 Exercises
May 11th 2024, Dr.Thomas MESSI NGUELE Programming Languages – Program Structure 10 / 16
Chapter Goals
Generalities
Procedures, modules and classes
Other concepts
Exercises
Other concepts
1 An abstract data type consist of hidding the implementation of the type from
its users who only see the type name and the allowed operations.
2 Independent compilation : This is when subprograms do not depends on one
another and can be then compiled independent. (See fig 5.1)
3 Block-structured languages (see fig 5.2)
4 Separate Compilation : We want to ensure that a change in one subprogram
does not necessitate the recompilation of all other subprograms, while if the
system is to be secure and reliable, it is important to have full type checking.
See fig 5.5, fig 5.6, fig 5.7
May 11th 2024, Dr.Thomas MESSI NGUELE Programming Languages – Program Structure 11 / 16
Chapter Goals
Generalities
Procedures, modules and classes
Other concepts
Exercises
Agenda
1 Chapter Goals
2 Generalities
3 Procedures, modules and classes
4 Other concepts
5 Exercises
May 11th 2024, Dr.Thomas MESSI NGUELE Programming Languages – Program Structure 12 / 16
Chapter Goals
Generalities
Procedures, modules and classes
Other concepts
Exercises
Exercises
17 - Subprograms in early versions of Fortran can be compiled independently of
one another. Pascal procedures and functions may be nested, but cannot be
compiled independently. Discuss the advantages and disadvantages of these
two approaches and any possible compromises between the two.
18 - Compare the approach to type checking across subprogram boundaries
adopted in Fortran, Pascal, C++ and Ada.
19 - Compare the program structure of C, Pascal, C++ and Java. Do these
programming language have closer feature ?
May 11th 2024, Dr.Thomas MESSI NGUELE Programming Languages – Program Structure 13 / 16
Chapter Goals
Generalities
Procedures, modules and classes
Other concepts
Exercises
Exercises
20 - Large programs are usually implemented as separated modules. In early
languages, subprograms were used as modules. What were the deficiencies of
this approach ?
21 - What is meant by information hiding and why is it important in the
construction of large programming systems.
22 - Distinguish between independent and separate compilation.
23 - What are the essential features of an abstract data type ? Give if possible,
language facilities to support the implementation of abstract data types in C,
Pascal, C++, Java.
May 11th 2024, Dr.Thomas MESSI NGUELE Programming Languages – Program Structure 14 / 16
Chapter Goals
Generalities
Procedures, modules and classes
Other concepts
Exercises
Bibliography
WILSON, Leslie B. et CLARK, Robert George. Comparative programming
languages. Pearson Education, 2001.
MACLENNAN, Bruce J. Principles of programming languages : design,
evaluation, and implementation. Holt, Rinehart & Winston, 1986.
May 11th 2024, Dr.Thomas MESSI NGUELE Programming Languages – Program Structure 15 / 16
Chapter Goals
Generalities
Procedures, modules and classes
Other concepts
Exercises
May 11th 2024, Dr.Thomas MESSI NGUELE Programming Languages – Program Structure 16 / 16