Programming Paradigms
Programming Paradigms
1
Lesson Learning Outcome
Pass Merit Distinction
2
What is a Programming Paradigm?
3
Common Programming Paradigms
Declarative Programming
Logic Programming
Functional Programming
4
Imperative Programming
5
Object Oriented Programming
6
Declarative Programming
7
Logic Programming
8
PROLOG - Example
/* Some rules */`
is_digesting(X,Y) :- just_ate(X,Y).
is_digesting(X,Y) :- just_ate(X,Z), is_digesting(Z,Y).
/* Some facts */
just_ate(mosquito,blood(john)).
just_ate(frog,mosquito).
just_ate(stork,frog).
9
Functional Programming
10
Event-driven Programming
Event-driven programming is a
programming paradigm in which
the flow of program execution is
determined by events - for
example a user action such as a
mouse click, key press, or a
message from the operating
system or another program.
11
Key Terminology
The event source is an This provides The listener is in effect A collection of routines
object on which the information of the a loop which waits for that defines the
event occurs. Source occurred event. an event to occur. responses to the
provides information Event(S). In some
of the occurred event implementations
to it's handler via an Listener and Handler is
Event object. the same
12
How to create an Event-driven Program
13
How to create an Event-driven Program
14
New Trends in Languages
15
Lesson Summary
16