Skip to main content

All Questions

0votes
2answers
890views

Object Oriented Design for chess

Recently I came across some article on Chess OOPS design.Following is some snippet from it: public class Chess { ChessBoard chessBoard; Player[] player; Player currentPlayer; List<...
rahul sharma's user avatar
0votes
1answer
535views

How to design inheritance from abstract class which is not initiated but seemingly must be initiated?

I need to design a program in Java which calculates arithmetic expressions (only addition or subtraction). Requirements: 1) abstract class Expression which contains abstract method calculate()...
Yos's user avatar
  • 167
3votes
1answer
522views

Best design for classes that draw objects but do not inherit from JPanel

I'm doing the exercise 10.1, page 476 from the book Java: How To Program, Early Objects by Paul and Harvey Deitel (10th Edition). Modify the MyLine, MyOval and MyRectangle classes of GUI to create ...
Yos's user avatar
  • 167
4votes
1answer
5kviews

Designing generic type inheritance hierarchy

I have now put another rephrased version of original question as requested by the user in the comments with class names mimicking real world scenario of postal office (though I dont know how real ...
Mahesha999's user avatar
6votes
1answer
2kviews

Access methods from two interfaces's implementation in a Class

I am trying to implement the following pattern in a Cache layer. I'm splitting the implementation of possible Cache methods such as getUsers() in UserCache Class, getLikes() in PostsCache class. But ...
Magesh Kumaar's user avatar
3votes
2answers
716views

Correct way to extend a hierarchy tree

I have the following tree currently to be implemented in Java. My problems are the following: How can I go about addressing the fact Admin needs to have all tier 4 logic from both branches of the ...
Leon's user avatar
  • 207
1vote
1answer
93views

Object passed to super() referenced by subclass - Any Violations?

This is the code in question, comments point it out: class Actor extends Entity { private MutableVector2f position; private MutableIdentity identity; public Actor(MutableVector2f ...
Dioxin's user avatar
1vote
1answer
224views

Pattern to share fields in inheritance

I'm trying to figure out the best way to solve a design issue. I have to be able to clone (I'm cloning them to Apache HttpClient) different types of HttpServletRequest (POST, GET...) and then send ...
carcaret's user avatar

close