logo

Design and Testing of Object Oriented Classes and Methods in Java

   

Added on  2023-06-12

8 Pages1208 Words97 Views
1
Table of contend
1. Design of classes according to OO paradigm.....................................................2
2. Design of a method...................................................................................4
2.1 Example of a View Method....................................................................4
2.2 Example of a Controller Method..............................................................4
2.3 Example of a Model Method..................................................................5
3. Testing...................................................................................................6
4. Visibility of Classes, Methods and Fields.........................................................7
5. References .............................................................................................8
Design and Testing of Object Oriented Classes and Methods in Java_1
2
Section 1 : Design of classes according to OO paradigm
1) I have used interfaces for my class design for enabling abstraction. The controller is accessible to the outside world
by my Controller Interface. All the requests that come from the user for any controller first goes to my Interface. Then,
Main Controller implements this interface to carry out the main functionality. The main controller do not carries any
functionality on its own. But passes requests to Charity controller or Watcher controller according to what is required.
So a complete segregation of Control is there for each and every controller.
Interface Screenshot
Main Controller implementing Interface
Design and Testing of Object Oriented Classes and Methods in Java_2
3
2) In all object oriented languages abstraction and encapsulation plays a very crucial role. I have used enums in my
project for Regions and animal species. Also Method overloading is used for overloading the methods of the base class.
I have overloaded equals and hashcode method in the screenshot given below for easy comparision of Objects. Also
constructors are used for Object initialization. Each instance variable in the model is of private scope and getteres and
setters are used for their access for security and limited access. The instance variables of the object are accessible only
through getters and setters or can be initialized by the constructor. Direct access to the variables is restricted. Also,
Coupling and cohesion is used. In the diagram Animal class has an instance variable AnimalClassification. So every
animal has a Classification which is other external ENUM.
Enum,Abstraction,Encapsulation and Overloading used in Classes
Design and Testing of Object Oriented Classes and Methods in Java_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Design of classes and methods in Java for Desklib online library
|8
|1208
|324

Core concept Figure Assignment
|9
|1726
|33

Object Oriented Design and Programming
|10
|3226
|70