Academic architectural experiments.
- Modeling is hard, so do models as late as possible
- UseCases as code artifacts, tested against each other - they describe system
- System as black box with command/query interactions on surface
- Rails is just frontend - not your application
- use_cases - use cases in code
- interactions - atoms for use cases
- messaging - outgoing messages
- domain - models for use cases implementation
- web_ui - rails frontend
APPLICATION can be described as black box by set of USE CASES it implements. The potential of application is possibility to quickly implement more new USE CASES.
Modeling is hard! Especially on early stages of system development.
Refactoring wrong model is pain, especially when this model is everywhere in all layers of application.
Rails problems:
-
rails does not have USE CASE artifacts in code, so the USE CASE logic is distributed between ui, controllers and models
-
rails force you do modeling on early stage of development
IDEAS:
- UseCase Layer gathering application behavior.
- Map use cases directly into code artifacts.
- Consolidate inter use case dependencies in specs.
- Prototype using simple use case implementation to get feedback as soon as possible.
- Use Cases is testable only by use cases (as black box)
- Responsibility of Models just to implement use cases and dependencies between them.
- Models can be refactored toward Deeper Insight under guard of use cases tests.
Arguments:
- BDD (duck typing) - behavior is matter - what the system does is more important than how the system does it
- Red - Green - Refactor: Design Use Cases -> KISS implementation -> Refactor to deep insight (when requirements is clear)
- Lean - do hard thinks as late as possible
- See what is your application (do u go into interface to understand what app do?)
- wrong model refactoring pain
- early modeling pain
- controllers is technical thing, models is one layer up of abstraciton
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request