Our project is in its early stages and we are currently using Uncle Bob's Clean Architecture (also known as the Onion Architecture).
An overview of our project is as follows:
domain
package- Contains our business entities
usecases
package- Contains operators that use our
domain
entities to perform use cases - Contains repository interfaces for entities that need to interact with an unspecified database
- Contains operators that use our
interfaces
package- Contains handlers for triggering the correct
usecases
operators and use cases - Implements our
usecases
repository interfaces (tailored to LDAP) - Contains a database interface for performing database operations (using LDAP)
- Contains handlers for triggering the correct
infrastructure
package- Implements our
interfaces
database interface (using LDAP)
- Implements our
Our business entities are pure data structures whose only business logic is being linked to each other via UUIDs.
While the above approach decouples us from any database technology and lets us test our code independently of our database, any change in LDAP (such as adding/renaming/deleting fields) requires code changes to be made before they can be used.
Because LDAP is basically a map of maps (you can think of it as a HashMap<String, HashMap<String, Object>>
), our project manager recently got the idea of taking a "stateless" approach where our application only needs to keep track of what field names client apps are using and the corresponding field names in LDAP.
His proposed solution aims to avoid having to change lots of code in our project and only need to work with a configuration file that keeps track of said name pairs.
e.g. Proposed JSON Configuration File Format (using a Map of Maps)
{
"entity1Fields": {
"uiFieldName1": "ldapFieldName1",
"uiFieldName2": "ldapFieldName2",
"uiFieldName3": "ldapFieldName3"
},
"entity2Fields": {
"uiFieldName1": "ldapFieldName1",
"uiFieldName2": "ldapFieldName2"
}
}
Our questions are:
Are there any possible development/testing issues with this approach?
Can a "stateless" approach remove the need for pure data structure
domain
entities, or will completely relying on the configuration file cause development/testing complexities, especially when working with said entities and their fields?Can the Clean/Onion Architecture be done with a "stateless" approach?
Is there a better way to implement a "stateless" approach?
Is taking a "stateless" approach (even when just working with pure data structures) generally a bad idea?
Any advice would be greatly appreciated.