I tend to go with interfaces too, unless there really is something “I need” that should be shared by all instances of that type (ok, kind of vague, but hey, it’s new year’s eve, right?:) Happy New Year everyone!)
---
Luis Abreu
Might be...but not in this case. For instance, with the current interfaces I
can skip NHibernate if I want that. So, in this case I'm in favor of the
interface.
Luis
> if so, i don't think that's a required feature nor i think it's
> achievable in real projects. I don't know about you but I've never
> switched persistance framework because that's usually a decision make
> in the beginning of the project and well thought in advance. isn't
> this YAGNI again?
Well, I was not as lucky as you and I've had to work in several apps where
persistence was mixed between web services calls, "standard" ado.net and NH
(and yes, we changed persistency framework after releasing v1 of the
product). But this isn't the important thing here and that is not the only
reason I say it's important to have an IRepository interface. To me, the
most important thing is that with this approach gives me better coupling
between the components and db information stays out of my main domain
project.
Again, there really isn't any well defined approach that works everywhere
but I think that the IRepository interface is a good option for this
scenario.
I'm still not sure on why you say this is YAGNI...
Luis
It seems like we agree on it, then :)
>
> the YAGNI goes to the need of having to switch persistence because for
> most projects (not only small) that's not a requirement. you said you
> worked on a project like that and I believe you but that's not a
> reason to include it in a generic architecture like S#arp.
I see YAGNI as adding features you're not needing. I see the IRepository
interface as decoupling. That's why I don't think it's YAGNI. Again, I might
be wrong, but until I'm proved wrong, that's how I'm seeing the current
architecture. And what do you guys think?
Luis
I have for the last few years as a matter of necessity (why waste all that time?) left final DB schema to the end.
It’s insanely easy once you get used to it. After all the only transform in most cases would be related to two items:
1) Performance Tuning (and we know to do that last already)
2) Legacy Compatibility for part of the schema
3) Test Data Maintenance (to avoid imports to changed schema)
4) Complex Second-Level Caching Scenarios
I am having a hard time thinking what possible value could be added in caring until at least the 80% done mark about denormalization, index optimization, etc.
#4 – If your ORM does not abstract this, get a new ORM. Don’t try unless you are cornered by a knife wielding ninja to write a read/write distributed synchronized cache here either… We all know to love immutability I am assuming when we can have it.
#3 – test data : If you care about this your not likely using a mock framework with any automated build regression. That is a much, much larger showstopper.
#1 - That is deployment/non-functional performance related and you couldn’t possibly know what you need to do until the end anyway. See: Premature Optimization.
NHibernate and the wrapper over it (ActiveRecord) as well as others really make this painfully easy. It gets people excited when you talk about it because it seems to be against conventional wisdom, but after bring home many quite large DDD systems for a long time now, what could I be missing?
If there is any downside, I cannot imagine the huge time savings over the cycles would not exponentially make up for it.
Damon
From:
sharp-arc...@googlegroups.com
[mailto:sharp-arc...@googlegroups.com] On Behalf Of Kyle Baley
Sent: Friday, January 02, 2009 11:12 AM
To: sharp-arc...@googlegroups.com
Subject: Re: Why interfaces?
Yeah, I agree with you (though it's not quite as disastrous as you might think, especially with NHibernate). Typically, I put off creating the database only until I write my first integration test. Which is usually pretty early.
> > Luis<br
Uh.. I mean 4 items (grin)..
I have for the last few years as a matter of necessity (why waste all that time?) left final DB schema to the end.
It’s insanely easy once you get used to it. After all the only transform in most cases would be related to two items:
1) Performance Tuning (and we know to do that last already)
2) Legacy Compatibility for part of the schema
3) Test Data Maintenance (to avoid imports to changed schema)
4) Complex Second-Level Caching Scenarios
I am having a hard time thinking what possible value could be added in caring until at least the 80% done mark about denormalization, index optimization, etc.
#4 – If your ORM does not abstract this, get a new ORM. Don’t try unless you are cornered by a knife wielding ninja to write a read/write distributed synchronized cache here either… We all know to love immutability I am assuming when we can have it.
#3 – test data : If you care about this your not likely using a mock framework with any automated build regression. That is a much, much larger showstopper.
#1 - That is deployment/non-functional performance related and you couldn’t possibly know what you need to do until the end anyway. See: Premature Optimization.
NHibernate and the wrapper over it (ActiveRecord) as well as others really make this painfully easy. It gets people excited when you talk about it because it seems to be against conventional wisdom, but after bring home many quite large DDD systems for a long time now, what could I be missing?
If there is any downside, I cannot imagine the huge time savings over the cycles would not exponentially make up for it.
Damon
From:
sharp-arc...@googlegroups.com
[mailto:sharp-arc...@googlegroups.com] On Behalf Of Kyle Baley
Sent: Friday, January 02, 2009 11:12 AM
To: sharp-arc...@googlegroups.com
Subject: Re: Why interfaces?
Yeah, I agree with you (though it's not quite as disastrous as you might think, especially with NHibernate). Typically, I put off creating the database only until I write my first integration test. Which is usually pretty early.
> > Luis<br