Difference between procedural &object oriented programming

carenextΛογισμικό & κατασκευή λογ/κού

18 Νοε 2013 (πριν από 3 χρόνια και 10 μήνες)

139 εμφανίσεις

Difference between procedural &object oriented programming


1








INDEX



Contents

Page no

Fac
ulty
Information

Learning Objectives

Preparation

Activity Notes


Things to Do


Activity History


2

Introduction


3

subtask1


4

subtask2.


7

subtask3.


9

Applications


10

Resources


10


Evaluation of the Task
: Rubric



11











Difference between procedural &object oriented programming


2


Fac
ulty

Information

Learning Objectives

After completing this activity, learners should be able to:



Explain the main difference in the s
yntaxes of C and CPP Languages.



Assess the performance of simple algorithms as a function of their input size N.



Understand concept and importance of Object Oriented P
rogramming



Understand complete structure of CPP program

Prerequisites

Before starting t
his
activity, learners should have
C
-
Programming experience
.

Preparation

Optional: Provide the worksheet on the board, a poster, or in presentation software,

so teams can see
each other’s
’ work easily.

Activity History

15
-
1
2
-
2011 Drafted by V.Radhesyam
syam.radhe@vrsiddhartha.ac.in















Difference between procedural &object oriented programming


3



Introduction



An OOP language should support

Easy Representation of Real
-
world
objects, Their

States and Abilities

Interaction with objects of same type

and
Rela
tions with objects of other type



Reusability of code



Convenient type definitions



C++
Syntax is same as C but having some additional operators and keywords



The main difference between C and C++ can be understand
as
below

Programming
Paradigm

Basic unit

Exam
ple
Language

Procedural
Programming

Function

C

Object Oriented
Programming

Class

C++




The basic unit so called
class

in the above table can be visualized as
a box shown
below.




Class name




Data




Functions







How to implement Class



How to conn
ect class to main program



Interconnection among Classes





Difference between procedural &object oriented programming


4



Before you start, complete the form below to assign a role to each member.



Team



Date


Team Roles

Team Member

(Write
your Roll
-
number
)

Recorder
: records all answers & questions,

and provid
es copies to team & fac
ulty
.


Speaker
: talks to fac
ulty

and other teams.



Manager
: keeps track of time and makes sure

everyone contributes appropriately.


Other:



Reminders:

1.

Note the time whenever your team starts a new section or question.

2.

Write le
gibly & neatly so that everyone can read & understand your responses.







Difference between procedural &object oriented programming


5



I.

(15 min) Subtask
-
1



Class Class name {


Private:










Data








Data


Public
:

Functions


}
object
;


1.

What do you understand about above rectangle box with 3 compa
rtments?




2.

Define
object
in
the
above diagram?








3.

We can create any no of objects to a class (for example see picture below)

What

is the role of object in writing CPP program? Write such simple example
.





C
lass

name

Data

Functions

Difference between procedural &object oriented programming


6













II.

(25
min) Writing fir
st program Subtask
-
2




1.

Write syntax of C and CPP programs
.

what

is the difference you observed.(
use
above picture
as
for reference)





Person

Data

Functions

X: Person

Z: Person

Y: Person

Difference between procedural &object oriented programming


7



2.

What do you call

:: what is its importance in writing CPP
programs?




3.

Write C

program to perform arithmetic calculat
ions like addition, subtraction, multiplication
and division





















Difference between procedural &object oriented programming


8




4.

Write CPP program to perform arithmetic calculations like addition, subtraction,
multiplication and division

























Difference between procedural &object oriented programming


9



III (5min) Compare Strategies of C an
d CPP programs that are written above Subtask
-
3


1.







2.







3.







4.












Difference between procedural &object oriented programming


10


IV

(5min)
Match the following Subtask
-
4


Group
-
A

Group
-
B

Scope resolution

Data type

In
t

Input function

Cin


Keyword

Return type Function1( )

Function prototype

Cout


Special Function

Character


~

Destructor

Output function

>>

: :

Return type Function1( );

Function

Integer

cin

<<


Constructor

cout



Home assignment

Define a cla
ss to represent a
bank account of customers

including

Data


a)

Name of the depositors

b)

Account number

c)

Type of account

d)


Balance amount in the account

Member functions


e)

To assign initial values

f)

To deposit an amount

g)

To withdraw an amount after checking the bala
nce

h)

To display the name and balance

Develop cpp program basing on above class handling

n


number of
customer’s

d
ata

Difference between procedural &object oriented programming


11



Resources

Text Book


[1] R. Lafore, Object
-
Oriented Programming in C++, 4 ed.: sams publishers

[2] Data Structures and Algorithm Analys
is in C++, Mark Allen Weiss, Pearson

Education , second edition

.


References

[3]Robert L.Kruse, Leung and Tando, ‘Data Structures and Program Design in C’, PHI


[4] Data structures using C and C++, Langsam, Augenstein and Tanenbaum,PHI/Pearson
Education


[5]Data structures and Algorithms in C++, Michael T.Goodrich, R.Tamassia and D.Mount,
Wile


Web resources



[6](P. P. Chakraborty. 20 January). Lecture Series on Programming and Data Structure
NPTEL. Available:
http://nptel.iitm.ac.in/video.php?courseId=1125


[7]P. R. C. Holte and 20 January). Data Structures Webdocs. Available:
http://webdocs.cs.ualberta.ca/~holte/T26
/top.realTop.html

[8]S. Skiena. (1996, 21
-
1
-
2011). Data Structures Computer Based Learning Unit University
of Leeds. Available:
http://www.cs.sunysb.edu/~skiena/214/lectures/

[9]P. Hilfinger
. 18 January). Data Structures Acadamic earth.
Available
http://academicearth.org/courses/data
-
structures










Name &Signature of the Student


Difference between procedural &object oriented programming


12



Evaluation of the
T
ask
: Rubric

SPECIFIC CR
ITERIA

RATIN
G

COMMENTS

I: Comprehensively synthesizes

POP

and OOP


/ 4


II:
Performance in Matching activity


/ 4


III: Comprehensively synthesizes

Applications and
difference between POP and
OOP
.

/ 3


IV:
Performance in Home assignment


/ 3


COMMON C
RITERIA

RATIN
G

COMMENTS

Begins with a summary of the activity, ends
with a summary of questions, Team member
roles and time management.


/ 3


Neatness of the work, Organization &

clarity in providing all required information.

/ 3



TOTAL

/ 20






Name

&Signature of the Fac
ulty