Project Overview:
In this project, I recreated Carcassonne in Java using Swing as the GUI. My objective was to achieve the software architecture principles of high extensibility, cohesion, and information hiding, while maintaining low coupling and a low representational gap. Before coding, I created a comprehensive technical design document that I highly encourage you check out above. It takes the project from the domain model, through to object interaction diagrams and the object model, justifying each design choice. I used Gradle to build, Checkstyle to ensure clean code, and JaCoCo to ensure my code had 100 percent test coverage.

Key Software Engineering Decisions:
• The core gameplay classes have no knowledge of the GUI implementation. The GUI updates itself through a "listener" via the observer pattern. When you press a button, it calls a public method inside Game Manager. This is good information hiding, as the gameplay logic has no reason to be coupled with the GUI.  
• I employed the controller heuristic by assigning responsibility of system-level behavior to the Game Manager class, lowering the representational gap and increasing cohesion.
• The tiles in this project are immutable to make them safer—the game returns a new tile object when you rotate them. 
• Features (monasteries, roads, cities, fields) employ the template method pattern because much of the algorithmic logic between each feature is the same, with only two key exceptions: how features identify open edges and how they add them to the list. This pattern will increase reusability, and therefore safety and extensibility. Abstracted, the Game Manager also does not need to know what kind of feature it is manipulating.
• Standard information hiding practices: keeping fields private, utilizing getters and setters, only functions that need to be public actually are.

Benefits of extensibility: very easy to make a new Carcassonne deck, just describe each tile and its features!

Back to Top