FEX icon indicating copy to clipboard operation
FEX copied to clipboard

Rework frequently used anti-patterns in the codebase

Open skmp opened this issue 3 years ago • 3 comments

Some commonly used anti-patterns that make our lifes harder while working with FEX

  • Re-use of class names with different namespaces (makes navigation, search and replace, debugging hard)
  • Overly, inconsistently namespaced codebase
  • File names that don't match the class name, or missmatching .h/.cpp file names
  • Inline forward declarations in header files
  • Inconsistent grouping of helper libs

These should all be addressed.

skmp avatar Aug 22 '22 09:08 skmp

  • Broader use of virtual interfaces to hide implementation details
  • Investigate C++ modules [2024+, when ubuntu 20.04 is no longer a supported target]

skmp avatar Aug 29 '22 17:08 skmp

From #1842 code ranges bug -> analysis needs to not affect global state.

skmp avatar Aug 29 '22 21:08 skmp

We also need to have strong, uniform, consistent and easy to use primitives to leverage Design by Contract

I've been using asserts like LogMan::Throw::AFmt(CTX->CodeInvalidationMutex.try_lock() == false, "CodeInvalidationMutex needs to be unique_locked here"); but they are fragile (eg, this one can't tell the mutex is unique_locked and from our thread as it sure, it just checks if it is any locked from any thread) and unstructured.

Refs:

  • https://en.wikipedia.org/wiki/Design_by_contract
  • https://dlang.org/spec/contracts.html

skmp avatar Aug 31 '22 08:08 skmp