Skip to main content

All Questions

Tagged with
0 votes
2 answers
890 views

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
0 votes
1 answer
535 views

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
3 votes
1 answer
522 views

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
4 votes
1 answer
5k views

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
6 votes
1 answer
2k views

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
3 votes
2 answers
716 views

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
1 vote
1 answer
93 views

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
  • 953
1 vote
1 answer
224 views

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
  • 113