1 Introduction ProgrammingParadigm
1 Introduction ProgrammingParadigm
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 1
TOPIC LEARNING OUTCOMES
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 2
Contents & Structure
Programming paradigm
Definition
Programming paradigm categories
Imperative programming
Declarative programming (logic, data driven, functional)
Origin of functional programming
Why functional programming
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 3
Serial Computing
Parallel Computing
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 4
4. Computational speed
4.3 Introduction to space-time diagram
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 5
Change, change, change...
Change is always a fact of life.
Organizations under pressure to change and adapt.
To stay competitive, it must be agile.
The COVID-19 pandemic caused changes in regulatory policy, market uncertainty,
disruption of production and supply chains..
Changes in organizations policy and functionality.
Organization functionality change so are the underlying software.
Software to adapt swiftly and effectively to changes is a crucial factor that separates
successful organizations
CMM/CMMI Level 5: Optimizing, stress on organization capability to manage change
without defect in continuous process improvement to achieve organizational innovation
and deployment.
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 6
Change is tough
Huge costs in rework and interruptions for users of the software.
Affects how software is maintained and bang up to date.
Software maintenance is the task of modifying an existing software
systems to correct defects, improve performance or adapt it to the new
environment.
Without maintenance, systems would become rapidly out-of-date and
inefficient.
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 7
Software Maintenance
The Department of Defense (DoD) defines software maintenance in DoD Instruction
4151.20 as follows [USDAS 2018]:
Software Maintenance: Includes actions that change the software baseline (adaptive,
corrective, perfective, and preventative) as well as modification or upgrade that add
capability or functionality. Encompasses requirements development, architecture and
design, coding, and integration and test activities. Software maintenance and software
sustainment are considered synonymous.
Corrective sustainment activities diagnose and correct software errors after the
software is released.
Perfective sustainment activities consist of upgrades to software to support new
capabilities and functionality.
Adaptive sustainment activities modify software to interface with changing
environments.
Preventive sustainment activities modify software to improve future maintainability or
reliability.
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 8
Maintainability
Maintainability (maintenance effort) is the most time consuming part of software life
cycle which can range from 65% to 75% of total software development time.
ISO/IEC 25010 defines five components for the maintainability: analyzability,
modifiability, modularity, reusability and testability.
Here, we focus on the software analyzability and modifiability.
Analyzability covers assessing the impact of an intended change, diagnosing
deficiencies and failures, and identifying parts to be modified.
Modifiability covers work needs to be done to implement a modification and the steps
taken to make designs more adaptable and ease the implementation of changes that
improve maintainability.
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 9
Design principles in application design
In general, what we need is a programming paradigm that
encourages us to think carefully about our data and the functions
that interact with it. When considering the design of your application,
ask yourself the following questions based on these design
principles:
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 11
Programming paradigm explained
The focus is on programming concepts and techniques for using them, not programming
languages. These concepts are organized by model of computation. A computation model is a
formal system that defines how computations are done.
There are many ways to define a model of computation. To be directly useful to
programmers, it is defined in terms of concepts that are important to programmers: data types,
operations, and programming language. Programmers need programming techniques and
design principles implemented by computational models [2].
A programming paradigm is an approach to programming a computer based on a
mathematical theory or a coherent set of principles. Each paradigm supports a set of
concepts that makes it the best for a certain kind of problem [3].
Programming paradigms are different ways or styles in which a given program or
programming language can be organized. Each paradigm consists of certain structures,
features, and opinions about how common programming problems should be tackled.
Solving a programming problem requires choosing the right concepts. All but the smallest
toy problems require different sets of concepts for different parts. This is why programming
languages should support many paradigms. For example, object-oriented programming is best
for problems with a large number of related data abstractions organized in a hierarchy. Logic
programming is best for transforming or navigating complex symbolic structures according to
logical rules.
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 12
Programming paradigm explained - contd
Programming paradigms classify programming languages according to their features.
However, some languages may be classified into multiple paradigms – as is the case of
JavaScript itself!
A primary division is imperative versus declarative languages. In the former, developers
must instruct the machine on how to do its work, step by step. Programming may be
procedural (if instructions are grouped into procedures) or object-oriented (if instructions are
grouped with a related state).
In declarative languages, in opposition, developers just declare properties that the sought result
must satisfy, but not how to calculate it. Declarative languages may be logic-based (based on
logic rules and constraints), reactive (based on data and event streams), or functional (based
on the application and combination of functions). In a sense, we could say that imperative
languages focus on how, while declarative languages focus on what. [5]
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 13
Programming paradigm explained
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 14
[2,4]
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 15
Imperative programming paradigm
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 16
Imperative programming code examples
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 17
Declarative programming paradigm
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 18
Logic programming
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 19
Database/ Data driven programming
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 20
Functional programming
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 21
Functional programming - contd
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 22
Functional programming code examples
//Functional
function greet(name) {
return "Hi, " + name;
}
greet("Sponge Bob");
//Imperative
var name = "Sponge Bob";
var greeting = "Hi, ";
console.log(greeting + name);
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 23
Functional programming code
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 24
Functional programming code - contd
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 25
Origin of functional programming (FP)
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 27
Review Exercise
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 28
Summary / Recap of Main Points
Programming paradigm
Definition
Programming paradigm categories
Imperative programming
Declarative programming (logic, data driven, functional)
Origin of functional programming
Why functional programming
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 29
What To Expect Next Week
In Class
Functional programming concepts:
Purity and Higher order function
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 30
References
[1] Atencio, L. (2018). Functional Programming in Javascript: How to Improve Your Javascript Programs Using Functional Techniques. Manning
Publications.
[2] Peter Van-Roy; Seif Haridi (2004). Concepts, Techniques, and Models of Computer Programming. MIT Press. ISBN 978-0-262-22069-9
https://ctm.info.ucl.ac.be/.
[3] Peter Van Roy (2009-05-12). "Programming Paradigms: What Every Programmer Should Know" (PDF). info.ucl.ac.be. Retrieved 2014-01-27.
[4] https://en.wikipedia.org/wiki/Comparison_of_multi-paradigm_programming_languages
[5] Kereki, F. (2017). Mastering Javascript Functional Programming: In-depth guide for writing robust and maintainable Javascript code in ES8 and beyond.
1st ed. Packt Publishing.
CT006-3-3 & Advanced Programming Language Concepts Introduction to Programming Paradigm SLIDE 31