Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Piotr Solnica
@solnic
not really an enforcer, just a signal that it's a concrete dependency being a boundary
repos are objects because it's better to have them as abstract stuff, this is 100 x bigger than a small object validating data (well ok a schema is big but not even close to the size of a repo object giving you access to data in your db including data mutation interfaces)
besides if these were not objects we would have to stick globals like db connections to classes etc, do-not-like
Tim Riley
@timriley
So concrete dependency == something that's just not another internal object in our app's core, something a bit more "foreign"
Is that kinda what you're saying?
Piotr Solnica
@solnic
wdym by "foreign"?
Tim Riley
@timriley
Foreign as is not quite like the other objects that comprise our app's core behavior, all of which are in the container. Foreign as in a bit like using another gem, even.
Piotr Solnica
@solnic
haven't thought about it like that
Tim Riley
@timriley
I can't equate it to the explicit require etc. we need for instantiatiiself value objects, because this is still a functional object and could be in our container
Piotr Solnica
@solnic
foreign as in external to the app's container, yes, of course
Tim Riley
@timriley
Yeah, that's what I meant
Piotr Solnica
@solnic
I think about schemas as types too
Tim Riley
@timriley
I'm gonna need to come up with a different injection scenario for my talk, haha
Piotr Solnica
@solnic
it's an fp object that responds to call but it also very strictly defines a very specific type of data that your app deals with
Tim Riley
@timriley
Yeah, I think I'm starting to get you now
Piotr Solnica
@solnic
so even though we don't instantiate an instance of that "type" a schema still defines "a type"
I can say exactly the same thing about domain types defined by dry-types structs and values
Tim Riley
@timriley
This is true!
Piotr Solnica
@solnic
it's just that source data for these types come from a db, not an http request
Tim Riley
@timriley
Yeah. And I don't care abut injecting them because there are so many. It's completely unwarranted.
So I guess the same rule can apply to schemas
Piotr Solnica
@solnic
yeah, I think DI is a good tool for "service objects"
as in stuff that does something heavy, esp with side-effects
and you may want to replace it, or decorate it, or sutin
Tim Riley
@timriley
Yeah
I hear you
Oskar Szrajer
@gotar
ok all looks to work (basic skeleton), but a little magic to drop in next step
^ magic here ;]
@timriley your blog posts and repos was a HUGE help
it's so kard to glue everything together for the first time, a lot more blog posts and docs needed
Tim Riley
@timriley
@gotar oh cool! So you've got it now?
@gotar yeah, I hope I can write some more stack-specific docs over the next 2 weeks. And my blog posts... Well, they'll get there eventually. They have a plodding pace :)
Oskar Szrajer
@gotar
I manage it somehow but not happy how ;]
Tim Riley
@timriley
Hah, so have you had to use a hack or something? Or it just took longer than you hoped to get to the solution?
because ROM::Relation do not works with basic one - Container::Inject
or hack root for rom::repo, to have base class to limit code repetition, like: https://github.com/gotar/dry-web-skeleton/blob/master/lib/persistence/repo/base.rb#L15
probably other places too, like class around dry-v schema to make it AutoInjectable
Oskar Szrajer
@gotar
if you guys have time, any comments welcome, trying to build as simple skeleton as possibe. Your @timriley is great but to complex to just teach/explain/show different dry-web pieces
Piotr Solnica
@solnic
I'd call dry-web stuff as a pretty advanced thingie (at least for now)
so it's gonna be tough to explain to people who mostly know rails
Oskar Szrajer
@gotar
yeap i will try 3-4h workshops for good devs but rails ways devs
we will see
I already told them something about roda and rom, but they never wrote any app outside rails
then I plan to write some basic roda + rom app, and then go deeper and deeper inside container, auto-inject ...
we will see
Piotr Solnica
@solnic
it's gonna be interesting for sure :D
hanami will be a much much better "entry point" for people, I think