3.9. Separating the User Interface: The Console Class

As we mentioned when discussing the Standings class, the presentation logic was removed from that class. The presentation logic was in two methods: printConferenceStandings() and printDivisionStandings(). For this round of refactoring, we've simply separated those methods but otherwise left them intact.

With the separation, Console now becomes our main class, rather than Standings. If you examine the main() method, you'll see that we create both a Console object and a Standings object, and then alternately invoke methods of the Standings object (to perform calculations) and the Console object (to display the results).

Console doesn't get a separate interface class; this is because Console ...

Get J2EE™ and JAX™: Developing Web Applications and Web Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.