8/14/2019 01-intro-spm3112
1/38
Introduction toProgramming
Paradigm
8/14/2019 01-intro-spm3112
2/38
2
Topics
1 Procedural Programming
2 Object-Oriented Programming3 Event-Driven Programming
4 Visual Programming
Outline
8/14/2019 01-intro-spm3112
3/38
Procedural
Programming
8/14/2019 01-intro-spm3112
4/38
4
Are you familiar with these keywords: Programming ??
Programming language ??
Program ??
Syntax ??
Code ??
Can you explain any of those keywords?
Introduction
8/14/2019 01-intro-spm3112
5/38
5
Introduced in early 1960s.
Some people referred it as structured or
modular programming.
All High-level languages (i.e. C, Basic, Cobol)
support procedural programming.
Procedural Programming
8/14/2019 01-intro-spm3112
6/38
6
Procedural programming works by telling thecomputer what to do and how to do it.
Procedural programming involves procedures.
Procedures are the steps that must be followed
to accomplish a specific task.
Procedural Programming
8/14/2019 01-intro-spm3112
7/38
7
Example of C++ Procedure Program
Example
http://g/Pengajaran/SPM3112-PLII/0607-2/unit%204%20distance.exehttp://g/Pengajaran/SPM3112-PLII/0607-2/unit%204%20distance.exe8/14/2019 01-intro-spm3112
8/38
8
Procedural Programming
Basically procedure-oriented programs force
the user or programmer to follow apredetermined path (as shown in below figure).
8/14/2019 01-intro-spm3112
9/38
9
Advantages of procedural programming:
Instructions can be written short without the need to
rewrite the whole definition for every task.
Example:
Task: create two rectangles with blue & red colors,4 & 6 heights and 2 & 4 base.
Procedural Programming
Draw Rectangle 1
Height 4 cm
Base 2 cm
Color BlueEnd
Draw Rectangle 2
Height 6 cm
Base 4 cm
Color red
End
Draw Rectangle
Height X cm
Base y cm
Color zEnd
Rectangle (4, 2, blue)
Rectangle (6, 4, red)
8/14/2019 01-intro-spm3112
10/38
10
Advantages of procedural programming:
Can avoid or reduce symptom ofspaghetti
code (the use of many GOTO or JUMP
statements)
Procedural Programming
8/14/2019 01-intro-spm3112
11/38
8/14/2019 01-intro-spm3112
12/38
Object-OrientedProgramming
8/14/2019 01-intro-spm3112
13/38
13
Introduced in the late of 1960s.
Object-oriented programming (OOP) is
considered as a more recent approach to
programming.
In object-based languages, program contains
objects and classes
Object-Oriented Programming
8/14/2019 01-intro-spm3112
14/38
14
An object is a unit of computer information thatcontains data as well as procedures.
Class is a category of objects ortemplate for
creating objects
Object-Oriented Programming
8/14/2019 01-intro-spm3112
15/38
15
Object-Oriented Programming
What is basically an object in VB?
Objects are entities you can create and use in the process ofdeveloping a Windows application such as form and controls.
Object
code and
data
8/14/2019 01-intro-spm3112
16/38
16
Objects must be created from classes. The properties and methods of an object are contained in
its classes.
Properties are the characteristics of the objects while
methods are used to cause the objects to do something.
Object-Oriented Programming
8/14/2019 01-intro-spm3112
17/38
17
Object-Oriented Programming
8/14/2019 01-intro-spm3112
18/38
8/14/2019 01-intro-spm3112
19/38
Event-DrivenProgramming
8/14/2019 01-intro-spm3112
20/38
20
In the event-driven language, a user does something with
the object and the object will respond to the user.
On another word, event-driven programs do not predict the
control sequence that will occur; they are written to react
reasonably to any particular sequence of events that may
occur once execution begins.
Event-Driven Programming
8/14/2019 01-intro-spm3112
21/38
21
But what is actually an event?
Events are actions taken by objects, they are what
objects do.
Example of events: mouse click, keypress, drag & drop
etc
Event-Driven Programming
E t D i P i
8/14/2019 01-intro-spm3112
22/38
22
Event-Driven Programming
How event-driven program reacts to event
8/14/2019 01-intro-spm3112
23/38
23
Example of VB Program
Events
8/14/2019 01-intro-spm3112
24/38
8/14/2019 01-intro-spm3112
25/38
25
Event-driven programs do not have a
predetermined finish. They are designed to wait and respond to things
that happens to them.
Event-Driven Programming
8/14/2019 01-intro-spm3112
26/38
26
The most common example of event-driven
applications are found in
Microsoft Windows (any versions)
Apples Mac OS (X11)
GUIs applications
Event-Driven Programming
8/14/2019 01-intro-spm3112
27/38
Visual
Programming
Visual Programming
8/14/2019 01-intro-spm3112
28/38
28
Visual programming is a method of creating
programs by using icons that represent commonprogramming routines.
The programmers makes connections betweenobjects by drawing, pointing and clicking on
diagrams or icons and by interacting withflowcharts.
This type of programming become necessary todevelop GUI-based applications.
Visual Programming
Visual Programming
8/14/2019 01-intro-spm3112
29/38
29
Visual basic developed by Microsoft in the early
1990s is the most popular visual programminglanguage.
It offers a visual environment for programconstructing, allowing users to build various
application components using drag and droptools, buttons, scroll bars and menus.
Visual Programming
Visual Programming
8/14/2019 01-intro-spm3112
30/38
30
Visual programming is divided into two
categories:1. Programming that used visual elements as a
syntax in program creation; and
Example of category 1 Chimera , Forms/3, Advanced Visual
Systems, Pictorius International's PrographCPX, Stagecoach software's cocoa
Visual Programming
Visual Programming
8/14/2019 01-intro-spm3112
31/38
31
Visual programming is divided into two
categories:1. Programming that used visual elements as a
tool to create program.
Example of category 2 Microsoft Visual Basic, ParcPlace Systems
VisualWorks
Visual Programming
8/14/2019 01-intro-spm3112
32/38
32
VISUAL PROGRAMMING LANGUAGE
To simply stated, Visual Programming is alanguage in which a program is constructed
using graphical and textual elements to create
multi-dimensional expressions.
Expressions in the above statement is referring
to graphics, drawings, animation and icons.
8/14/2019 01-intro-spm3112
33/38
33
VISUAL PROGRAMMING LANGUAGE
The term Visual language has been adoptedby a number of people in recent years to mean
a conventional textual language which has an
attached ofWYSIWYG GUI (what you see is
what you get graphichal user interface) designtool along with othergraphical RAD (Rapid
Application Development) tools.
Examples of this type of language would beBorland Delphi and Microsoft Visual Basic.
8/14/2019 01-intro-spm3112
34/38
34
VISUAL PROGRAMMING LANGUAGE
Unfortunately, some confusion can arise from the use of theterm Visual Programming Language because it has beenused in many different contexts to describe entirely differentconcepts.
Nowadays, visual programming has been used to describe: Language formanipulating visual information or ;
Language forsupporting visual interaction or ;
Allowsprogramming with visual expressions.
8/14/2019 01-intro-spm3112
35/38
35
VISUAL PROGRAMMING LANGUAGE
However, there have been many attempts todefine what is visual programming languages
and they are:
"Visual Programming refers to any system thatallows the user to specify a program in a two-(or
more)-dimensional fashion. Although this is a
very broad definition, conventional textual
languages are not considered two dimensionalsince the compilers or interpreters process them
as long, one-dimensional streams" [Myers 90].
http://www.rddvs.com/thesis/Ref.htmlhttp://www.rddvs.com/thesis/Ref.html8/14/2019 01-intro-spm3112
36/38
36
VISUAL PROGRAMMING LANGUAGE
All of the above definitions are adequate ways ofdefining what visual programming can be,
although NO SINGLE DEFINITION can
acquainted us with all of the aspects of visual
programming language.
S OG G G G
8/14/2019 01-intro-spm3112
37/38
37
VISUAL PROGRAMMING LANGUAGE
So,So,
What is Visual Basic actually?What is Visual Basic actually?
Discussions
8/14/2019 01-intro-spm3112
38/38
38
Discussions