Refactor to remove dependency of DrivenEngine on World
This commit is contained in:
62
Docs/Module-Dependencies-in-Luprex.md
Normal file
62
Docs/Module-Dependencies-in-Luprex.md
Normal file
@@ -0,0 +1,62 @@
|
||||
# Module Dependencies in Luprex
|
||||
|
||||
Modules are listed in dependency order — each module's dependencies
|
||||
all appear earlier in the list. Where a dependency comes only from
|
||||
the `.cpp` file (not the `.hpp`), it is marked **(cpp-only)**.
|
||||
|
||||
- **bytell-hash-map** — third-party hash map (header-only)
|
||||
- **eng-malloc** — custom deterministic memory allocator
|
||||
- **enginewrapper** — pure C interface for driver/driven boundary
|
||||
- **fast-float** — third-party float parser (header-only)
|
||||
- **flat-hash-map** — third-party hash map (header-only)
|
||||
- **spookyv2** — hash function
|
||||
- **util** → spookyv2
|
||||
- **luastack** → util
|
||||
- **luavector** → luastack
|
||||
- **traceback** → luastack
|
||||
- **debugcollector** → util
|
||||
- **streambuffer** → eng-malloc, luastack, util
|
||||
- **table** → luastack
|
||||
- **drivenengine** → enginewrapper, invocation, streambuffer, util
|
||||
- **json** → luastack, util
|
||||
- **http** → drivenengine, json(cpp-only), luastack, streambuffer
|
||||
- **planemap** → luastack, util
|
||||
- **luasnap** → luastack, streambuffer
|
||||
- **serializelua** → luastack, streambuffer
|
||||
- **sched** → luastack, streambuffer
|
||||
- **idalloc** → debugcollector, luastack, streambuffer
|
||||
- **invocation** → enginewrapper, streambuffer
|
||||
- **pprint** → luastack, table, util
|
||||
- **source** → debugcollector, luastack, luasnap, streambuffer, table(cpp-only), traceback, util
|
||||
- **animqueue** → debugcollector, luastack, streambuffer, util
|
||||
- **printbuffer** → debugcollector, invocation, streambuffer, util
|
||||
- **world** → animqueue, debugcollector, http, idalloc, invocation, luasnap, luastack, planemap, printbuffer, pprint, sched, serializelua, source, streambuffer, table, traceback
|
||||
- **lpxclient** → drivenengine, invocation, printbuffer, util, world
|
||||
- **lpxserver** → drivenengine, luastack, printbuffer, util, world
|
||||
- **eng-tests** → drivenengine, streambuffer, world
|
||||
|
||||
## Observations
|
||||
|
||||
### http depends on drivenengine (header-level)
|
||||
|
||||
`http.hpp` includes `drivenengine.hpp` because it uses
|
||||
`SharedChannel` (defined in drivenengine). Meanwhile, `world`
|
||||
depends on both `http` and `drivenengine`, and `drivenengine`
|
||||
depends on `world`. This creates a layering tangle:
|
||||
|
||||
```
|
||||
world -> http -> drivenengine -> world
|
||||
```
|
||||
|
||||
The `SharedChannel` type (`std::shared_ptr<Channel>`) is really an
|
||||
I/O concept from the driver boundary. Moving `SharedChannel` and
|
||||
`Channel` into a smaller, lower-level header (perhaps
|
||||
`enginewrapper.hpp` or a new `channel.hpp`) would let `http` drop
|
||||
its dependency on `drivenengine` entirely.
|
||||
|
||||
### world is a mega-consumer (16 dependencies)
|
||||
|
||||
`world` depends on nearly every other module. This is expected for
|
||||
the central game-state container, but it does make `world` hard to
|
||||
test in isolation. The `world-*.cpp` split into multiple files
|
||||
helps readability but doesn't reduce coupling.
|
||||
Reference in New Issue
Block a user