Question

In: Computer Science

Why is it more feasible to use Objects and object oriented programming as compared to using...

Why is it more feasible to use Objects and object oriented programming as compared to using method based programs? What are the disadvantages of using only methods in your programs.

Solutions

Expert Solution

Advantages of using Objects and Object Oriented programming as compared to method based programs are:-

  1. OOP(Object Oriented Programming) is very close to the real world that uses classes and objects to group similar data for a better understanding and modification of the code. It is easier to conceptualize as compared to method based programs.  
  2. In OOP(Object Oriented Programming) we can use Inheritance which increases code reusability and decreases the code length. A child class can inherit the properties and behaviours(objects and functions) from its parent class, therefore we don't need to write the same functions each and every time from the scratch. This is not possible in method based programming.
  3. We can use the concept of Encapsulation in OOP, which helps in data hiding and keeping it private by restricting its access. This is also not possible if there is no implementation of objects.
  4. OOP also provides us with Polymorphism by overloading or overriding the functions. It helps the programmers to reuse the code and saves a lot of time. Once the code is written and tested, we can use it several times by just changing its parameters. Therefore, it's not needed to write and test the functions each and every time from the scratch.
  5. OOP introduces shallow, deep and object copy which is missing in method based programs. Therefore functionalities can be copied according to the situations.
  6. Introduces the concept of observer pattern so that if a particular object within a class got modified then extended data member which is dependent on that object gets updated without any further modification of the code.

Disadvantages of using only methods in our programs are:-

  1. We won't be able to inherit functionalities and therefore code length will increase.
  2. We won't be able to protect our private data as access can't be restricted if we use only methods in our programs.
  3. Code complexity can increase and it may become difficult to debug and manage if there are no links between the similar functions and is not defined into manageable chunks.

Related Solutions

Explain what classes and objects are in object - oriented programming. Give an example of each...
Explain what classes and objects are in object - oriented programming. Give an example of each and explain how they work together in a computer program.
In this assignment, you will practice solving a problem using object-oriented programming and specifically, you will...
In this assignment, you will practice solving a problem using object-oriented programming and specifically, you will use the concept of object aggregation (i.e., has-a relationship between objects). You will implement a Java application, called MovieApplication that could be used in the movie industry. You are asked to implement three classes: Movie, Distributor, and MovieDriver. Each of these classes is described below. The Movie class represents a movie and has the following attributes: name (of type String), directorsName (of type String),...
-What is object-oriented programming? -What is a class? -What is an object? -A contractor uses a...
-What is object-oriented programming? -What is a class? -What is an object? -A contractor uses a blueprint to build a set of identical houses. Are classes analogous to the blueprint or the houses? Explain. -What is a class diagram? How is it used in object-oriented programming? -What is an attribute in OOP? What is a data member? -What is a method in OOP? What is a member function? -What is the difference between private members and public members of a...
Use composition relationship. What is composition? You will find out what composition in object oriented programming....
Use composition relationship. What is composition? You will find out what composition in object oriented programming. Based on the bedroom package below please create your own classroom package. After completing entire package, you will write about your package specification in Readme.txt and also explain how you apply composition to your project. package Bedroom; public class Bedroom { private String name; private Wall wall1; private Wall wall2; private Wall wall3; private Wall wall4; private Ceiling ceiling; private Bed bed; private Lamp...
Use composition relationship. What is composition? You will find out what composition in object oriented programming....
Use composition relationship. What is composition? You will find out what composition in object oriented programming. Based on the bedroom package below please create your own classroom package. After completing entire package, you will write about your package specification in Readme.txt and also explain how you apply composition to your project. package Bedroom; public class Bedroom { private String name; private Wall wall1; private Wall wall2; private Wall wall3; private Wall wall4; private Ceiling ceiling; private Bed bed; private Lamp...
1. In Object Oriented Programming The private object fields can be directly manipulated by outside entities....
1. In Object Oriented Programming The private object fields can be directly manipulated by outside entities. Group of answer choices A. True B. False 2. __________ programming is centered on the procedures or actions that take place in a program. Group of answer choices A. Class B. Object-oriented C. Menu-driven D. Procedural/ Structural 3. __________ programming encapsulates data and functions in an object. Group of answer choices A. Object-oriented B. Class C. Menu-driven D. Procedural 4. The data in an...
Make a simple game using C++ which implements all about Object Oriented Programming (Please make an...
Make a simple game using C++ which implements all about Object Oriented Programming (Please make an explanation which of each part in it)
This week, you will create and implement an object-oriented programming design for your project. You will...
This week, you will create and implement an object-oriented programming design for your project. You will learn to identify and describe the classes, their attributes and operations, as well as the relations between the classes. Create class diagrams using Visual Studio. Review the How to: Add class diagrams to projects (Links to an external site.) page from Microsoft’s website; it will tell you how to install it. Submit a screen shot from Visual Studio with your explanation into a Word...
Research and explain in your words what is known as Object Oriented Programming. Then, identify two...
Research and explain in your words what is known as Object Oriented Programming. Then, identify two advantages of OOP for application development. In peer replies, choose from one of the following and define the concept as part of your response. Abstraction. Encapsulation. Inheritance. Polymorphism.
*OBJECT ORIENTED PROGRAMMING* GOAL: will be able to throw and catch exceptions and create multi-threaded programs....
*OBJECT ORIENTED PROGRAMMING* GOAL: will be able to throw and catch exceptions and create multi-threaded programs. Part I Create a class called Animal that implements the Runnable interface. In the main method create 2 instances of the Animal class, one called rabbit and one called turtle. Make them "user" threads, as opposed to daemon threads. Some detail about the Animal class. It has instance variables, name, position, speed, and restMax. It has a static boolean winner. It starts a false....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT