Skip to content

Refactor code base #9

Open
lexlam1524 wants to merge 5 commits intothoth-tech:mainfrom
lexlam1524:Refactor-code-base-
Open

Refactor code base #9
lexlam1524 wants to merge 5 commits intothoth-tech:mainfrom
lexlam1524:Refactor-code-base-

Conversation

@lexlam1524
Copy link

@lexlam1524 lexlam1524 commented Sep 23, 2024

Title: Implement Mediator Pattern and Rename Classes

Overview:
This pull request introduces the Mediator design pattern to improve communication between objects in our game architecture. Additionally, several classes have been renamed to enhance code clarity and align with the new design structure.

Changes Made:

  1. Mediator Pattern Implementation:

    • Introduced a GameMediator class that centralizes communication between different components, such as players, obstacles, and rain.
    • Refactored existing interactions to use the GameMediator, reducing direct dependencies between classes.
    • Updated methods in Player, Obstacle, and RAIN classes to interact through the GameMediator.
  2. Class Name Changes:

    • Renamed Subject to BEE_PLAYER to better reflect its role in the game.
    • Renamed Observer to RAIN to clarify its purpose and enhance readability.
    • Updated all references to the old class names throughout the codebase to maintain consistency.

Benefits:

  • Decoupling: The Mediator pattern reduces the dependencies between classes, making the system more modular and easier to maintain.
  • Readability: Renaming classes improves code clarity, making it easier for new developers to understand the architecture.

Type of change

Code

How Has This Been Tested?

Compiled and ran with
skm g++ program.cpp player.cpp obstacle.cpp GameManager.cpp -o game.exe

Checklist

My code follows the style guidelines of this project
I have performed a self-review of my own code
I have commented my code in hard-to-understand areas
I have made corresponding changes to the documentation
My changes generate no new warnings
I have requested a review from team members on the Pull Request

Copy link

@AmberPotion AmberPotion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix merge conflicts in order for the PR to be approved.

@lexlam1524
Copy link
Author

fixed conflict

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants