Skip to content

More unit test refactoring#134

Merged
simoninns merged 7 commits intosimoninns:mainfrom
RulecityLLC:MoreUnitTestRefactoring
Mar 17, 2026
Merged

More unit test refactoring#134
simoninns merged 7 commits intosimoninns:mainfrom
RulecityLLC:MoreUnitTestRefactoring

Conversation

@mpownby
Copy link
Copy Markdown

@mpownby mpownby commented Mar 17, 2026

Summary

This PR represents my best attempt at ideal architectural patterns/examples to maximize encapsulation and testability. I've updated TESTING.md with my latest thoughts on the subject.

Noteworthy conventions I have settled on and am recommending:

  • I was leaning toward passing around raw pointers for convenience, but after I got into deeper refactoring, I realized that this would require a lot of extra null checking which seemed undesirable. So I've backed away from using pointers (except in cases where it's necessary, as explained in TESTING.md) and now favor references instead. From what I've read, the compiler treats pointers and references the same under the hood so there is no optimization benefit to using pointers over references, and references don't require null checking because the compiler won't allow them to be set to null (unless the developer intentionally forces this through trickery).
  • As for dependency injection, I am proposing that only interfaces be injected into constructors, with a separate 'init' method to pass in other dependencies.

I've tried to make the several new classes I've created over the last few weeks consistent so that they are stable examples of these patterns. I also updated TESTING.md accordingly.

Type of change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other

Validation

Build passes, unit tests pass.

Checklist

  • Scope is focused and minimal
  • Build passes locally
  • Related docs were updated if needed
  • Linked issue (if applicable)

Related issue

Closes #

@simoninns simoninns merged commit c88cb8b into simoninns:main Mar 17, 2026
7 checks passed
@mpownby mpownby deleted the MoreUnitTestRefactoring branch March 27, 2026 00:43
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