WikibaseLexeme
MediaWiki WikibaseLexeme extension
|
High level PHP code organization of Wikibase Lexeme.
This document describes what the main directories are responsible for, what kinds of code they can contain and what kinda of code they can bind to. Currently these restrictions are preliminary and they are often violated. This document is thus more about where we want to go than accurately describing the current state.
Contains business code. Cannot contain any presentation code, persistence bound code, framework bound code or code specific to a single Interactor/UseCase.
Interactors are application code. One directory per interactor. Interactors cannot contain any presentation code, persistence bound code or framework bound code or code. See the Use Cases section in the Clean Architecture blog post.
At the moment the dependency restrictions for Interactors are often violated. The idea is to work towards adhering to these restrictions.
Persistence service implementations. All code binding to persistence mechanisms (ie database, elastic search) should reside here. In other words, no code outside this directory is allowed to know about persistence details like database tables.
Framework binding is allowed here (though might still make sense to avoid in certain sets of code).
It likely makes sense to treat MediaWiki pages, revisions, etc, as persistence mechanism.
All presentation mechanism (ie web, console) specific code goes here. This means that code dealing with HTML tags or HTTP request parameters that is in another directory is misplaced. No domain logic should be invoked from presentation code.
Framework binding is allowed here (though might still make sense to avoid in certain sets of code).
Implementation of MediaWiki hook mechanisms such as MediaWiki hooks, special pages and API modules.
Ideally these do not contain any application code and instead invoke an Interactor.
This has its own directory since it belongs to both presentation and persistence layers (which is somewhat odd).