answersLogoWhite

0


Best Answer

OOP, or Object Oriented Programming, is different from procedural programming, mainly because of the focus of the language. OOP focuses on objects, or collections of data and actions all bundles together into a nice little package. Procedural programming focuses on actions. For example, consider the following programming problem:

A farmer needs to calculate the number of bags of feed that his many types of animals, such as sheep, cows, and goats, will need. Design a friendly GUI (Graphical User Interface) and program that will accomplish this for him. Use the current prices, in USD, from Wikipedia of one bag of feed for the designated animal.

A Java programmer would start out by defining several classes, or "blueprints" for objects, such as Cow and Chicken for the animals, Button and Window for the onscreen GUI, and WikiReader and Parser for the act of getting the prices from Wikipedia. Then, he would link them all together and generally start coding.

A FORTRAN programmer would start by making procedures: getPriceFromWikipedia(), calculatePriceForAnimal, or sumUpPrices(). He would put references to each of the methods, for example sumUpPrices would invoke calculatePriceForAnimal for each of the animals.

So there you have it.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

9y ago

Object-oriented programming (OOP) isn't really that different from procedural programming in that both support the concept of a procedures (functions or subroutines). The main difference is that OOP allows data and the functions that specifically operate upon that data to be encapsulated within self-contained entities known as classes. The class determines which members (data and functions) are accessible from outside of the class and which members are only accessible from within the class. This makes it possible to control how consumers may interact with the class while the class members themselves work together to maintain the validity of the class data.

The class members can also be divided into two sets: static and nonstatic. Static members are local to the class itself while nonstatic members are associated with objects of the class. Each object has its own discrete set of data and a set of functions that can operate upon its data. In reality there is only one instance of each function, however the object itself is passed to its member functions through a hidden parameter so it knows which object (and thus which object's data) to operate upon. Static members do not require an object of the class and are accessible even when no objects of the class have been instantiated. Thus static members can provide common functionality that is not associated with any one instance of the class.

All class members have private access to the class representation and its implementations. This means that one object of the class can access the private members of another object of the same class. Private members of a class are not accessible to code outside of the class, unless that code is specifically declared a friend of the class, by the class itself. By contrast, public members are fully accessible both from within and without the class.

The public, protected and private members of a class define the class interface. The interface makes it possible to use a class or an instance of the class without knowing the internal details of its representation. This makes it possible to alter the internal representation without affecting the consumers of the class, so long as the interface remains unchanged. This makes code much easier to maintain because the impact of changes to the internal representation are limited to the class itself.

Since objects are self-contained entities, we can construct more complex classes from simpler classes, either by embedding existing objects within a new class or by deriving a new class from and existing class, or indeed both.

Derived classes automatically inherit all the public and protected members of their base classes. A protected member is similar to a private member (so it is not accessible to external code other than friends) but is implicitly accessible to its derivatives. Derivatives can also reduce (but not increase) the access privilege of the inherited members. The class from which a derivative inherits is known as a base class. Classes that are intended to act as base classes typically have one or more virtual methods that can be overridden by its derivatives, providing more specialised behaviour. Since they share a common class (the base class), both are said to be a type of base, and the base class virtual methods provide a common interface to all its derivatives. This makes it possible for different types of objects to be treated as if they were in fact the same type of object. When invoking a virtual method upon a base class, the most-derived override of the function is automatically invoked, even if the exact type of the object cannot be determined in advance. Knowing the virtual method exists is enough to ensure the actual object behaves according to its actual type. This allows code to be written in a more generic manner, using virtual interfaces.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

OOP, or Object Oriented Programming, is different from procedural programming, mainly because of the focus of the language. OOP focuses on objects, or collections of data and actions all bundled together into a nice little package. Procedural programming focuses on actions. For example, consider the following programming problem:

A farmer needs to calculate the number of bags of feed that his many types of animals, such as sheep, cows, and goats, will need. Design a friendly GUI (Graphical User Interface) and program that will accomplish this for him. Use the current prices, in USD, from Wikipedia of one bag of feed for the designated animal.

A Java programmer would start out by defining several classes, or "blueprints" for objects, such as Cow and Chicken for the animals, Button and Window for the onscreen GUI, and WikiReader and Parser for the act of getting the prices from Wikipedia. Then, he would link them all together and generally start coding.

A FORTRAN programmer would start by making procedures: getPriceFromWikipedia(), calculatePriceForAnimal, or sumUpPrices(). He would put references to each of the methods, for example sumUpPrices would invoke calculatePriceForAnimal for each of the animals.

So there you have it.

This answer is:
User Avatar

User Avatar

Wiki User

10y ago

Basically in the use of classes and objects.

Procedural Approach

· Data Structures can be represented as a network of associated structures, referring to one another.

· Procedures can be represented as a network of routines which call one another, i.e., "call tree"

Object Oriented Approach

· Collection of discrete objects that incorporate data structures and behaviour.

· Each data structure has, combined with it, the procedures which apply to that data structure.

· Contrasts with conventional programming in which data structures and behaviour are only loosely connected

· These entities, called objects, can be associated to one another in one network, rather than two.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How is oop different from the procedure oriented programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is full form of oop's?

Object Oriented Programming


Is PHP object oriented?

Yes - 'advanced' PHP programming uses Object Oriented Programming (OOP).


Full form of oops?

The full form of OOP is Object-Oriented Programming.


What programming category does OOP belongs?

Object-oriented programming is a category of programming languages. On a larger scale, OOP would belong under the imperative programming paradigm.


Data-Oriented Programming in Java?

Data-Oriented Programming (DOP) focuses on decreasing the complexity of the Object-Oriented Programming (OOP) application systems by rethinking data


Vbnet is which type of language Service Oriented Architecture Programming Language Object Oriented Programming Language Procedural Oriental Programming Language?

Visual Basic .NET (VB .NET) is an OOP, an Object-Oriented Programming Language. It's paradigm is both OOP and Event-Driven, but that's beside the point.


Is structured programming an OOP principle?

No. Structured programming came before object-oriented programming. Most OOP languages make use of structured programming, but only because they were already using structured principals, not because they now use OOP principals.


What is oops code in computer science?

oop is just object oriented programming...


Why object oriented programming language is called oops?

It isn't called oops, it's called OOP. It's an acronym for Object Oriented Programming.


What are the disadvantages of object oriented programming over structured programming?

actually oop concept have some disadvantage when compared to structured programming


What three concepts are the basis for object-oriented programming?

Classes, objects and methods are the three concepts for OOP programming.


What are the concepts of object oriented programming in c plus plus?

The concepts of OOP in C++ are the same as for OOP in any other programming language: abstraction, encapsulation, inheritance and polymorphism.