Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor game identifier #213

Closed
6 tasks done
lukatarman opened this issue Apr 11, 2024 · 0 comments · Fixed by #207
Closed
6 tasks done

Refactor game identifier #213

lukatarman opened this issue Apr 11, 2024 · 0 comments · Fixed by #207
Assignees
Labels
feature New application feature: what should the app do? highest Priority of the feature refactoring Improving of code

Comments

@lukatarman
Copy link
Owner

lukatarman commented Apr 11, 2024

Description

  • Refactor game identifier and code related to it. The goal is to streamline the process of getting html pages and checking for games/their details. A lot of the code currently is repeating and/or is unoptimized.

Technical Design

  • Use xViaSource (eg. checkIfGameViaSource, triedViaSource) pattern to combine repeatable code into one method.
  • Use this in steam app data model, game identifier and steam web client
  • Refactor game identifier by combining repeatable patterns in the code into separate methods
  • Move code from game.service.js into the appropriate data models as methods
  • Introduce aggregates for groups/arrays of games/steam apps. Use said aggregated when modifying groups of games/steam apps
  • Games repository and steam apps repository should now return these aggregates
@lukatarman lukatarman added feature New application feature: what should the app do? highest Priority of the feature refactoring Improving of code labels Apr 11, 2024
@lukatarman lukatarman self-assigned this Apr 11, 2024
@lukatarman lukatarman linked a pull request Apr 11, 2024 that will close this issue
lukatarman added a commit that referenced this issue Apr 11, 2024
Combined methods of getting info on whether or not a steam app is a game into method called checkIfGameViaSource
Used same technique in steam app data model for marking a steam app as check via and failed via html attempts
Used same technique in steam web client for making calls to different html pages
Refactored repeatable code/patterns in game identifier and made it cleaner and more readable
Moved code from game.service.js into appropriate data models as methods
Introduced aggregates for groups/arrays of steam apps/games. Used methods on these when modifying/accessing them
These aggregates are used when getting groups of game/steam apps from database
Made other smaller refactoring changes and improvements

Previously, the code in the app's game identifier was quite messy - different methods that had very similar roles would sometimes use different code. This has been streamlined into one reusable method with a "source" variable. Likewise when making calls to HTML pages. We are now also using aggregates when modifying/accessing  groups of games or steam apps, reducing code complexity in the higher levels of the code.

Issue-Ref: #213
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New application feature: what should the app do? highest Priority of the feature refactoring Improving of code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant