PathOfBuildingCommunity / PathOfBuildingCommunity/PathOfBuilding

Convert GlobalCache to its own class

Open
#2,385 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

technical
Dominant language
Lua
Stars
5.4k
Forks
2.4k
Avg merge
1d 12h
Merged PRs (30d)
26

Description

In general, Common.lua should be for functions that can be used on any table or number or other type. Many of these functions there are very specific to the GlobalCache. A few options I'd rather see

  1. Make the functions more generic (e.g. for mergeDB here, have it be mergeTables and call it twice for conditions and multipliers)
  2. Move the functions to a separate file specifically for managing the GlobalCache (might be worth turning GlobalCache into a proper OO class potentially)
  3. Some of the functions are only used in one place. It might be better off having those functions in the file that uses them either as a local function or a function defined in that file instead of polluting the global namespace

Originally posted by @Wires77 in https://github.com/PathOfBuildingCommunity/PathOfBuilding/pull/2294#discussion_r602679854

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by auditing the GlobalCache-specific functions in Common.lua and tracing their call sites. Compare the three proposed directions—generic helpers, a dedicated GlobalCache file or class, and localizing single-use functions—before choosing a design. Done means the responsibilities are separated without changing existing behavior, but this issue does not define a specific acceptance test.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.