﻿<?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>Adrian commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>Ayende - my understanding that the controllers were the VM's came from this statement 'Controllers – Stand at the edge of the system and manage interaction with the outside world. Can be MVC controllers, MVVM models, WCF Services.'

Are you referring to the M or the VM in MVVM as the controller ?

Understand the risks with asynch SL, but trade off is workable as number of asynch calls is low compared to number of possible user interactions.  Asynch nature of SL is tested via traditional UI Automation framework.

</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment37</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment37</guid><pubDate>Sat, 18 Feb 2012 00:16:08 GMT</pubDate></item><item><title>Ayende Rahien commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>Adrian,
What gives you the assumption that my controller would be a view model here?
Also, trying to abstract the async stuff that makes SL so annoying would create a very false sense of security.

Controllers stand at the edges of the system, but they usually don't interact directly with the UI.</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment36</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment36</guid><pubDate>Sat, 18 Feb 2012 00:01:02 GMT</pubDate></item><item><title>Adrian commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>Would I be correct in thinking that your objections are unnecessary architectural separation of business logic and added layering of the application, resulting in additional complexity ?

The specific application that I am referring to is a 'thick' client Silverlight app.  

By separating business logic explicitly from the controllers, in this case view models, we are able run the 'application' in a non-silverlight context using an acceptance test framework.  The benefits of being able to run acceptance tests on the server sans network &amp; silverlight runtime are significant.  Despite the costs involved.
</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment35</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment35</guid><pubDate>Fri, 17 Feb 2012 23:50:51 GMT</pubDate></item><item><title>Ayende Rahien commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>Adrian,
I strongly object to this world view. I see no point in trying to do this.</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment34</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment34</guid><pubDate>Fri, 17 Feb 2012 23:04:22 GMT</pubDate></item><item><title>Adrian commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>Ayende - I would usually try and remove any business logic from controllers to enable the use of an acceptance test framework to operate on application logic independently from the UI.  Controllers and Views would be tested as part of a UI automation testing suite.

To perform acceptance testing would you include controllers in what is being tested by an acceptance test framework ?</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment33</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment33</guid><pubDate>Fri, 17 Feb 2012 23:02:22 GMT</pubDate></item><item><title>Dan commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>I think it's worth noting that oftentimes WCF services that you consider a "controller" have an interface abstraction purely so that the ServiceContract can be placed in a separate assembly that will be shared by client applications to use as service proxies.

This doesn't detract from your overall message, but just wanted to point out that it should be an extra consideration before removing that abstraction.</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment32</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment32</guid><pubDate>Thu, 16 Feb 2012 22:57:37 GMT</pubDate></item><item><title>Ayende Rahien commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>Lars,
In many cases, BO with rules and behaviors turn out to be things like validation. That isn't interesting and can be pushed to the infrastructure.

If you have real business logic, we need to decide whatever it is something that belongs to the entity, or are we trying to force it into it out of a sense of architectural purity.

I don't want to categorically say that I don't do that, and I don't want to say that I do.</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment31</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment31</guid><pubDate>Thu, 16 Feb 2012 04:01:56 GMT</pubDate></item><item><title>Lars-Erik Kindblad commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>@Ayende: So you dont have any domain or business objects with rules and behavior but rather POCO entities? And any business logic would go inside a command or task which is sort of similar to a domain service?</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment30</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment30</guid><pubDate>Thu, 16 Feb 2012 03:55:39 GMT</pubDate></item><item><title>Ayende Rahien commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>Haroon,
It is _very_ rare for commands and tasks to do the same thing. By their very nature, they are doing different things.
Authorization is something that is rarely done by tasks (they usually act on behalf of the system, not a specific user).
</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment29</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment29</guid><pubDate>Thu, 16 Feb 2012 01:23:47 GMT</pubDate></item><item><title>haroon commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>To further on my last comment - I remember from one of your previous posts you mentioned extension methods, however some permission checks or "background checks" can involve db, or other services, if all checks are fine then proceed...</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment28</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment28</guid><pubDate>Thu, 16 Feb 2012 00:18:59 GMT</pubDate></item><item><title>Haroon commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>@Ayende: if a commands and tasks have similar/exact same business logic i.e. can this booking be accessed by currentuserid, where is this code held, static classes? extension methods?

e.g. UpdateBooking (first check if user can perform action)
DeleteBooking (check if user is a manager)</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment27</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment27</guid><pubDate>Thu, 16 Feb 2012 00:15:55 GMT</pubDate></item><item><title>afif commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>Tyrone,
The source code for this blog (raccoon blog) is a good example to see Oren's principles in practice.</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment26</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment26</guid><pubDate>Wed, 15 Feb 2012 22:56:15 GMT</pubDate></item><item><title>Tyrone commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>Hi Ayende,

