Author Topic: OOA  (Read 2003 times)

1170942812

  • Global Moderator
  • Newbie
  • *****
  • Posts: 10
OOA
« on: June 05, 2018, 12:56:23 AM »
What are the advantages and disadvantages in OOA?

1183091306

  • Global Moderator
  • Newbie
  • *****
  • Posts: 11
Re: OOA
« Reply #1 on: September 21, 2018, 11:19:12 PM »
Advantages and disadvantages of OOA
Reduced maintenance-Because of features like encapsulation the code re-usability goes up thereby reducing the maintenance efforts.
Real world modelling- It is understood that the object-oriented approach models the real world into the system, hence the objects and behaviors are better reflected by the system.
High code re-usability- Because of the object-oriented concepts such as encapsulation, abstraction, inheritance the code re-usability is higher.
Improved reliability and flexibility Owing to the flexibility that the system can be expanded with new objects and behaviors based on existing classes and objects, the object-oriented approach is much more flexible and reliable than traditional functional approach to programming.
Better security and easier to test are other advantages of OOA.
Disadvantages of OOA
Designing a program can be slightly tricky with OOA approach.
The performance can be slower compared to a functional approach because of the bigger size of the code that has to be executed for the result.
Resources need to think in terms of objects and develop programs and design systems to suit the approach.
It is not completely accepted by major vendors
For example, consider a database with employee records. Assume that the records already exist in the database and the required functionality is to raise the employees salary.
//Pseudo code//
Class Employee
{
String[] name;
Long salary;
change_salary(amt)
{
salary=salary+amt;
}
}
emp=[Employee.new(“Sandy”,800000.0), Employee.new(“Jane”,600000.0)]]
This creates two new employees Sandy and Jane with respective salaries as mentioned.
To change salary, the change salary method can be called.
emp.each do|empl|
empl.change_salary(100000.0)
end
This adds 100000 to each of the employee salaries as this is passed in the method.
To implement this in a functional approach,
employees=[“Sandy”,800000.0],[“Jane”,600000.0]]
richer_employees=change_salaries(employees,100000.0)
This means the amount 100000 along with the data employees is passed instead of just the amount as done previously in OOA.