Daniel Garcia
03/13/2021, 2:28 AMCole
03/13/2021, 2:37 PMCole
03/13/2021, 2:39 PMCole
03/13/2021, 2:52 PMDaniel Garcia
03/13/2021, 3:13 PMcompile
path equal to the runtime
path. I hate having to play computer every time I read code.
Every concept that you mentioned above lacks this.Chris G
03/13/2021, 7:15 PMtrygve
).
The idea of DCI is essentially that a model can have a "role" snapped onto it as needed, which provides behavior for the model. When you need the system to do something (ie, a use case), you have a use case object load data models, snap roles on them, and the roles provide new functions β run the functions, then release everything (data model objects go back to being plain vanilla without particular role behaviors).
What this does is deconstruct & relieve the pressure put on traditional objects (at least the 90s-00s notions of objects) to be all things for all use cases. Instead, a model primarily becomes just Data (the D in DCI) that can perform different Interactions in different Contexts.
It cleans up a codebase because what you primarily see are use cases (context object definitions), and then the models and roles that fulfill the use cases. It's easy to learn what a system can do, and the code reveals in a straightforward way how behavior is implemented.
I haven't used it outside of database-oriented projects (tables are nice forcing functions to define models). It worked perfectly in rails. I'm not sure how I'd use it in a strongly-typed language. I think it has a lot of untapped potential.Daniel Garcia
03/13/2021, 7:51 PMIt's easy to learn what a system can do, and the code reveals in a straightforward way how behavior is implemented.^ This is the part about DCI that I'm interested the most. Do you have en example a bit more involved than the classic
TransferMoney
?
I'm looking into introducing DCI to Ruby/Rails codebase πDaniel Garcia
03/13/2021, 7:57 PMChris G
03/13/2021, 8:21 PMDaniel Garcia
03/13/2021, 8:34 PMChris G
03/14/2021, 1:07 AMDaniel Garcia
03/14/2021, 10:34 PMa model primarily becomes just Data (the D in DCI) that can perform different Interactions in different Contexts.The idea sounds similar to what you mentioned @Cole:
I would personally gravitate towards in comparison to patterns more compatible with data-oriented programming (often found in Rust)Do have any resources about
data-oriented programming
?Cole
03/14/2021, 10:47 PMCole
03/14/2021, 10:52 PMCole
03/14/2021, 10:54 PM