This document compares procedural programming and object-oriented programming. Procedural programming separates data and procedures, while object-oriented programming combines data and procedures into objects. Object-oriented programming encapsulates data and methods within objects, allowing for data hiding and interfaces between objects. Benefits of object-oriented programming include code reuse through object classes and easier debugging through independent testing of classes.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
80 views10 pages
Procedural Vs Object Oriented Languages
This document compares procedural programming and object-oriented programming. Procedural programming separates data and procedures, while object-oriented programming combines data and procedures into objects. Object-oriented programming encapsulates data and methods within objects, allowing for data hiding and interfaces between objects. Benefits of object-oriented programming include code reuse through object classes and easier debugging through independent testing of classes.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10
Procedural Programming vs
Object Oriented Programming
Associate Prof. Dr. Norazah Yusof Object Oriented Programming SCJ2153 Procedural Programming Traditional programming languages were procedural. C, Pascal, BASIC, Ada and COBOL Programming in procedural languages involves choosing data structures (appropriate ways to store data), designing algorithms, and translating algorithm into code.
2 Procedural Programming In procedural programming, data and operations on the data are separated. This methodology requires sending data to procedure/functions. 3 Procedural Programming 4 Function A Function A Data Elements Data Elements Function B Function B Object-Oriented Programming Object-oriented programming is centered on creating objects rather than procedures/ functions. Objects are a melding of data and procedures that manipulate that data. Data in an object are known as attributes. Procedures/functions in an object are known as methods. 5 Object-Oriented Programming 6 Objects Attributes (data) Methods (behaviors / procedures) Object-Oriented Programming Object-oriented programming combines data and behavior (or method). This is called encapsulation. Data hiding is the ability of an object to hide data from other objects in the program. Only an objects methods should be able to directly manipulate its attributes. Other objects are allowed to manipulate an objects attributes via the objects methods. This indirect access is known as a programming interface. 7 Object-Oriented Programming 8 Objects Attributes (data) Methods (behaviors / procedures) Typically private to this object Other Objects Programming Interface Benefits of Object-oriented programming Save development time (and cost) by reusing code once an object class is created it can be used in other applications Easier debugging classes can be tested independently reused objects have already been tested
9 10 Pure OO Languages Smalltalk, Eiffel, Actor, Java
Hybrid OO Languages C++, Objective-C, Object-Pascal Object-Oriented Programming Languages