tag:blogger.com,1999:blog-6579772240267288367.post5187507475924931210..comments2023-06-05T08:45:12.716-04:00Comments on kwblog: Service Layers or OOP?Kevin Berridgehttp://www.blogger.com/profile/13759114853595462455noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-6579772240267288367.post-51240500825555621582015-06-25T23:28:03.496-04:002015-06-25T23:28:03.496-04:00Hi Kevin, cool article!
I think the advantage of ...Hi Kevin, cool article!<br /><br />I think the advantage of this techniques comes from 'Admitting the ignorances'.<br /><br />We admit that we don't know some operations should belong to what objects/classes.<br /><br />We admit that we don't know, and we don't care.<br /><br />They are just some operations for now, and we don't want to waste time on finding a 'place' for these operations.<br /><br />So we just make it a service objects. And that's it.<br /><br />We can re-factor them later, so we keep the flexibility. <br /><br />We admit the ignorance and make it a stand-alone service object, so we keep the clarity.<br /><br />We save a lot of time for now, so we keep the dev speed.<br /><br />Cheers!<br /><br />Tony阿川https://www.blogger.com/profile/01776399695037003154noreply@blogger.comtag:blogger.com,1999:blog-6579772240267288367.post-56061543326386933852012-02-14T13:54:09.010-05:002012-02-14T13:54:09.010-05:00I'm a little embarrassed to admit that I didn&...I'm a little embarrassed to admit that I didn't read your entire blog post this morning. I got as far as "Service Layer" pattern and posted links to Fowler. ;-)<br /><br />We've been beating the service-layer drum pretty loudly at Within3 so I'll definitely give this a complete read later, especially with respect to your comparison with the pattern documented by Fowler.<br /><br />-JerryAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6579772240267288367.post-81176905727066036022012-02-14T10:50:02.681-05:002012-02-14T10:50:02.681-05:00Hehe, thanks Jerry. Yeah, I've read poeaa, bu...Hehe, thanks Jerry. Yeah, I've read poeaa, but I don't think what I'm describing is _exactly_ the same as what Fowler describes. According to Fowler, "a Service Layer defines an application's boundary and its set of available operations from the perspective of interfacing client layers". So in my silly example, PresentationApi is definitely a Service Layer. But OrdersSpeaker is a service, but doesn't fit Fowler's Service Layer definition. And it's this layering of services depending on other services that I was (poorly) trying to call out as possibly being bad OO. I should have called it "Service Layers" or something just to make it that much more distinct.<br /><br />But, you did just prompt me to re-read Fowler's Service Layers chapter, and it pretty much directly confirms what I was writing about. So thanks for that! I'd forgotten what he had to say about "Identifying Services and Operations."Kevin Berridgehttps://www.blogger.com/profile/13759114853595462455noreply@blogger.comtag:blogger.com,1999:blog-6579772240267288367.post-83037998108933206432012-02-14T10:18:34.340-05:002012-02-14T10:18:34.340-05:00"I don't know if there is a widely accept..."I don't know if there is a widely accepted name for this pattern, so I'm just going to call it the Service Layer Pattern."<br /><br />Did you try Googling "Service Later"? http://martinfowler.com/eaaCatalog/serviceLayer.html<br /><br />Martin Fowler documented that pattern in his 2002 Book "Patterns of Enterprise Application Architecture" http://www.amazon.com/Patterns-Enterprise-Application-Architecture-Martin/dp/0321127420 It's a great book and IMO should be on every programmer's shelf right next to GoF.<br /><br />-Jerry<br />@JerryKnowsCodeAnonymousnoreply@blogger.com