+1 for Mads Laumann. Do you have a sample that illustrates this infrastructure? Have you come across a project on lets say github, that we can view a working sample application. Thanks for the post again!
</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment25</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment25</guid><pubDate>Wed, 15 Feb 2012 19:31:47 GMT</pubDate></item><item><title>Ayende Rahien commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>JP,
new Booking() should do that.
</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment24</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment24</guid><pubDate>Wed, 15 Feb 2012 18:41:14 GMT</pubDate></item><item><title>J.P. Hamilton commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>Great post! I am curious, though. How would you handle encapsulating something like creating a new Booking (which may have default values that need to be set based upon some business rules) and returning that to a Controller to eventually be displayed? It's situations like this where I would have an IBookingService with the appropriate method. </description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment23</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment23</guid><pubDate>Wed, 15 Feb 2012 14:39:57 GMT</pubDate></item><item><title>Daniel Lang commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>+1 for increasing the publishing frequency on your future posts pipeline. These posts are just too valuable to keep them secret!</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment22</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment22</guid><pubDate>Wed, 15 Feb 2012 14:15:43 GMT</pubDate></item><item><title>Jesse commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>One of my favorite posts and comment threads. Very informative all around.</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment21</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment21</guid><pubDate>Wed, 15 Feb 2012 14:02:44 GMT</pubDate></item><item><title>Khalid Abuhakmeh commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>I always wonder about events in a web application. How do you take advantage of that particular abstraction in a web application (please don't mention WebForms)?

Since requests are fleeting, do you use something like NServiceBus or MassTransit or do you do something else?

</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment20</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment20</guid><pubDate>Wed, 15 Feb 2012 12:32:31 GMT</pubDate></item><item><title>Ryan Penfold commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>I see where you're coming from on this Ayende, could you give us an example of an alternative to this code please?</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment19</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment19</guid><pubDate>Wed, 15 Feb 2012 11:58:46 GMT</pubDate></item><item><title>Ayende Rahien commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>Flukus, 
For the most part, yes. 
If they are invoked by something else (timed trigger, an action) they are jobs / events.</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment18</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment18</guid><pubDate>Wed, 15 Feb 2012 11:14:35 GMT</pubDate></item><item><title>flukus commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>"If you have a complex business process, you might need a command."

But are commands only ever invoked by user actions?</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment17</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment17</guid><pubDate>Wed, 15 Feb 2012 11:10:37 GMT</pubDate></item><item><title>Ayende Rahien commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>Joe,
In this case, I don't care for that, so it isn't implemented.</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment16</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment16</guid><pubDate>Wed, 15 Feb 2012 10:46:22 GMT</pubDate></item><item><title>Ayende Rahien commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>Jonty,
Events are good if I have business requirements based on events. When the booking is cancelled, we need to process a cancellation fee, for example.
How to handle them depends on the system, the requirements, etc.
It moves from simple in memory processing (invoked by integrating into the save pipeline of the data access) to full blown Saga handling using a message bus.</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment15</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment15</guid><pubDate>Wed, 15 Feb 2012 10:44:21 GMT</pubDate></item><item><title>Ayende Rahien commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>Flukus,
Nothing as rigid as that, no. _If_ you have a complex business process, you might need a command.
And _if_ you have something that needs to run outside the current execution thread, you might need a task.</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment14</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment14</guid><pubDate>Wed, 15 Feb 2012 10:42:52 GMT</pubDate></item><item><title>Jonty commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>@Ayende - When do you decide to use an event rather than call into a "service" synchronously in order to perform some action?

Also, what infrastructure do you use to raise/handle events? Do you do the in-process or out (ie in-memory or message bus)?</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment13</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment13</guid><pubDate>Wed, 15 Feb 2012 10:29:57 GMT</pubDate></item><item><title>flukus commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>So with this architecture would it be fair to say that:

1. Users issue commands (cancel booking button somehow invokes CancelBookingCommand).
2. Tasks respond to events (IHandleSomething).</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment12</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment12</guid><pubDate>Wed, 15 Feb 2012 10:22:59 GMT</pubDate></item><item><title>Ayende Rahien commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>Haroon,
If you are talking about trivial commands. I don't do them. I just inline the logic inside the controller.
The examples you gave are all things that are likely to have significant business logic. Cancel Booking needs to calculate cancellation fees. BookIt requires to actually do the booking, reserve things, etc.
Update Booking might need to charge more money, etc.

If I have a set of commands that are related, they are likely to be in the same folder/namespace, yes.</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment11</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment11</guid><pubDate>Wed, 15 Feb 2012 09:32:11 GMT</pubDate></item><item><title>Even commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>The booking-class example is an anti-pattern I have named "pass-the-ball"-architecture.</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment10</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment10</guid><pubDate>Wed, 15 Feb 2012 09:16:55 GMT</pubDate></item><item><title>haroon commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>@Ayende - in a system where there is a whole bunch of related/similar updating of entities, I am assuming from your posts you are saying they wont be held in the same class, i.e. a class for each command/task. e.g.
BookIt, UpdateBooking, CancelBooking - all held in their own class and grouped by namespace (in the same folder)?

The current way I have seen this is 1 service interface and its implementation as shown in your example that will hold all the *related* business logic - you are moving away from this, could we also say you are breaking up the code for simplicity of understanding - therefore making the code easier to maintain?</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment9</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment9</guid><pubDate>Wed, 15 Feb 2012 09:14:20 GMT</pubDate></item><item><title>Ayende Rahien commented on Limit your abstractions: All cookies looks the same to the cookie cutter</title><description>Torkel,
Sure, those are all decisions that you need to do.
I tend to think about commands as participating in the same transaction, tasks have their own transaction.
Note that executing multiple commands should be rare and usually considered to be a smell. 
If you need to do that, you aren't building your commands at the right level of abstraction.
</description><link>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment8</link><guid>http://ayende.com/154145/limit-your-abstractions-all-cookies-looks-the-same-to-the-cookie-cutter#comment8</guid><pubDate>Wed, 15 Feb 2012 09:08:01 GMT</pubDate></item></channel></rss>