Use static methods whenever possible

Avoid over-using class variables, they are appropriate for log, DAO, service and other classes that are used in most methods.
Before (we are not sure where winnerTeamGame is coming from):

private String getDayPlaceList()

{

Game game = winnerTeamGame.getGame();

String isDayOrNight = ((getHour(game)) > 17) ? " night at " : " at ";

return (getDayOfWeek(game.getStartDate()) + isDayOrNight + game.getLocation());

}

After:

 private static String getDayPlaceList(TeamGame teamGame)

{

Game game = teamGame.getGame();

String isDayOrNight = ((getHour(game)) > 17) ? " night at " : " at ";

return (getDayOfWeek(game.getStartDate()) + isDayOrNight + game.getLocation());

}

No comments:

Post a Comment