Вы находитесь на странице: 1из 38

Introduction to

Programming
Paradigm
Outline
Topics
1 Procedural Programming
2 Object-Oriented Programming
3 Event-Driven Programming
4 Visual Programming

2
Procedural
Programming
Introduction

Are you familiar with these keywords:


 Programming ??
 Programming language ??
 Program ??
 Syntax ??
 Code ??

Can you explain any of those keywords?

4
Procedural Programming

 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.

5
Procedural Programming

 Procedural programming works by telling the


computer 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.

6
Example of C++ Procedure Program

Example
7
Procedural Programming
 Basically procedure-oriented programs force
the user or programmer to follow a
predetermined path (as shown in below figure).

8
Procedural Programming
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.
Draw Rectangle 1 Draw Rectangle
Height 4 cm Height X cm
Base 2 cm Base y cm
Color Blue Color z
End End
Draw Rectangle 2
Height 6 cm Rectangle (4, 2, blue)
Base 4 cm Rectangle (6, 4, red)
Color red
9
End
Procedural Programming
 Advantages of procedural programming:

• Can avoid or reduce symptom of spaghetti


code (the use of many GOTO or JUMP
statements)

10
Procedural Programming
 Disadvantages of procedural programming:

• The attempt to create larger and more


complex programs led to software
crisis/problem

• Programs were not ready on time, exceed


budgets and contained too many errors

11
Object-Oriented
Programming
Object-Oriented Programming

 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

13
Object-Oriented Programming

 An object is a unit of computer information that


contains data as well as procedures.

 Class is a category of objects or template for


creating objects

14
Object-Oriented Programming
What is basically an object in VB?
Objects are entities you can create and use in the process of
developing a Windows application such as form and controls.

code and
data

Object 15
Object-Oriented Programming

 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.

16
Object-Oriented Programming

17
Object-Oriented Programming

 Object-oriented programming involves three


important concepts:
 Encapsulation : means an object contains data
and instructions (methods).

 Inheritance: means once you have created an


object, you can use it as the foundation for
similar objects that have the same behaviour
and characteristics.

 Polymorphism : means “many shapes” or a


different results can be produced depending on
the object that it is sent to.
18
Event-Driven
Programming
Event-Driven Programming
 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.

20
Event-Driven Programming
 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…

21
Event-Driven Programming

How event-driven program reacts to event

22
Example of VB Program
Events

23
Event-Driven Programming
 Sources of events are generated from objects.

24
Event-Driven Programming
 Event-driven programs do not have a
predetermined finish.
 They are designed to wait and respond to things
that happens to them.

25
Event-Driven Programming
 The most common example of event-driven
applications are found in
• Microsoft Windows (any versions)
• Apples Mac OS (X11)
• GUIs applications

26
Visual
Programming
Visual Programming
 Visual programming is a method of creating
programs by using icons that represent common
programming routines.

 The programmers makes connections between


objects by drawing, pointing and clicking on
diagrams or icons and by interacting with
flowcharts.

 This type of programming become necessary to


develop GUI-based applications.

28
Visual Programming
 Visual basic developed by Microsoft in the early
1990s is the most popular visual programming
language.

 It offers a visual environment for program


constructing, allowing users to build various
application components using drag and drop
tools, buttons, scroll bars and menus.

29
Visual Programming
 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 Prograph
CPX, Stagecoach software's cocoa

30
Visual Programming
 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

31
VISUAL PROGRAMMING LANGUAGE

 To simply stated, Visual Programming is a


language 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.

32
VISUAL PROGRAMMING LANGUAGE

 The term Visual language has been adopted


by a number of people in recent years to mean
a conventional textual language which has an
attached of WYSIWYG GUI (what you see is
what you get graphichal user interface) design
tool along with other graphical RAD (Rapid
Application Development) tools.

 Examples of this type of language would be


Borland Delphi and Microsoft Visual Basic.

33
VISUAL PROGRAMMING LANGUAGE

 Unfortunately, some confusion can arise from the use of the


term Visual Programming Language because it has been
used in many different contexts to describe entirely different
concepts.

 Nowadays, visual programming has been used to describe:


• Language for manipulating visual information or ;
• Language for supporting visual interaction or ;
• Allows programming with visual expressions.

34
VISUAL PROGRAMMING LANGUAGE

 However, there have been many attempts to


define what is visual programming languages
and they are:

 "Visual Programming refers to any system that


allows 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 dimensional
since the compilers or interpreters process them
as long, one-dimensional streams" [Myers 90].

35
VISUAL PROGRAMMING LANGUAGE

 All of the above definitions are adequate ways of


defining what visual programming can be,
although NO SINGLE DEFINITION can
acquainted us with all of the aspects of visual
programming language.

36
VISUAL PROGRAMMING LANGUAGE

So,
What is Visual Basic actually?

37
Discussions

38

Вам также может понравиться