Lesson 2 - Programming Paradigms
Lesson 2 - Programming Paradigms
1.12. Introduction
In our last lesson we introduced programming concepts like program, programmer, bug, syntax
among others as well as program development life cycle. In our lesson today we will be discussing
programming paradigms. Paradigm refers to a way of organizing thoughts. Programming paradigm in
particular refers to basic structuring of thoughts underlying the programming activity. There are four
basic programming paradigms: Imperative, functional, object oriented and logic paradigms.
Advantages
[i]. The high level of abstraction which results into fewer errors.
[ii]. Not dependent on assignment operations, allowing programs to be evaluated in many
different orders.
[iii].More amenable to mathematical proof and analysis.
Disadvantages
[i]. Less efficient
[ii]. Not useful for problems involving many variables or a lot of sequential activity.
1.17. Object oriented paradigms
Programming involves use of objects and how the communicate using messages.
[i]. Based on the theory of concepts, and models of human interaction with real world
phenomena.
[ii]. Data as well as operations are encapsulated in objects
[iii]. Information hiding is used to protect internal properties of an object
[iv]. Objects interact by means of message passing
[v]. In most object-oriented languages objects are grouped in classes.
[vi]. Provides for class extension or specialization
Advantages
[i]. Allows inheritance and hence code reuse
DIT 305: PROGRAMMING METHODOLOGY
Programming involves answering questions through search for solutions. The logic paradigm fits
extremely well when applied in problem domains that deal with the extraction of knowledge from basic
facts and relations.
[i]. Based on automatic proofs within artificial intelligence
[ii]. Based on axioms, inference rules, and queries.
[iii].Program execution becomes a systematic search in a set of facts, making use of a set of
inference rules Advantages
[i]. Good support for reasoning about programs [ii].
Can lead to concise solutions to problems
Disadvantages
[i]. Difficult to see what is actually happening computationally
[ii]. Slow execution
[iii].Difficulties in understanding and debugging large programs.
1.22. Summary
In this lesson we have discussed the four programming paradigms. We have learnt that Paradigm
refers to a way of organizing thoughts. Programming paradigm in particular refers to basic structuring of
thoughts underlying the programming activity. There are four basic programming paradigms:
Imperative, functional, object oriented and logic paradigms.
1.23. Suggested reading
DIT 305: PROGRAMMING METHODOLOGY
[1]. An introduction to programming by Wu Thomas, Norman and Theodore: McGrill (1997). [2]. C
programming language by Brian W. Kernighan, Dennis Ritchie, 2nd ed: prentice hall(2003).
[3]. http://people.cs.aau.dk/~normark/prog3-03/html/notes/paradigms_themes-paradigm-overview-
section.html
[4]. http://larch.cs.iastate.edu/ComS541Fall97/hw-pages/paradigms/major.html
[5].C how to program by H.M. Deitel and P.J.Deitel, 3 rd ed: Prentice hall(2001).