01_Intro_to_EDP
01_Intro_to_EDP
Event-Driven Programming
Programming Paradigms
Event-driven Programming and its Principles
From 1 to 12 O’clock
Assessments and Gradings
Computer Programming?
Computer programming is the process of performing a
particular computation usually by designing and building
an executable computer program.
The source code of a program is written in one or more languages that are
intelligible to programmers, rather than machine code, which is directly
executed by the central processing unit.
Programming Types and Paradigms
Classifying programming languages based
on the way code is written, organized and
executed
5
Declarative Programming
In a general sense, code written in the declarative programming style instructs the computer
as to what should be done, instead of telling the computer how to do it. It specifies the end
result and lets the language engine decide how it should be done.
This is achieved through a domain-specific language (DSL) allowing the user to express what
it is they want. Such languages free the user from having to employ lower-level constructs
such as assignments and loops that would otherwise be needed to achieve the desired goal.
Declarative Programming
C, Java, Python, and R are examples of languages that facilitate the imperative
programming paradigm.
Imperative (Sequential) Programming
number1 = 10
number2 = 15
total = number1 + number2
Each statement in this code modifies the state of the program. The first two statements
create (change the state of) variables by assigning values to them. The final line adds these
values and assigns them to a new variable, again changing the state of the program.
Functional Programming
In the functional programming paradigm, programs are created by evaluating functions. Functional programming
is based on several concepts:
• Immutability - In pure functional programming, data structures are immutable, i.e. their state can not be
changed.
• First Class (Higher-order in math) Functions - functions are treated like other variables.
• Pure Functions, functions that produce no side effects, either by changing the state of memory or any I/O
device. This is known as referential transparency.
• Recursion, where functions can invoke themselves to accomplish the same result as looping in imperative
languages. This can require using a stack.
Functional Programming
13
A Comparison
Other Paradigms Event-driven Paradigm
Programmer Sets the Order of Action Computer User Determines the Order of
Actions
Programmer Controls the Program’s Flow of Control is Determined at Runtime
Flow
Programmer-written Functions are called Programs are Interactive
by programmers
16
Event
17
Principles of Event-driven Programming
Event Listener: The event listener listens for events and
dispatches them to the appropriate handlers.
This loop runs continuously throughout the life of the
program.
Event Handlers: Blocks of code designed to respond to
specific events.
When an event occurs, the corresponding handler is executed
Asynchronous Behavior: Unlike traditional linear and
sequential programming, event-driven programs often
operate asynchronously.
The program waits for events to occur and responds to them as they
happen.
Loose Coupling: Loosely coupled components. They
operate independently and only communicate through
18
events.
Principles of Event-driven Programming (Cont.)
Callback Functions: A function is passed as an argument
to another function and is executed on an event detection.
Concurrency: Event-driven architectures support concurrent
operations.
In environments where events occur independently and at
unpredictable times.
State Management: Managing the state of an application
can be more complex in event-driven programming
Due to the asynchronous and unpredictable nature of events.
Scalability: Highly scalable
Particularly in distributed systems where events can be
produced and consumed across different systems and
networks.
Flexibility and Scalability: More flexible and scalable
19
New event types and handlers can be added without altering
12 O'clock: Assessment 2
Project Presentation/Interview 2
Soft Labs
1 O'clock: Intro
11 O'clock: Assessment 1 Hard Labs
Introduction & Principles
Project Presentation/Interview 1
Paradigms
Assessment Week
8 O'clock: Parallelism
Performance focused Multi- 4 O'clock: GUI-1
threading, Fork-Join Principle EDM, MVC, JavaFX GUI 1
7 O'clock: Multiprocessor
Support 5 O'clock: GUI-2
Multithreading in Java, Threads JavaFX GUI 2, Event Handling
States and Communication using Lambda Expressions
6 O'clock: MidTerm
Project
20
Assessments (More on Brightspace)
Attendance – 20%
Attendance in the first half hour – counting at the end of the
lecture
Labs – 20%
The lab coordinator will assess you based on the output of your
code (after execution) for a Randomly Selected Task. He/she may
ask one random question. Half + Half
Labs will always be assessed in the next week of lab available
Midterm (30%):
Project – 30%
Final (30%):
Project – 30%
21
Projects
Projects (Individual Assessment + Two Members Group):
Midterm Project – Description and Assessment Criteria will be made available in
Week2 – Hard Deadline Week 6 (Before Labs)
Final Project – Description and Assessment Criteria will be made available in
Week5 – Hard Deadline Week 11 (Before Labs)
You should view this assignment as a means to create a relevant portfolio that you might
present to a future employer, so you MUST utilize GitHub ( https://github.com/) to save
and record your progress.
Presentations and Interviews (Week 11 and Week 12):
You will be required to submit a video presentation of a walk through your code
and how it works covering the assessment criteria you addressed (max 7 min)
The main purpose of the interview is twofold
To assess your comprehension of the work you have submitted and related course content
To provide an opportunity for you to receive timely face-to-face feedback on your work and
progress during the semester.
N.B. No matter how good your project work is if you fail to demonstrate a sufficient
understanding of the project and related course content you can receive 0 marks
Interview Scheduling based on student ID (earliest in a group will be considered)
22
Contact Hours
Contact hours:
2 hours in class lecture
2 hours of labs Friday (Labs will start from Week 2)
23
Grades Breakdown
30% D2
35% D1
40% C3
48% C2
52% C1
56% B3
60% B2
64% B1
72% A2
80% A1
24