So I have a class called Game
and I need to retrieve several objects of Game
from the database based on their session ID, so I have this method:
public ArrayList<Game> getGamesBySession
Okay, but I have to pass a parameter there so I would know which session's games I want to retrieve and I have two possibilities. I can either pass an int
or I can pass an object of Session
which has an attribute id
and then use session.getID()
. In the end, both would result in the same thing basically, but what I am wondering is something else.
My question is, which is a better approach and if I pass an object, would it mean that Game
is high coupled with Session
and violates GRASP?