﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Tobin Harris commented on Skinny Controller, Fat Model</title><description>@Mats
  
  
Yeah, the Model wouldn't hold a reference to the Formatter. 
  
  
If I'm honest, I don't fully "get" what should and shouldn't go in the service layer :) I guess that formatting logic *is* often duplicated across several "clients", so the service layer might be as good a place as any. 
  
  
Either way, I think that formatters should be "clost to hand" - a bit like sticking a toolkit in the boot of your car :)
  
  
Will check out that post of yours...
</description><link>http://ayende.com/2816/skinny-controller-fat-model#comment10</link><guid>http://ayende.com/2816/skinny-controller-fat-model#comment10</guid><pubDate>Tue, 02 Oct 2007 10:18:00 GMT</pubDate></item><item><title>Mats Helander commented on Skinny Controller, Fat Model</title><description>Tobin,
  
  
But wouldn't (or at least couldn't) the PersonFormatter be part of the Service Layer? in the MVC example, wouldn't it be enough that the controller knows of the PersonFormatter - no Model classes would need to have references to it, right?
  
  
I just added a post where I describe how I think Obese Domain Models is a widespread enough problem that it should be regarded as an anti-pattern.
  
  
http://www.matshelander.com/wordpress/?p=75
  
  
/Mats
</description><link>http://ayende.com/2816/skinny-controller-fat-model#comment9</link><guid>http://ayende.com/2816/skinny-controller-fat-model#comment9</guid><pubDate>Mon, 01 Oct 2007 11:33:03 GMT</pubDate></item><item><title>Tobin Harris commented on Skinny Controller, Fat Model</title><description>I agree with Scott; I always think that you can just re-apply SRP to solve many of these bloated model problems, making finer cuts to pull responsibilites out.
  
  
Jamis post is great and proves the point really well IMHO. If this particular model got fat, then you could extract "formatting" issues from the model and put them in a formatter or helper :) Therefore, I'd take the knife and make this kind of incision:
  
  
PersonFormatter.name( a_person )
  
PersonFormatter.pseudo_id( a_person )
  
  
  
</description><link>http://ayende.com/2816/skinny-controller-fat-model#comment8</link><guid>http://ayende.com/2816/skinny-controller-fat-model#comment8</guid><pubDate>Mon, 01 Oct 2007 11:00:25 GMT</pubDate></item><item><title>Ayende Rahien commented on Skinny Controller, Fat Model</title><description>Andrew,
  
Yeah, Boo does opens up some very interesting possibilities in this regard, because the cost of using a mixin is removed using this approach.
</description><link>http://ayende.com/2816/skinny-controller-fat-model#comment7</link><guid>http://ayende.com/2816/skinny-controller-fat-model#comment7</guid><pubDate>Mon, 01 Oct 2007 05:27:47 GMT</pubDate></item><item><title>Ayende Rahien commented on Skinny Controller, Fat Model</title><description>Mats,
  
For the simple reason that is is a fair amount of work, and not nearly as easy and natural as it should be
</description><link>http://ayende.com/2816/skinny-controller-fat-model#comment6</link><guid>http://ayende.com/2816/skinny-controller-fat-model#comment6</guid><pubDate>Mon, 01 Oct 2007 05:22:59 GMT</pubDate></item><item><title>Andrew Davey commented on Skinny Controller, Fat Model</title><description>If you are using Boo, then maybe there is syntactic macro to implement an interface by calling a given implementation object.
  
Something like:
  
  
public class MyLargeThing implements IFoo, IBar:
  
  [Proxy(IFoo)] _foo : IFoo = CreateFooImpl()
  
  [Proxy(IBar)] _bar : IBar = CreateBarImpl()
  
  
You would then have a fat object that is composed of little objects.
  
</description><link>http://ayende.com/2816/skinny-controller-fat-model#comment5</link><guid>http://ayende.com/2816/skinny-controller-fat-model#comment5</guid><pubDate>Sun, 30 Sep 2007 23:00:01 GMT</pubDate></item><item><title>Mats Helander commented on Skinny Controller, Fat Model</title><description>"Another approach is to use mixins in Ruby to separate the functionality into different files and mixed it into the User model. I don't really like it, but that is perhaps a matter of taste."
  
  
Using mixins is an option (with AOP) in .NET as well. Why don't you like it?
  
  
/Mats
</description><link>http://ayende.com/2816/skinny-controller-fat-model#comment4</link><guid>http://ayende.com/2816/skinny-controller-fat-model#comment4</guid><pubDate>Sun, 30 Sep 2007 22:24:57 GMT</pubDate></item><item><title>Ayende Rahien commented on Skinny Controller, Fat Model</title><description>For that matter, let us take the example of IAuthorizationService, IAuthenticationSerivce and the User model that I have on the CLR.
  
How would you structure them in Ruby?
  
  
Take into account that there are at least two implementation of the services, for AD and hard coded.
</description><link>http://ayende.com/2816/skinny-controller-fat-model#comment3</link><guid>http://ayende.com/2816/skinny-controller-fat-model#comment3</guid><pubDate>Sun, 30 Sep 2007 21:39:28 GMT</pubDate></item><item><title>Ayende Rahien commented on Skinny Controller, Fat Model</title><description>That is interesting, because the use of IoC bring a lot of dynamics to CLR projects.
  
How do you handle that in Ruby projects?
</description><link>http://ayende.com/2816/skinny-controller-fat-model#comment2</link><guid>http://ayende.com/2816/skinny-controller-fat-model#comment2</guid><pubDate>Sun, 30 Sep 2007 21:38:01 GMT</pubDate></item><item><title>Scott Bellware commented on Skinny Controller, Fat Model</title><description>&gt; what happens when the model get too big? How do you break it up then?
  
  
Same old way... sharpen the blade used to slice responsibilities, and slice them down to finer, related modules, be they classes, mixins, helpers, whatever.
  
  
The difference from .NET would likely be the conspicuous absence of DI as a default means to compose aggregations.
</description><link>http://ayende.com/2816/skinny-controller-fat-model#comment1</link><guid>http://ayende.com/2816/skinny-controller-fat-model#comment1</guid><pubDate>Sun, 30 Sep 2007 21:31:23 GMT</pubDate></item></channel></rss>