Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

the statement needs a reply in 75 words or more thx Object oriented programming

ID: 3539187 • Letter: T

Question

the statement needs a reply in 75 words or more thx


Object oriented programming (OOP) has become the de factor standard for programming, regardless of the medium. Java uses OOP principles throughout all the applications for deskopt, mobile and web software, other languages such as Python use OOP for robotics applications on embedded chips, and both Android and iOS operating systems require object oriented programming techniques to build mobile applications. There are a number of reasons why OOP offers a more robust programming environment than typical procedural languages. One of the main benefits to using OOP principles is that it allows your code to become modular, in other words if you build a number of useful functions for one application, you can easily reuse those classes, attributes and methods in future projects, this ability lets programmers re-use code that has been tested and is easily initialized.

One of the other key benefits is encapsulation. By being able to keep your variables and methods inside of classes, a programmer can protect the access points of the application's data so it is utilized properly. Being able to use private and protected classes enables a coder to ensure instance variables are not accessed incorrectly, and allows the programmer to create getter and setter methods for proper access points. Programming in OOP also allows for faster debugging since the compiler errors will immediately reference the class that is causing any breaks in the program. If the methods and variables were all placed in the same file, debugging would be much more difficult.

Explanation / Answer

The ability to make changes in your code without breaking the code of all others who use your code is a key benefit of encapsulation. You should always hide implementation details. To elaborate, you must always have your variables as private and then have a set of public methods that others can use to access your variables. Since the methods are public anyone can access them, but since they are in your class you can ensure that the code works the way that is best for you. So in a situation that you want to alter your code, all you have to do is modify your methods. No one gets hurt because i am just using your method names in my code and the code inside your method doesnt bother me much.

If you want maintainability, flexibility, and extensibility (and I guess, you do), your design must include encapsulation. How do you do that?
%u2022 Keep instance variables protected (with an access modifier, mostly private).
%u2022 Make public accessor methods, and force calling code to use those methods rather than directly accessing the instance variable.
%u2022 For the methods, use the JavaBeans naming convention of set and get.