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

Classes and Objects are the central of Object Oriented Programming (O.O.P.) This is a style of...
Classes and Objects are the central of Object Oriented Programming (O.O.P.) This is a style of programming that focuses on using objects to design and build many great applications. What is the difference between a class an an instance of the class? Explain what is constructor? What do you call a constructor that accepts no arguments? Explain the "has-a" relationship can exist between classes. Explain what is the "this" keyword? Do the following: Answer the 4 points with only one...
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.
How algorithms address object-oriented classes and objects. What is the File object? How are File objects...
How algorithms address object-oriented classes and objects. What is the File object? How are File objects used in algorithms? 175 words minumum please :)
Using the object-oriented programming principles, write a currency exchange converter in Java. You should also use...
Using the object-oriented programming principles, write a currency exchange converter in Java. You should also use 3 different classes it could be currency1 and currency2 and currencytest, and set() and get() method and tostring() method. A person will be presented with 3 currencies (i.e., USD, AED, MYR) that they can convert to/from AED Dirham. The program will allow the user to input the amount of Dirham or other currency to be converted. The Money changer will take AED50 commission if...
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),...
Using the various Object Oriented Programming concepts and skills learnt in this course, design and develop...
Using the various Object Oriented Programming concepts and skills learnt in this course, design and develop a Java Application to compute an individual student’s GPA and store the records in a database. The application should have two components i.e. The student and the course components. The following should be the minimal operations on the course component: – Set course information – Print course information – Show credit hours – Show course number The following should be the minimal operations on...
-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...
Briefly explain the terms used in object-oriented programming with examples.
Briefly explain the terms used in object-oriented programming with examples.
*OBJECT ORIENTED PROGRAMMING* JAVA PROGRAMMING GOAL: will be able to throw and catch exceptions and create...
*OBJECT ORIENTED PROGRAMMING* JAVA 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...
Java language This is your first homework on objects and classes, and the basics of object-oriented...
Java language This is your first homework on objects and classes, and the basics of object-oriented programming. For each exercise, your task is to first write the class that defines the given object. Compile it and check it for syntax errors. Then write the “demo class” with the main program that creates and uses the object. a)You are planning to purchase a new motor boat for cool cruises on Porter’s Lake this summer, but you want to simulate it before...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT