answersLogoWhite

0


Best Answer
Structured programming is task-centric, object oriented programming is data-centric.Task-centric vs. Data-centricStructured programming is based around data structures and subroutines. The subroutines are where stuff actually "happens", and the data structures are simply containers for the information needed by those subroutines.

Object oriented programming, on the other hand, shifts your primary focus to the data itself. Instead of asking "what do I want to do and what will I need to know to do it", you ask "what kind of things do I want to have and what can those things do for me". Instead of designing your functions first and then coming up with data structures to support them, you design types first and then come up with the operations needed to work with them.

Three OOP PrinciplesPerhaps the most important feature of OOP is polymorphism, the ability to identify certain aspects that several data types have in common, and write code that works equally well with all of them by ignoring the differences in situations where they don't matter.

For example, consider a simple drawing program where you have a set of shapes (circles, rectangles, etc.) that share certain things in common (they all have a location, size, and color) but are different in other ways (how they look or whether they can be rotated). In a structured program, you'd write a function to draw a shape, containing logic like "if the shape is a circle, do ABC; if it's a rectangle, do XYZ" and so on.

But in an OO program, you'd simply tell the shape to draw itself, and the shape would know, based on its own type, what to do: you write a specialized drawing function when you define each shape, and when you send a "draw" message to any shape, it automatically calls the one for the correct shape type. Polymorphism eliminates the need for you to check what kind of shape it is: you just have to know that shapes can draw themselves, and let the shape worry about how it actually happens.

Another important OO principle is encapsulation, the ability to bundle code and data together in one place and hide that data from the outside world, forcing anyone who wants to access it to go through the associated code. For example, all shapes have a location and a size, but the best representation might be different. A circle only needs three numbers (center X, center Y, and radius) but a rectangle needs four (top, bottom, left, right). Structured programming encourages code everywhere to deal directly with the innards of data structures, so most likely you'd need to use the same representation for all shapes in order to avoid checking the type every time you wanted to measure a shape, even though that representation is wasteful for circles.

Object oriented programming addresses that problem two ways: first, encapsulation says that the internal representation of a shape is off-limits to anyone else, so if you want to know how big a shape is, you have to call its getSize() method instead of reading its size directly out of memory. Second, polymorphism allows different shapes to implement their getSize() methods differently, allowing circles to use a more efficient version while presenting the same interface to the outside world.

Finally, there's inheritance, which makes it easy to extend existing structures to produce new structures with slightly different behavior. For example, a filled circle is mostly the same as a regular circle, but it draws itself differently and also has a fill color. In a structured program, you'd probably handle filled circles by adding a fill color to all shapes and a flag that indicates whether the shape is filled or not, and the fill color would simply go unused (wasting memory) in unfilled shapes. In an object-oriented program, you can make FilledCircle a subclass of Circle, inheriting all the existing circle behavior, and then replace the draw() method and add a place to store the fill color. Then if you changed something about Circle later, the change would automatically propagate to FilledCircle, while changes you made to FilledCircle would not affect any other shapes.

Design vs. LanguageWhether your code is object oriented or merely structured depends partly on your choice of language, but also on your design. For example, the C language doesn't offer any features for object oriented programming, but with enough discipline you can still write object-oriented code in C, such as the GTK windowing library. On the other hand, you can write a Java program that completely fails to take advantage of Java's OOP features, by putting all your code in a single class and using classes with public members just as you'd use structs in C. One organizes code by comprehensiveness while the other organizes code by the data affected.Structured programming consists of breaking big problems into smaller problems, then further breaking those into still smaller problems, and so on, until a level of such simplicity is reached that the implementation is obvious to the programmer expected to do the coding. Object-oriented programming consists of grouping code with the data on which it operates so that this "object" can function independently of the rest of the software system. Structured programming and object-oriented programming are not mutually exclusive. You can structure the code in an object, and you can use objects to implement the modules of code in a structured program. Procedural (Structure) vs. OO programming require different approachesSimilarities: Both require a rudimentary understanding of programming concepts and basic control flow. Loops, conditional statements, and variables are concepts that are important whether you are using a procedural language or an object oriented language.

Differences: Typically object oriented is viewed as more difficult. This is because an entirely different problem solving approach must be taking. In addition, there are a variety of object-oriented-only concepts such as classes and inheritance. For simple programs, procedural is often preferred. The more complicated the project, the easier it is to leverage the strengths of object oriented design.

Other notes: Not all languages fall strictly into procedural or object oriented baskets. In actuality, it is more of a spectrum. Languages like Basic and C are pretty much entirely procedural. Languages like C++ and Pascal can be written in either procedural or object oriented styles. Languages like Java and Python adhere much more strictly to object oriented design (although some programmers argue these aren't TRUE object oriented languages).

User Avatar

Wiki User

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

Wiki User

12y ago

Maintainable

OOPS methods make code more maintainable. Identifying the source of errors becomes easier because objects are self-contained (encapsulation). The principles of good OOP design contribute to an application's maintainability.

Reusable

Because objects contain both data and functions that act on data, objects can be thought of as self-contained "boxes" (encapsulation).

This feature makes it easy to reuse code in new systems. Messages

provide a predefined interface to an object's data and functionality.

If you know this interface, you can make use on an object in any

context you want. OOP languages, such as C# and VB.Net, make it easy to

expand on the functionality of these "boxes" (polymorphism and inheritance), even if you don't know much about their implementation (again, encapsulation).

Scalable

OO applications are more scalable then their structured programming

roots. As an object's interface provides a roadmap for reusing the

object in new software, it also provides you with all the information

you need to replace the object without affecting other code. This makes

it easy to replace old and aging code with faster algorithms and newer

technology.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

An OS is not a program, it is a system of programs, its parts can be object oriented program, but not necessarily.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

You do not need object oriented programming.

Anything that can be programmed in an object oriented programming language can be programmed in C.

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

No even is you use a C++ compiler you do not have to use objects.

This answer is:
User Avatar

User Avatar

Newtum Solutions

Lvl 5
1y ago

It's required simplifying the program and making it easy.

The four pillars of OOP are Abstraction, Encapsulation, Inheritance, and Polymorphism.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the need of object oriented programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is need of object in object oriented programming?

Object is an instant of the class, by using an object we can members of the class.


What is full form of oop's?

Object Oriented Programming


Is PHP object oriented?

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


What is an essential of Object Oriented Programming?

The 3 essential concepts of Object Oriented Programming are:InheritanceEncapsulation &Polymorphism


What is the distinct difference between object oriented concept and object oriented programming?

Object oriented concepts are a generalisation of the object oriented principals (encapsulation, inheritance, polymorphism and abstraction) without specifying a particular implementation of those principals. Object oriented programming is the application of those principals through an object oriented programming language.


Is c is complete object oriented programming language?

No. C is not object oriented. C++ is object oriented.


Full form of oops?

The full form of OOP is Object-Oriented Programming.


What actually mean by object oriented programming Is C plus plus is a object oriented programming?

Just eat a watermellon!


Why you need to make c plus plus?

To provide tools for object oriented programming.


Object-oriented software is another name for structured software?

Object-oriented programming is a more recent subset of structured programming. Structured programming emphasized the need to align data structures with program structure, a concept that is formalized and carried much further in object-oriented programming. However, structured programming advocated hierarchical constraints on program structure that are incompatible with the event-driven, message-passing software architectures commonly implemented in the object-oriented style, today.


What has the author Edmund W Faison written?

Edmund W. Faison has written: 'Borland C [plus plus] 4 object-oriented programming' 'Borland C++ 3 object-oriented programming' -- subject(s): Borland C++, C++ (Computer program language), Object-oriented programming (Computer science) 'BorlandC[plus plus] 4.5 object-oriented programming' -- subject(s): Borland C., C., Object-oriented programming (Computer science) 'Borland C++ 3.1 object-oriented programming' -- subject(s): Borland C++, C++ (Computer program language), Object-oriented programming (Computer science)


An object-oriented programming language is necessary to do object-oriented programming?

small talk yes java yes c++ no delphi no etc...