Jak Charlton - Insane World - All Commentshttp://devlicio.us/blogs/casey/default.aspxHang the code, and hang the rules. They&#39;re more like guidelines anywayenCommunityServer 2008.5 SP1 (Build: 31106.3070)clash of clans astucehttp://devlicio.us/blogs/casey/archive/2008/09/30/where-did-filtercontext-actionmethod-go.aspx#119019Tue, 07 Oct 2014 17:24:33 GMT40756a8b-6212-4073-9d98-6c26781577de:119019clash of clans astuce<p>Where Did filterContext.ActionMethod Go? - Jak Charlton - Insane World - Devlicio.us - Just the Tasty Bits</p>
<img src="http://devlicio.us/aggbug.aspx?PostID=119019" width="1" height="1">Domain Driven Designhttp://devlicio.us/blogs/casey/archive/2009/03/11/ddd-invariants-or-contextual-validation.aspx#70836Thu, 17 Jan 2013 21:38:48 GMT40756a8b-6212-4073-9d98-6c26781577de:70836TrackBack<img src="http://devlicio.us/aggbug.aspx?PostID=70836" width="1" height="1">Greenfield Development with ASP.NET MVC & S#arp Lite - Day 2http://devlicio.us/blogs/casey/archive/2009/02/11/ddd-bounded-contexts.aspx#70373Sat, 13 Oct 2012 01:25:34 GMT40756a8b-6212-4073-9d98-6c26781577de:70373Billy McCafferty<p>A series of posts providing proven guidance for developing ASP.NET MVC applications from idea to well</p>
<img src="http://devlicio.us/aggbug.aspx?PostID=70373" width="1" height="1">Recovering a Project with ASP.NET MVC and Agile - Jak Charlton - Insane World - Devlicio.us - Just the Tasty Bitshttp://devlicio.us/blogs/casey/archive/2008/08/13/recovering-a-project-with-asp-net-mvc-and-agile.aspx#69722Fri, 27 Apr 2012 14:32:02 GMT40756a8b-6212-4073-9d98-6c26781577de:69722Blue Ray Plus - Latest Technology News<p>Thank you for submitting this cool story - Trackback from Blue Ray Plus - Latest Technology News</p>
<img src="http://devlicio.us/aggbug.aspx?PostID=69722" width="1" height="1">re: Avoiding Prescriptive Requirementshttp://devlicio.us/blogs/casey/archive/2012/02/09/avoiding-prescriptive-requirements.aspx#69486Thu, 09 Feb 2012 08:43:37 GMT40756a8b-6212-4073-9d98-6c26781577de:69486Nick<p>I agree, I&#39;ve started using SpecFlow <a rel="nofollow" target="_new" href="http://www.specflow.org/">http://www.specflow.org/</a> for this. It has the concept of Features that describe your core requirements, and Scenarios which describe the detailed implementations/flows.</p>
<div style="clear:both;"></div><img src="http://devlicio.us/aggbug.aspx?PostID=69486" width="1" height="1">re: Single Action per Controller in ASP.NET MVChttp://devlicio.us/blogs/casey/archive/2011/07/11/single-action-per-controller-in-asp-net-mvc.aspx#67991Thu, 14 Jul 2011 13:58:23 GMT40756a8b-6212-4073-9d98-6c26781577de:67991Quooston<p>I agree, using partial classes in order to disguise bigger problems related to SRP and such is not a good thing. I don&#39;t believe one action per controller is a good thing either. </p>
<p>I would say that if you can&#39;t handle a Login, and a Logout action in one controller based on an overzealous SRP gland, you&#39;re just not being pragmatic enough. </p>
<p>Also, often times in something like a repository class, partials come in handy all the time; and not due to infrastructure requirements either. Linq statements can become very verbose and sometimes it makes a lot of sense to split the class into partials purely for the sake of readability. And no, creating another repo just because of a verbose syntax, citing SRP as a reason is not a good answer there either.</p>
<div style="clear:both;"></div><img src="http://devlicio.us/aggbug.aspx?PostID=67991" width="1" height="1">re: Single Action per Controller in ASP.NET MVChttp://devlicio.us/blogs/casey/archive/2011/07/11/single-action-per-controller-in-asp-net-mvc.aspx#67985Wed, 13 Jul 2011 02:49:01 GMT40756a8b-6212-4073-9d98-6c26781577de:67985Jak Charlton<p>Partial classes should only ever be used by code generation</p>
<p>Splitting code arbitrarily across files just to increase readability is masking another problem and creating more problems - if it&#39;s too long/complex to read easily in one file, it&#39;s probably breaking SoC, SRP and a whole bunch of other good practices</p>
<p>But mostly, this is about splitting responsibility - there should be only one reason for a class to change - and a controller with even fairly closely related methods has many reasons for change</p>
<div style="clear:both;"></div><img src="http://devlicio.us/aggbug.aspx?PostID=67985" width="1" height="1">re: Single Action per Controller in ASP.NET MVChttp://devlicio.us/blogs/casey/archive/2011/07/11/single-action-per-controller-in-asp-net-mvc.aspx#67978Tue, 12 Jul 2011 10:53:43 GMT40756a8b-6212-4073-9d98-6c26781577de:67978Quooston<p>+1 for partial classes for better organization. </p>
<div style="clear:both;"></div><img src="http://devlicio.us/aggbug.aspx?PostID=67978" width="1" height="1">re: Single Action per Controller in ASP.NET MVChttp://devlicio.us/blogs/casey/archive/2011/07/11/single-action-per-controller-in-asp-net-mvc.aspx#67971Tue, 12 Jul 2011 03:42:42 GMT40756a8b-6212-4073-9d98-6c26781577de:67971tobi<p>1) and 2) can be solved by training - be pragmatic, not obsessive. 3) is harder. I solved it by using a base class receiving a bunch of common services by property injection and extending the action invoker to inject dependencies as method parameters.</p>
<div style="clear:both;"></div><img src="http://devlicio.us/aggbug.aspx?PostID=67971" width="1" height="1">re: Single Action per Controller in ASP.NET MVChttp://devlicio.us/blogs/casey/archive/2011/07/11/single-action-per-controller-in-asp-net-mvc.aspx#67970Mon, 11 Jul 2011 19:10:48 GMT40756a8b-6212-4073-9d98-6c26781577de:67970jrnail23<p>Hi Jak, good to see someone else exploring this approach as well. &nbsp;Here&#39;s a link to Derek Greer&#39;s discussion of single action controllers, which also asks and answers some interesting questions: <a rel="nofollow" target="_new" href="http://lostechies.com/derekgreer/2011/04/29/single-action-controllers-with-asp-net-mvc">lostechies.com/.../single-action-controllers-with-asp-net-mvc</a></p>
<div style="clear:both;"></div><img src="http://devlicio.us/aggbug.aspx?PostID=67970" width="1" height="1">re: Single Action per Controller in ASP.NET MVChttp://devlicio.us/blogs/casey/archive/2011/07/11/single-action-per-controller-in-asp-net-mvc.aspx#67969Mon, 11 Jul 2011 18:57:31 GMT40756a8b-6212-4073-9d98-6c26781577de:67969Jon Galloway<p>While it doesn&#39;t help at all with SRP issues (cases of overly complex controllers and constructor overload abuse), if you want to split up actions among multiple files for readability you can just split a controller into partial classes.</p>
<div style="clear:both;"></div><img src="http://devlicio.us/aggbug.aspx?PostID=67969" width="1" height="1">re: Single Action per Controller in ASP.NET MVChttp://devlicio.us/blogs/casey/archive/2011/07/11/single-action-per-controller-in-asp-net-mvc.aspx#67968Mon, 11 Jul 2011 12:25:28 GMT40756a8b-6212-4073-9d98-6c26781577de:67968Mike<p>is this smart, or just plain trickery?</p>
<p>1) Use a single .cs file with separate controller classes</p>
<p>2) Use a single .cs file with a single class with several nested controller classes.</p>
<p>I experimented with each but it&#39;s more about code organisation...</p>
<div style="clear:both;"></div><img src="http://devlicio.us/aggbug.aspx?PostID=67968" width="1" height="1">re: Single Action per Controller in ASP.NET MVChttp://devlicio.us/blogs/casey/archive/2011/07/11/single-action-per-controller-in-asp-net-mvc.aspx#67967Mon, 11 Jul 2011 12:05:03 GMT40756a8b-6212-4073-9d98-6c26781577de:67967Martin<p>I took a similar approach with the Tinyweb framework I wrote, where a Handler class can have Get/Post/Put/Delete methods only and the handler class itself determines the URL. </p>
<p>From your example, IndexHandler, LogonHandler and LogoffHandler would produce /index, /logon and /logoff respectively and force the pattern you mention.</p>
<p>You can find the project here if you&#39;re interested: <a rel="nofollow" target="_new" href="https://github.com/martinrue/Tinyweb">github.com/.../Tinyweb</a></p>
<div style="clear:both;"></div><img src="http://devlicio.us/aggbug.aspx?PostID=67967" width="1" height="1">re: Single Action per Controller in ASP.NET MVChttp://devlicio.us/blogs/casey/archive/2011/07/11/single-action-per-controller-in-asp-net-mvc.aspx#67966Mon, 11 Jul 2011 08:37:07 GMT40756a8b-6212-4073-9d98-6c26781577de:67966Jak Charlton<p>1) You don&#39;t end up with massive controller classes</p>
<p>2) Due to the relative verbosity of C#, a controller class is mostly filled with blank lines and braces (controllers should have almost no logic). I find that doing this lets me concentrate easily on the actual functionality and not have to scan a lot of whitespace</p>
<p>3) and most important of all - you don&#39;t do things like overloading constructors with a dozen services or repositories to support every operation - you can focus on the single responsibility the controller action really has. SRP FTW :)</p>
<div style="clear:both;"></div><img src="http://devlicio.us/aggbug.aspx?PostID=67966" width="1" height="1">re: Single Action per Controller in ASP.NET MVChttp://devlicio.us/blogs/casey/archive/2011/07/11/single-action-per-controller-in-asp-net-mvc.aspx#67965Mon, 11 Jul 2011 08:26:14 GMT40756a8b-6212-4073-9d98-6c26781577de:67965hazzik<p>What advantages of this approach?</p>
<div style="clear:both;"></div><img src="http://devlicio.us/aggbug.aspx?PostID=67965" width="1" height="1">