<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-6163229697457544811</atom:id><lastBuildDate>Mon, 02 Sep 2024 07:42:17 +0000</lastBuildDate><category>Technical</category><category>Spark</category><category>FAQ</category><category>VS Extensibility</category><category>Windows Azure</category><category>FubuMVC</category><category>General Info</category><category>Presentations</category><category>Best Practices</category><category>NuGet</category><category>jQuery</category><title>RobertTheGrey</title><description>... in pursuit of coding wizardry</description><link>http://blog.robertgreyling.com/</link><managingEditor>noreply@blogger.com (Robert Greyling)</managingEditor><generator>Blogger</generator><openSearch:totalResults>22</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-921628122672369442</guid><pubDate>Mon, 08 Nov 2010 14:46:00 +0000</pubDate><atom:updated>2010-11-08T14:47:01.142+00:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">jQuery</category><category domain="http://www.blogger.com/atom/ns#">Spark</category><category domain="http://www.blogger.com/atom/ns#">Technical</category><title>Spark and jQuery Templates learn how to play nice</title><description>&lt;p&gt;A couple of folks are running into trouble while trying to use the recently popular &lt;a href=&quot;http://api.jquery.com/category/plugins/templates/&quot;&gt;jQuery Templates&lt;/a&gt; in combination with the &lt;a href=&quot;http://sparkviewengine.com&quot; target=&quot;_blank&quot;&gt;Spark View Engine&lt;/a&gt; for one innocuous, simple reason – they both use the &lt;font color=&quot;#4f81bd&quot;&gt;${blah}&lt;/font&gt; syntax as placeholders for their magic bits. It is now gaining &lt;em&gt;even more&lt;/em&gt; popularity due to &lt;a href=&quot;http://blog.stevensanderson.com/&quot;&gt;Steve Sanderson’s&lt;/a&gt;&amp;nbsp;&lt;em&gt;AWESOME&lt;/em&gt; &lt;a href=&quot;http://knockoutjs.com/&quot;&gt;Knockout JS library&lt;/a&gt; and I’m not surprised – it seriously kicks ass!&lt;/p&gt; &lt;a name=&#39;more&#39;&gt;&lt;/a&gt;  &lt;p&gt;I guess somebody didn’t really think the syntax through and have a good look at what was already out there, but I think it’s things like this that really test the metal of a framework in its ability to be flexible and co-exist happily with others. Getting them to play nice with as little friction for the developer is key in getting adoption up in all areas.&lt;/p&gt; &lt;h2&gt;The Problem&lt;/h2&gt; &lt;p&gt;For this post I’ll be using &lt;a href=&quot;http://codeofrob.com/&quot;&gt;Rob Ashton’s&lt;/a&gt; RavenDB Gallery &lt;a href=&quot;https://github.com/robashton/RavenGallery&quot;&gt;sample on github&lt;/a&gt; since it uses both Spark as a View Engine and jQuery Templates for loading images and details.&lt;/p&gt; &lt;p&gt;Take a look at this view:&lt;/p&gt;&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false; highlight: [14,15];&quot;&gt;&amp;lt;content name=&quot;title&quot;&amp;gt;Home Page&amp;lt;/content&amp;gt;&lt;br&gt;&amp;lt;content name=&quot;scripts&quot;&amp;gt;&lt;br&gt;    &amp;lt;script type=&quot;text/javascript&quot; src=&quot;~/Includes/js/image-browser.js&quot; &amp;gt;&amp;lt;/script&amp;gt;&lt;br&gt;&amp;lt;/content&amp;gt;&lt;br&gt;&amp;lt;h2&amp;gt;The RavenDB Image Gallery&amp;lt;/h2&amp;gt;&lt;br&gt;&amp;lt;p&amp;gt;&lt;br&gt;    This is an example ASP.NET MVC application using RavenDB, &lt;br&gt;    MVC2, StructureMap, Moq and NUnit&lt;br&gt;&amp;lt;/p&amp;gt;&lt;br&gt;&amp;lt;label for=&quot;searchText&quot;&amp;gt;Search&amp;lt;/label&amp;gt;&lt;br&gt;&amp;lt;input type=&quot;text&quot; id=&quot;searchText&quot; name=&quot;searchText&quot; /&amp;gt;&lt;br&gt;&amp;lt;script id=&quot;browsing-image-template&quot; type=&quot;text/x-jquery-tmpl&quot;&amp;gt;&lt;br&gt;    &amp;lt;div class=&quot;browsing-image&quot;&amp;gt;&lt;br&gt;        &amp;lt;h4&amp;gt;${Title}&amp;lt;/h4&amp;gt;&lt;br&gt;        &amp;lt;img src=&quot;/Resources/Image/${Filename}&quot; alt=&quot;${Title}&quot; /&amp;gt;&lt;br&gt;    &amp;lt;/div&amp;gt;&lt;br&gt;&amp;lt;/script&amp;gt;&lt;br&gt;&amp;lt;div id=&quot;image-browser&quot;&amp;gt;&lt;br&gt;&amp;lt;/div&amp;gt;
&lt;/pre&gt;
&lt;p&gt;Notice the highlighted lines above are referencing jQurey template values inside the &lt;font color=&quot;#4f81bd&quot;&gt;${ xyz }&lt;/font&gt; syntax. The issue here is that Spark gets the first stab at these files, and if it sees the &lt;font color=&quot;#4f81bd&quot;&gt;${ xyz }&lt;/font&gt; syntax, it tries to parse the view using the variable &lt;em&gt;&lt;strong&gt;it&lt;/strong&gt;&lt;/em&gt; knows about, which will either lead to unexpected results because you have the same variables defined in Spark and in jQuery.templ,&amp;nbsp; or it will fail completely due to a Spark dynamic view compilation error since it knows nothing about &lt;font color=&quot;#4f81bd&quot;&gt;${Title}&lt;/font&gt; or &lt;font color=&quot;#4f81bd&quot;&gt;${Filename}&lt;/font&gt;.&lt;/p&gt;
&lt;h2&gt;The Workaround&lt;/h2&gt;
&lt;p&gt;Now there are already a couple of workarounds that have been used. For example, by using jQuery to load up the templates via an AJAX call will bypass the Spark rendering engine unless it’s specifically a Spark Javascript View, but this means you take the asynchronous hit for something that might not be ideal. Another solution is to use the alternate jQuery Templates syntax which Spark doesn’t recognise. It looks like this: &lt;font color=&quot;#4f81bd&quot;&gt;{{= Title }}&lt;/font&gt; … pretty ain’t it? Yeah…I didn’t think so either.&lt;/p&gt;
&lt;h2&gt;One Solution&lt;/h2&gt;
&lt;p&gt;Well of course the ultimate solution would be for the developer to just throw any old syntax in there and the collective frameworks just figure out which bits to parse and which bits to leave alone, but there are two reasons I didn’t want to try and achieve that. Firstly, the next guy who has to come and read your code may just decide it’s worth it to take a contract out on your life, and I don’t want to take responsibility for that :-). To work out programmatically what the developer wants is one thing, and in a way it’s a nice puzzle to solve, but working with and maintaining that code will not be a pleasant or intuitive experience.&lt;/p&gt;
&lt;p&gt;Some might look at the view above and say that they don’t like the fact that a fat script tag has just dropped itself down in the middle our HTML mark-up without an invite. Heck, that’s going to make plenty of developers do a double-take – it’s just not natural and creates a disconnect in the flow of the code. Just like if someone decided to solve a complex algorithm inside an IF statement in the middle of a method, you would expect a good developer who cares about code maintainability and readability to extract that complexity into a different method right? Right?!&lt;/p&gt;
&lt;p&gt;Well that’s basically what we’ve done as a first stab at supporting jQuery Templates. That same view above will simply be split into two files, kind of like extracting the complexity into it’s own method. We use an existing feature in Spark called the &lt;font color=&quot;#4f81bd&quot;&gt;&amp;lt;include&amp;gt;&lt;/font&gt; tag and use the new &lt;font color=&quot;#4f81bd&quot;&gt;parse=”html”&lt;/font&gt; option which basically passes the contents though without parsing for Spark variables or HTML encoding it. The result looks something like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh19bsJTal1En-Pe8PT-T9Gh93cBgRrRU7elBj8eqSR89KlGNrGvCyL_CaqlFZpkK9cil7nZTDyV-RIJ0VkgmZB8omXecRLLtQcc7TEOcPtOJhi_gQ4VLvrpTZ0DCz47-62yuxT6MsupVY/s1600-h/image%5B6%5D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlBdbapDliCPeJgifiY5oaNQLoxxxM5kyS0aDOYnMOSvwXjBcVMy5L6QDWxnpYv5Tn3lKgKx9-XcyS2i8HxSm2IeW6qytmaCoLmYgMNiAhFB1_Pr2o7YI-i4uyk4ndtKAlZnV3u2ctCBE/?imgmax=800&quot; width=&quot;323&quot; height=&quot;130&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;Index.spark&lt;/h3&gt;&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false; highlight: [11];&quot;&gt;&amp;lt;content name=&quot;title&quot;&amp;gt;Home Page&amp;lt;/content&amp;gt;&lt;br&gt;&lt;br&gt;&amp;lt;h2&amp;gt;&lt;br&gt;    The RavenDB Image Gallery&amp;lt;/h2&amp;gt;&lt;br&gt;&amp;lt;p&amp;gt;&lt;br&gt;    This is an example ASP.NET MVC application using RavenDB, MVC2, StructureMap, Moq&lt;br&gt;    and NUnit&amp;lt;/p&amp;gt;&lt;br&gt;&amp;lt;label for=&quot;searchText&quot;&amp;gt;Search&amp;lt;/label&amp;gt;&lt;br&gt;&amp;lt;input type=&quot;text&quot; id=&quot;searchText&quot; name=&quot;searchText&quot; /&amp;gt;&lt;br&gt;&lt;br&gt;&amp;lt;include href=&quot;browsing-image-template.htm&quot; parse=&quot;html&quot; /&amp;gt;&lt;br&gt;&lt;br&gt;&amp;lt;div id=&quot;image-browser&quot;&amp;gt;&lt;br&gt;&amp;lt;/div&amp;gt;&lt;/pre&gt;
&lt;p&gt;And the extracted file can be called anything you like, but as you can see, I’ve named it something useful and given it a “.htm” extension so that we get the benefits of the HTML editor in Visual Studio:&lt;/p&gt;
&lt;h3&gt;browsing-image-template.htm&lt;/h3&gt;&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;script id=&quot;browsing-image-template&quot; type=&quot;text/x-jquery-tmpl&quot;&amp;gt;
  &amp;lt;div class=&quot;browsing-image&quot;&amp;gt;
    &amp;lt;h4&amp;gt;${Title}&amp;lt;/h4&amp;gt;
    &amp;lt;img src=&quot;/Resources/Image/${Filename}&quot; alt=&quot;${Title}&quot; /&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/script&amp;gt;
&lt;/pre&gt;
&lt;p&gt;As you can see now, we’ve also achieved some form of &lt;a href=&quot;http://en.wikipedia.org/wiki/Separation_of_concerns&quot;&gt;Separation of Concerns&lt;/a&gt; where the flow of the original mark-up is undisturbed, and the included template complexity gets its own space to operate in during the writing and maintenance of the code, but when come it comes to the browser requesting the view, it is fully rendered on the server and delivered in a perfect single HTTP stream with all the right bits falling in to the right places.&lt;/p&gt;
&lt;h2&gt;OK – Now gimmeh teh dllz&lt;/h2&gt;
&lt;p&gt;It just so happens that you can get the latest &lt;a href=&quot;http://blog.robertgreyling.com/2010/11/dont-just-get-spark-view-engine-nuget.html&quot;&gt;via the NuGet package manager&lt;/a&gt; direct in Visual Studio. If you just want the raw release package in a zip file, you can always download the latest &lt;a href=&quot;http://teamcity.codebetter.com/project.html?projectId=project29&quot;&gt;from here&lt;/a&gt; and just login as an anonymous guest.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;To be clear, this is only one way of achieving the solution, but I am keen to try it out on the audience that care because there is still a decent sized hole with this method. Namely, the question arises: What if you &lt;em&gt;do&lt;/em&gt; want to use some Spark Variables inside your jQuery Templates? What if you &lt;em&gt;do&lt;/em&gt; want the view engine to parse things inside there?&lt;/p&gt;
&lt;p&gt;Well I’d like to see some examples of that before spending the time figuring out a more complex method of escaping, because I’m not entirely convinced that would be a good or maintainable design. I’m happy to be convinced otherwise, but for now I would suggest that this is a better way…&lt;/p&gt;
&lt;p&gt;Until next time,&lt;br&gt;&lt;a href=&quot;http://twitter.com/RobertTheGrey&quot; target=&quot;_blank&quot;&gt;Robert The Grey&lt;/a&gt;&lt;/p&gt;  </description><link>http://blog.robertgreyling.com/2010/11/spark-and-jquery-templates-learn-how-to.html</link><author>noreply@blogger.com (Robert Greyling)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlBdbapDliCPeJgifiY5oaNQLoxxxM5kyS0aDOYnMOSvwXjBcVMy5L6QDWxnpYv5Tn3lKgKx9-XcyS2i8HxSm2IeW6qytmaCoLmYgMNiAhFB1_Pr2o7YI-i4uyk4ndtKAlZnV3u2ctCBE/s72-c?imgmax=800" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-871624413111394957</guid><pubDate>Mon, 08 Nov 2010 00:55:00 +0000</pubDate><atom:updated>2010-11-08T01:01:10.199+00:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">NuGet</category><category domain="http://www.blogger.com/atom/ns#">Spark</category><category domain="http://www.blogger.com/atom/ns#">Technical</category><category domain="http://www.blogger.com/atom/ns#">VS Extensibility</category><title>Don’t just get the Spark View Engine - NuGet it now</title><description>&lt;p&gt;For a couple of weeks now the &lt;a href=&quot;http://sparkviewengine.com&quot; target=&quot;_blank&quot;&gt;Spark View Engine&lt;/a&gt; has been available as a package from the NuGet server but last night it had a bit of a makeover.&lt;/p&gt; &lt;p&gt;If you open the package manager and filter on “Spark” as I have, you’ll see two copies of the Spark Core and the Spark.Web.Mvc packages. The highlighted one is the latest build, and the other is the latest release from a while before that – version 1.1 to be exact. At this stage, I would recommend using the latest build due to a number of fixes and additions that have been added recently.&lt;/p&gt; &lt;a name=&#39;more&#39;&gt;&lt;/a&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdKtgqVJ73jtUD3ZYIcJg7dfYNig_syiqMSxcpC9JrlE5VkSxfuWeLS1KEHl4LpsIxtvLGWb7VwA4P8N6fgLq65s6WYcLmZ52ytCyDOmLo7UObk6MFGTnyqF7IPxn82zBcN692ALNc3qQ/s1600-h/image_thumb63.png&quot;&gt;&lt;img style=&quot;background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px&quot; title=&quot;image_thumb[6]&quot; border=&quot;0&quot; alt=&quot;image_thumb[6]&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNj80vbMcXqoZbFRZor0l3MIjrAfPu-4yfD2YKI2VaPLQ-VE19X22GSgXJOAL2Jy3pffWHGozb-bGQmBr1u937fENqoS0tGV80GTt1SmicX35xK5d4PkyaXrUMmj1yPRkcsHyJzqWAnWw/?imgmax=800&quot; width=&quot;800&quot; height=&quot;450&quot;&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h2&gt;What’s the difference?&lt;/h2&gt; &lt;p&gt;Well, the nice thing about getting Spark via the NuGet Package Manager is that for a new project, it will also automatically bootstrap the view engine code into the Application_Start which means you basically go “File –&amp;gt; New MVC Project”, reference Spark via the NuGet Package Manager, and you’re ready to start creating views and controllers. &lt;/p&gt; &lt;p&gt;All the wiring is taken care of. Well how is that done pray tell?&lt;/p&gt; &lt;p&gt;Well, we’re taking advantage of one of the other packages in the NuGet list called the WebActivator package which we take a dependency on. This allows us to shim in bit that we need for bootstrapping. After installing the Spark.Web.Mvc Package in an empty ASP.NET MVC2 application, the folder structure will look something like this:&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4zux87-yZoo68yMJyYHjc3Ojz06qUx2krwp4ZW4yvrYmu8ROYbR9VYlz6A3-yQn_ZzzLAA0kTUcQeyw2k9rliXvHaN9qsnZY8KrNGKJEo3VrfIHQgMCAFMyAAicg4PThM-NRA4SBbvaE/s1600-h/image%5B3%5D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTQGdfELrj2JngO80wkcXtAG3fbp9uTjiCgnFTXY1s5eONOQ2fMJiLoxAQ-PNa_juJt1Lyf7-rIQi7WJ0qQ3jdaVFxX1OXV0ga8H3f2qCPuawRZSWlbR-mweB9fVNYM-TSm8UwjFXcjVY/?imgmax=800&quot; width=&quot;273&quot; height=&quot;178&quot;&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Notice the AppStart_SparkWebMvc.cs file there? That looks like this inside:&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class=&quot;brush: csharp; toolbar: false; auto-links: false;&quot;&gt;using System.Web.Mvc;&lt;br&gt;using Spark;&lt;br&gt;using Spark.Web.Mvc;&lt;br&gt;&lt;br&gt;[assembly: WebActivator.PreApplicationStartMethod(typeof(MvcApplication1.AppStart_SparkWebMvc), &quot;Start&quot;)]&lt;br&gt;&lt;br&gt;namespace MvcApplication1 {&lt;br&gt;    public static class AppStart_SparkWebMvc {&lt;br&gt;        public static void Start() {&lt;br&gt;            var settings = new SparkSettings();&lt;br&gt;            settings.SetAutomaticEncoding(true); &lt;br&gt;&lt;br&gt;            // Note: you can change the list of namespace and assembly&lt;br&gt;            // references in Views\Shared\_global.spark&lt;br&gt;            SparkEngineStarter.RegisterViewEngine(settings);&lt;br&gt;        }&lt;br&gt;    }&lt;br&gt;}&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;The Spark bootstrapping code is kept separate from your Global.asax and gets dynamically inserted at runtime by the WebActivator. The two advantages here are that it leads to a nice clean uninstall if you don’t need it anymore, and it also lets you keep the complexity of the Global.asax down. You’ll see once you’ve installed multiple packages that all do their own things to the Global.asax, you’ll be glad they’re all neatly parcelled away for easy maintenance.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;I won’t go into too much more detail here, suffice it to say that I’ll be keeping the NuGet feed up to date with the latest Spark builds so that you can always take advantage of the latest features, but we’ll leave some older versions up there for those that prefer a more stable, tried and tested release. Let me know if you have any hassles…&lt;/p&gt;
&lt;p&gt;Until next time…&lt;br&gt;&lt;a href=&quot;http://twitter.com/RobertTheGrey&quot; target=&quot;_blank&quot;&gt;Robert The Grey&lt;/a&gt;&lt;/p&gt;  </description><link>http://blog.robertgreyling.com/2010/11/dont-just-get-spark-view-engine-nuget.html</link><author>noreply@blogger.com (Robert Greyling)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNj80vbMcXqoZbFRZor0l3MIjrAfPu-4yfD2YKI2VaPLQ-VE19X22GSgXJOAL2Jy3pffWHGozb-bGQmBr1u937fENqoS0tGV80GTt1SmicX35xK5d4PkyaXrUMmj1yPRkcsHyJzqWAnWw/s72-c?imgmax=800" height="72" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-4686312433020013962</guid><pubDate>Sun, 26 Sep 2010 15:17:00 +0000</pubDate><atom:updated>2010-10-01T08:32:53.170+01:00</atom:updated><title>Don’t you tell me where to put my damn views – I’ll tell you!</title><description>&lt;p&gt;Ever get the feeling the MVC framework you’re using has more control over you than you have over it? This is a common trend when trying to bring convention over configuration to applications built with the framework. Conventions are great for the most part, Ruby on Rails for example prescribes exactly where *everything* goes and &lt;a href=&quot;http://www.asp.net/mvc&quot; target=&quot;_blank&quot;&gt;MS MVC&lt;/a&gt; adopts this approach too. If you don’t put your views here, and your controllers there, they just ain’t views or controllers, even if they look, act and smell like views or controllers.&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;http://fubumvc.com/&quot; target=&quot;_blank&quot;&gt;FubuMVC&lt;/a&gt; works a little differently&lt;a name=&#39;more&#39;&gt;&lt;/a&gt; in that it lets you specify conventions instead of forcing you to adapt to someone else’s opinion of what works. Instead of arbitrarily handling conventions at folder level, you can tell FubuMVC to pay attention to the meta data in your solution. It can trawl through Types or file types or naming of specific files, Types, Methods – you name it. Go down to the level that makes sense to you and there are &lt;a href=&quot;http://guides.fubumvc.com/configuring_actions_fuburegistry.html&quot;&gt;plenty&lt;/a&gt; &lt;a href=&quot;http://github.com/DarthFubuMVC/fubumvc/tree/master/src/FubuMVC.HelloSpark/&quot;&gt;of&lt;/a&gt; &lt;a href=&quot;http://www.lostechies.com/blogs/joshuaflanagan/archive/2010/01/18/fubumvc-define-your-actions-your-way.aspx&quot;&gt;examples&lt;/a&gt; that can show you how. The beauty is, that once it’s in place, it’s a cast iron convention – and more importantly, it’s &lt;em&gt;&lt;strong&gt;your&lt;/strong&gt;&lt;/em&gt; convention – things that work for &lt;em&gt;&lt;strong&gt;you&lt;/strong&gt;&lt;/em&gt; or &lt;em&gt;&lt;strong&gt;your team&lt;/strong&gt;&lt;/em&gt;, not someone else’s.&lt;/p&gt; &lt;h2&gt;So What?!&lt;/h2&gt; &lt;p&gt;So what? What the heck does that mean to me anyway? More importantly, who gives a crap? I don’t mind following a prescribed convention defined in Rails or MS MVC – it’s a solved problem then that people much smarter than me came up with, and I can get on with building the website right?&lt;/p&gt; &lt;p&gt;Exactly right! But what if the prescribed convention you’re following, means that as a developer, you’re doing more clicking just to navigate between the views and controllers? And you’re doing more scrolling in the folder tree list just to find related items. And keep having to expend mental energy &lt;em&gt;&lt;strong&gt;every&lt;/strong&gt;&lt;/em&gt;. &lt;em&gt;&lt;strong&gt;single&lt;/strong&gt;&lt;/em&gt;. &lt;em&gt;&lt;strong&gt;time&lt;/strong&gt;&lt;/em&gt;. you’re working on a particular feature. Let’s be honest, you spend a lot of time doing this: &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;“Where was this view again? Hmph…is that a partial? Where was it again? Click…click…click…Ctrl+Shift+F…” you get the idea.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;In my experience, this has led to some of the more lazy developers among us creating massive controllers for hundreds of views, just to get around the problem of having to remember where things are and completely violating &lt;a href=&quot;http://en.wikipedia.org/wiki/Single_responsibility_principle&quot;&gt;SRP&lt;/a&gt; in order to get some form of file co-location. When you’ve got a large project with a fairly decent sized dev team, this can get out of hand very quickly, and before you know it, there are &lt;a href=&quot;http://pragprog.com/the-pragmatic-programmer/extracts/software-entropy&quot;&gt;broken windows&lt;/a&gt; all over the neighbourhood.&lt;/p&gt; &lt;p&gt;Instead, even the controller should be exercising &lt;a href=&quot;http://en.wikipedia.org/wiki/Separation_of_concerns&quot;&gt;Separation of Concerns&lt;/a&gt; – they are not immune and are not special. Controllers are subject to the same laws of good design and way too many developers forget that fact. They consider them to be just some kind of wiring mechanism between views the the &lt;em&gt;&lt;strong&gt;real code&lt;/strong&gt;&lt;/em&gt;. That’s rubbish and you know it! Controllers should be &lt;a href=&quot;http://www.lostechies.com/blogs/jimmy_bogard/archive/2010/07/23/mvcconf-slides-and-code-posted.aspx&quot;&gt;short, sharp and to the point&lt;/a&gt;.&lt;/p&gt; &lt;h2&gt;OK – so where are we going with this?&lt;/h2&gt; &lt;p&gt;Well, up until now the Spark implementation on FubuMVC had been hard-wired to work under the same conventions as MS MVC. This wasn’t in the spirit of what Fubu is trying to promote and is very limiting. Thanks to some help from &lt;a href=&quot;http://twitter.com/emilcardell&quot;&gt;Emil Cardell&lt;/a&gt;, he and I paired up and were able to come up with a way to ensure that the &lt;a href=&quot;http://sparkviewengine.com&quot; target=&quot;_blank&quot;&gt;Spark View Engine&lt;/a&gt; can be used in the same way as the Webforms View Engine can be.&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;http://www.lostechies.com/blogs/chad_myers/archive/2010/01/07/announcing-fubumvc.aspx&quot;&gt;Chad Myers&lt;/a&gt; has already created a partial port of the &lt;a href=&quot;http://nerddinner.codeplex.com/&quot;&gt;nerd dinner&lt;/a&gt; application called &lt;a href=&quot;http://github.com/chadmyers/fubudinner/tree/master/src/FubuDinner.Web/Actions/&quot;&gt;fubudinner on github&lt;/a&gt; where he’s demonstrated an example of grouping features together under a common folder using Webforms. He’s called his “Actions”, but you can call them what you like - “Controllers”, “Areas”, “Slices” – whatever. Personally I like calling them “Features” because that’s exactly what they are – single isolated pieces of functionality that can be worked on: view, controller, view model – all in one place with no need for mundane mental navigation.&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnifNG-4EKI7D-EtM6iIR_bN9c_SEZNSDvNp5L5_OxIDpENZGJoPoW6eQV3DEBGflF-Av87W9H7CvT7XT-6-qRQqpE6WIL1ue8d5HiSZzWKGwkG94mTknZ9-cyK7HTdzaPByGMUgf4mZ0/s1600-h/image%5B23%5D.png&quot;&gt;&lt;img style=&quot;border-bottom: 0px; border-left: 0px; margin: 0px 0px 0px 15px; display: inline; border-top: 0px; border-right: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; align=&quot;right&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM7AHxph2AJ6fw793orOLoLSu03Go5WxzcwNdBcF7uRT13V1_m6idSVPhKP-2MUuxWLLwiOfmi8szFtESLdA3sS4620IEmHwAqCQi9gdxCgH4IMZMDIWznQnYNHvqU9SqkCskFKmVlelc/?imgmax=800&quot; width=&quot;273&quot; height=&quot;596&quot;&gt;&lt;/a&gt;  &lt;/p&gt; &lt;p&gt;I’ve added to the &lt;a href=&quot;http://github.com/DarthFubuMVC/fubumvc/tree/master/src/FubuMVC.HelloSpark/&quot;&gt;Hello Spark sample&lt;/a&gt;, showing just how easy it is to nest your views alongside your controllers. Notice that you can actually mix and match where you store your files because Fubu’s conventions don’t work upon &lt;em&gt;where your files are stored&lt;/em&gt;, but rather around the properties of the files – which means conventions are &lt;em&gt;storage independent&lt;/em&gt;.&lt;/p&gt; &lt;p&gt;From the picture on the right, you’ll see the areas highlighted in &lt;font color=&quot;#ff0000&quot;&gt;red&lt;/font&gt; are stored according to the MS MVC convention of Controllers in one folder, and Views somewhere else in a Views folder. That means that when you’re working on a particular feature, you’re jumping between these two locations.&lt;/p&gt; &lt;p&gt;Now extrapolate what is only five or six controller-view parings in that sample - out to &lt;em&gt;&lt;strong&gt;hundreds&lt;/strong&gt;&lt;/em&gt;. That scroll bar is gonna get a lot thinner and you’re going to need a new mouse scroll wheel pretty soon.&lt;/p&gt; &lt;p&gt;The area I’ve highlighted in &lt;font color=&quot;#00ff00&quot;&gt;green&lt;/font&gt; is the new support that has been added. Notice that the Controller, View and View Model are all in the same folder representing the “Fifth Element” Feature. The “AnotherDimension.spark” view is linked by convention to the AnotherDimension method inside the FifthElement Controller because they share the same name and you can add more views that represent other methods of this feature in that folder or sub folders – or anywhere really. &lt;/p&gt; &lt;p&gt;Partials can be added here too, and you can even create a local “Shared” folder for common view components used in multiple views of the feature, or you can still store your shared views in the overall “Shared” Folder and reference them from the Feature folders without any issues.&lt;/p&gt; &lt;p&gt;This give you tremendous flexibility in setting up team conventions that are intuitive and allow a more productive way of working. I’m not trying to convince you to use this strategy – I’m just tying to explain why you should care. And the next time you’re scrolling through hundreds of files because your solution is *that big* after a year of working on it and you’re wondering if there could perhaps be an easier way…well now you know there is. &lt;/p&gt; &lt;h2&gt;Sold! How do I use it?&lt;/h2&gt; &lt;p&gt;It’s actually easier than you think – just check out the sample. As was the case before, if you have a&amp;nbsp; “Views” folder in your application root, it is included by default. The framework code has now been sorted out in such a way that you only need to include the following in your Registry to add another folder to let Spark know to look there:&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class=&quot;brush: csharp; toolbar: false; auto-links: false; highlight: [8];&quot;&gt;public HelloSparkRegistry(bool enableDiagnostics, &lt;br&gt;                          string controllerAssembly, &lt;br&gt;                          SparkViewFactory sparkViewFactory)&lt;br&gt;    : base(enableDiagnostics, controllerAssembly)&lt;br&gt;{&lt;br&gt;    _sparkViewFactory = sparkViewFactory;&lt;br&gt;&lt;br&gt;    AddViewFolder(&quot;/Features/&quot;);&lt;br&gt;&lt;br&gt;    Actions.IncludeTypesNamed(x =&amp;gt; x.EndsWith(&quot;Controller&quot;));&lt;br&gt;    AttachViewsBy(&lt;br&gt;        actionType =&amp;gt; actionType.Name.EndsWith(&quot;Controller&quot;), &lt;br&gt;        action =&amp;gt; action.RemoveSuffix(&quot;Controller&quot;));&lt;br&gt;        &lt;br&gt;    Output.ToJson.WhenTheOutputModelIs&amp;lt;JsonResponse&amp;gt;();&lt;br&gt;    Output.To(call =&amp;gt; new JavaScriptOutputNode(GetJavaScriptViewToken(call), call))&lt;br&gt;        .WhenTheOutputModelIs&amp;lt;JavaScriptResponse&amp;gt;();&lt;br&gt;&lt;br&gt;    HomeIs&amp;lt;AirController&amp;gt;(c =&amp;gt; c.TakeABreath());&lt;br&gt;}
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Oh – and you can add any number of these “AddViewFolder” calls, so it really is up to you where you want to store your views, and as you can see, Controllers are located by the conventions in the code above too, so it doesn’t matter where you store them either. Spark and Fubu work together to pair up views with controllers according to your wishes and you get some pretty neat conventions out the other side. You don’t need to tell Spark about each of the feature folders, just tell it about the root folder and it’ll dig through without any further help.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;As I said before, I’m not trying to convince you that this is the &lt;em&gt;right&lt;/em&gt; way, it’s just &lt;em&gt;another&lt;/em&gt; way, and one that I think works very well for bigger teams and large projects. Use it, don’t use it – your call, but at least it’s there for the day you decide this is the way you want to go.&lt;/p&gt;
&lt;p&gt;Until next time…&lt;br&gt;&lt;a href=&quot;http://twitter.com/RobertTheGrey&quot; target=&quot;_blank&quot;&gt;Robert The Grey&lt;/a&gt;&lt;/p&gt;  </description><link>http://blog.robertgreyling.com/2010/09/dont-you-tell-me-where-to-put-my-damn.html</link><author>noreply@blogger.com (Robert Greyling)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjM7AHxph2AJ6fw793orOLoLSu03Go5WxzcwNdBcF7uRT13V1_m6idSVPhKP-2MUuxWLLwiOfmi8szFtESLdA3sS4620IEmHwAqCQi9gdxCgH4IMZMDIWznQnYNHvqU9SqkCskFKmVlelc/s72-c?imgmax=800" height="72" width="72"/><thr:total>26</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-181137776679920721</guid><pubDate>Fri, 27 Aug 2010 13:51:00 +0000</pubDate><atom:updated>2010-09-08T00:57:04.646+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Presentations</category><category domain="http://www.blogger.com/atom/ns#">Spark</category><category domain="http://www.blogger.com/atom/ns#">Technical</category><title>Elegant MVC with Spark - The way views were meant to be</title><description>&lt;p&gt;I’ll be doing another online presentation next week. The same guys who organised the very successful &lt;a href=&quot;http://www.mvcconf.com/&quot;&gt;mvcconf.com&lt;/a&gt;, have asked me to talk more in depth about the &lt;a href=&quot;http://sparkviewengine.com&quot; target=&quot;_blank&quot;&gt;Spark View Engine&lt;/a&gt; in the MVC space, only this time for &lt;a href=&quot;http://www.c4mvc.net&quot;&gt;c4mvc&lt;/a&gt;. It’s a similar format using Live Meeting, but this time I hope to record it locally to avoid the lag from the previous recording.  &lt;p&gt;I didn&#39;t quite manage to finish&lt;a name=&#39;more&#39;&gt;&lt;/a&gt; turning Spark all the way up to eleven last time and ended up leaving out some of the more exciting bits and so I hope to give you more than your money&#39;s worth in this session. &lt;a href=&quot;http://blog.robertgreyling.com/2010/08/sparksense-gets-its-first-outing.html&quot;&gt;SparkSense&lt;/a&gt; will also be used throughout if you&#39;d like to get a glimpse of how it&#39;s progressing so come along if you’d like to find out more…&amp;nbsp; &lt;p&gt;Here are some of the things I’ll be covering this time:&lt;br&gt; &lt;h2&gt;Abstract&lt;/h2&gt; &lt;p&gt;Many developers are desperately unsure when it comes to choosing a view engine to use when building MVC applications. A lot of them liked it better when there was only one the choose from with ASP.NET MVC, while others didn’t really like the idea of being saddled with the WebForms baggage they’d heard about or worked with in traditional ASP.NET. Many are now looking to &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx&quot;&gt;Razor&lt;/a&gt; to save the day, but most haven&#39;t yet seen what&#39;s been sitting right under their noses.  &lt;p&gt;When it comes to the &lt;a href=&quot;http://www.sparkviewengine.com&quot;&gt;Spark View Engine&lt;/a&gt;, you can easily go back to true separation of concerns between View and Controller. Come along and watch demonstrations of seldom used, but powerful features of Spark including:  &lt;ul&gt; &lt;li&gt;&lt;a href=&quot;http://blog.robertgreyling.com/2010/08/spark-bindings-are-you-tired-of-eating.html&quot;&gt;Bindings support&lt;/a&gt; for more elegant looking HTML  &lt;li&gt;Transportation of your views &lt;a href=&quot;http://blog.robertgreyling.com/2009/11/teaching-javascript-how-to-render-your.html&quot;&gt;client-side via JavaScript&lt;/a&gt; for faster pages  &lt;li&gt;Integration with and migration to &lt;a href=&quot;http://fubumvc.com/&quot;&gt;FubuMVC&lt;/a&gt;  &lt;li&gt;Time permitting – Pre-compilation of views for easy deployment&lt;br&gt;&lt;/li&gt;&lt;/ul&gt; &lt;h2&gt;Watch it with bonus content!&lt;/h2&gt; &lt;p&gt;Yes it’s true, the episode is now live for you to watch at your leisure! And I’ve also taken the liberty of adding bonus content that we didn’t quite get to in the talk. If you had a dismal experience in the talk because the bandwidth just wasn’t keeping up with my frantic flicking between screens, then you’ll want to watch it from the start.&lt;/p&gt; &lt;p&gt;For those of you that watched it live, and are not in the mood to watch the whole thing again, here are the details of where I’ve added the new content.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;at 37min 20sec is a 6 minute addition that shows the fix for the Spark Bindings Demo that didn’t work properly because of my silly mistake;  &lt;li&gt;at 58min 30sec is a 45 minute long show and tell on exactly how to migrate and ASP.NET MVC project using Spark over to FubuMVC using Spark.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Without further ado, here is the video:&lt;/p&gt; &lt;p&gt;&lt;object classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; width=&quot;437&quot; height=&quot;370&quot; id=&quot;viddler_7c4625a7&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.viddler.com/player/7c4625a7/&quot; /&gt;&lt;param name=&quot;allowScriptAccess&quot; value=&quot;always&quot; /&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot; /&gt;&lt;embed src=&quot;http://www.viddler.com/player/7c4625a7/&quot; width=&quot;437&quot; height=&quot;370&quot; type=&quot;application/x-shockwave-flash&quot; allowScriptAccess=&quot;always&quot; allowFullScreen=&quot;true&quot; name=&quot;viddler_7c4625a7&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;/p&gt; &lt;p&gt;or you can also watch it &lt;a href=&quot;http://www.viddler.com/explore/c4mvc/videos/44/&quot;&gt;direct from viddler&lt;/a&gt;. And if you want to watch it on the go (iPad etc.) you can download the original &lt;a href=&quot;http://dl.dropbox.com/u/140200/ScreenCasts/ElegantMVCWithSpark.mp4&quot;&gt;1024x768 (168MB) mp4&lt;/a&gt; version.&lt;/p&gt; &lt;p&gt;I hope you enjoyed it and I look forward to “all sorts” of feedback in the comments.&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;http://twitter.com/RobertTheGrey&quot; target=&quot;_blank&quot;&gt;Robert The Grey&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href=&quot;http://twitter.com/RobertTheGrey&quot; target=&quot;_blank&quot;&gt;&lt;/a&gt;&lt;/p&gt;  </description><link>http://blog.robertgreyling.com/2010/08/elegant-mvc-with-spark-way-views-were.html</link><author>noreply@blogger.com (Robert Greyling)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-5375963583538307569</guid><pubDate>Thu, 19 Aug 2010 00:11:00 +0000</pubDate><atom:updated>2010-08-19T01:13:21.891+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Spark</category><category domain="http://www.blogger.com/atom/ns#">Technical</category><title>Spark Bindings – are you tired of eating “Tag Soup” yet?</title><description>&lt;p&gt;Since giving &lt;a href=&quot;http://blog.robertgreyling.com/2010/07/pragmatic-spark-turning-it-up-to-eleven.html&quot;&gt;my talk&lt;/a&gt; at &lt;a href=&quot;http://www.mvcconf.com&quot;&gt;mvcconf&lt;/a&gt;, I’ve received numerous requests to talk a little more about the mysterious Bindings feature in Spark. To be clear, it’s only mysterious because it’s the newest feature in the framework and because of lack of documentation – that is &lt;a href=&quot;http://sparkviewengine.com/documentation/bindings&quot; target=&quot;_blank&quot;&gt;until now&lt;/a&gt;. &lt;a href=&quot;http://whereslou.com&quot; target=&quot;_blank&quot;&gt;Louis Dejardin&lt;/a&gt; has outdone himself once again and put a very thorough piece of documentation together for this. I’m not going to rehash the official docs here, but instead suggest &lt;/p&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;where the practical application of this feature can lead to some very clean looking HTML indeed. &lt;p&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h2&gt;Where we came from&lt;/h2&gt; &lt;p&gt;Ever since moving to writing code in &lt;a href=&quot;http://en.wikipedia.org/wiki/Active_server_pages&quot; target=&quot;_blank&quot;&gt;Active Server Pages Classic(TM)&lt;/a&gt; coming from plain old HTML, I’ve always let out a small grimace every time I’ve been forced to write code in my views. At first it seemed like an awesome idea, and it was, but if you were working in ASP Classic way back when, then you’ll remember how easy it was to tie yourself in knots and burn gaping holes in any deadlines you may once have held dear. And you definitely didn’t want to be the unlucky sod dumped in the support team after delivery. Been there, done that - &lt;em&gt;It hurt…a lot…&lt;/em&gt;&lt;/p&gt; &lt;p&gt;Moving to ASP.NET we were shepherded into an event driven “code behind” desktop-programming-esque way of building web pages, but you could still put some pretty compelling spaghetti code in the views that could thwart even the most nimble of code jockeys. Nowadays, we’ve become pretty numb to it, but if you dig deep enough, I’m sure you’ll still feel that pang of regret every time you serve up a fresh &lt;a href=&quot;http://www.codinghorror.com/blog/2008/07/web-development-as-tag-soup.html&quot; target=&quot;_blank&quot;&gt;bowl of Tag Soup&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;And so, we’ve been on this search… nay… &lt;em&gt;pilgrimage&lt;/em&gt; to find the ideal mix of beauty, simplicity and power for creating the web user interface effectively without bastardising the mark-up readability, and at the same time, not sacrificing the hooks into the back-end server processes that web pages tend to rely on so heavily these days.&lt;/p&gt; &lt;p&gt;Without further ado, I present thee with Spark Bindings, the latest ingredient in the &lt;a href=&quot;http://www.sparkviewengine.com&quot;&gt;Spark View Engine&lt;/a&gt; picnic basket that will help make your views beautiful once again…&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;h2&gt;Show and tell&lt;/h2&gt; &lt;p&gt;The best way to &lt;a href=&quot;http://en.wikipedia.org/wiki/Grok&quot; target=&quot;_blank&quot;&gt;grok&lt;/a&gt; Bindings is to think of it as an &lt;em&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Inversion_of_control&quot; target=&quot;_blank&quot;&gt;IoC&lt;/a&gt; Container&lt;/em&gt; for your HTML - or a &lt;em&gt;&lt;a href=&quot;http://automapper.codeplex.com/&quot; target=&quot;_blank&quot;&gt;Mapper&lt;/a&gt;&lt;/em&gt; if you’re not into IoC, and if you’re not into IoC, then shame on you ;). For those with an IoC mindset, you’ll be no stranger to something like this in your Registry:&lt;/p&gt;&lt;pre class=&quot;brush: csharp; gutter: false; toolbar: false; auto-links: false;&quot;&gt;    For&amp;lt;IFooInterface&amp;gt;().Use&amp;lt;FooConcreteType&amp;gt;();
&lt;/pre&gt;
&lt;p&gt;Or for those who think in terms of mapping&lt;/p&gt;&lt;pre class=&quot;brush: csharp; gutter: false; toolbar: false; auto-links: false;&quot;&gt;    Mapper.CreateMap&amp;lt;ModelType, ViewModelType&amp;gt;();
&lt;/pre&gt;
&lt;p&gt;Basically you can see where I’m going here and in the simplest sense, Spark Bindings is a substitution engine where in can stipulate that Spark should comb your HTML and perform the substitutions that you specify. For example, you can stipulate that everywhere Spark sees something like:&lt;/p&gt;&lt;pre class=&quot;brush: xml; gutter: false; toolbar: false; auto-links: false;&quot;&gt;    &amp;lt;TextBox For=”UserName” /&amp;gt;
&lt;/pre&gt;
&lt;p&gt;it should actually use the following HTML Helper behind the scenes: &lt;/p&gt;&lt;pre class=&quot;brush: csharp; gutter: false; toolbar: false; auto-links: false;&quot;&gt;    Html.TextBoxFor(x =&amp;gt; x.@For)
&lt;/pre&gt;
&lt;p&gt;where &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;“@For”&lt;/font&gt; is the parameter with value &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;“UserName”&lt;/font&gt; you specified in your HTML as an attribute. NEAT! Isn’t it? &lt;/p&gt;
&lt;p&gt;You see – this gives you the power to create or use existing HTML helpers of all descriptions in your assemblies that are normally invoked in a single line of code, and instead of polluting your HTML views with code bits and pieces, you can get clean looking HTML like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;Form class=&quot;form-default&quot;&amp;gt;&lt;br&gt;    &amp;lt;ValidationSummary Message=&quot;Login was unsuccessful. &lt;br&gt;    Please correct the errors and try again.&quot; ExcludePropertyErrors=&quot;true&quot; /&amp;gt;&lt;br&gt;    &amp;lt;div class=&quot;editor-label&quot;&amp;gt;&lt;br&gt;         &amp;lt;Label For=&quot;UserName&quot; /&amp;gt;&lt;br&gt;    &amp;lt;/div&amp;gt;&lt;br&gt;    &amp;lt;div class=&quot;editor-field&quot;&amp;gt;&lt;br&gt;         &amp;lt;TextBox For=&quot;UserName&quot; /&amp;gt;&amp;lt;ValidationMessage For=&quot;UserName&quot;/&amp;gt;                &lt;br&gt;    &amp;lt;/div&amp;gt;&lt;br&gt;    &amp;lt;div class=&quot;editor-label&quot;&amp;gt;&lt;br&gt;         &amp;lt;Label For=&quot;Password&quot; /&amp;gt;&lt;br&gt;    &amp;lt;/div&amp;gt;&lt;br&gt;    &amp;lt;div class=&quot;editor-field&quot;&amp;gt;&lt;br&gt;         &amp;lt;Password For=&quot;Password&quot; /&amp;gt;&amp;lt;ValidationMessage For=&quot;Password&quot; /&amp;gt;&lt;br&gt;    &amp;lt;/div&amp;gt;&lt;br&gt;    &amp;lt;div class=&quot;editor-label&quot;&amp;gt;&lt;br&gt;        &amp;lt;CheckBox For=&quot;RememberMe&quot; /&amp;gt;&lt;br&gt;        &amp;lt;Label For=&quot;RememberMe&quot; /&amp;gt;&lt;br&gt;    &amp;lt;/div&amp;gt;&lt;br&gt;    &amp;lt;input type=&quot;submit&quot; value=&quot;Log On&quot; /&amp;gt;&lt;br&gt;&amp;lt;/Form&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Let’s quickly go through the interesting bits of the example above. The first thing you’ll notice is that it’s very difficult to spot the code – the abstractions (i.e. Bindings) are doing a very good job of blending in with the HTML, you know, exactly the way HTML was always meant to be! ;)&lt;/p&gt;
&lt;p&gt;Secondly, I’m sure you noticed that you probably haven’t ever seen an HTML &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;&amp;lt;Form&amp;gt;&lt;/font&gt; Tag without and action attribute or JavaScript hook of sorts right? And you definitely know that there’s no such thing as a &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;&amp;lt;ValidationSummary&amp;gt;&lt;/font&gt; Tag in the &lt;a href=&quot;http://www.w3.org/MarkUp/&quot; target=&quot;_blank&quot;&gt;HTML spec&lt;/a&gt; right? That’s right, you can both overload existing HTML Tags (with extra attributes or provide conventions for existing attributes) and invent new Tags of your choosing and bind those to the code you’d like to substitute in their place.&lt;/p&gt;
&lt;p&gt;Any parameter that you may have for your HTML helpers can be fed through attributes and child nodes. You can keep it as simple as you like, or turn it up to eleven and really unleash the power under the hood here. The point remaining – it will STILL look and feel like HTML, instead of code. I won’t be able to go into all the powerful things you’re able to do in one post, but I hope I can give you enough of a taster that you’ll want to try it out for yourself.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Power of Abstraction&lt;/h2&gt;
&lt;p&gt;From the above code, you see that there could be absolutely &lt;em&gt;any&lt;/em&gt; line of code hiding behind that &lt;font color=&quot;#0080ff&quot;&gt;&lt;font face=&quot;Consolas&quot;&gt;&amp;lt;TextBox &lt;font color=&quot;#ff8040&quot;&gt;For&lt;/font&gt;&lt;font color=&quot;#ffffff&quot;&gt;=&lt;/font&gt;&lt;font color=&quot;#00ff80&quot;&gt;”UserName”&lt;/font&gt; /&amp;gt;&lt;/font&gt;&lt;/font&gt; binding. You don’t have to use an ASP.NET MVC helper, you could hook up the &lt;a href=&quot;http://github.com/DarthFubuMVC/fubumvc/tree/master/src/HtmlTags/&quot; target=&quot;_blank&quot;&gt;FubuMVC HtmlTags&lt;/a&gt; implementation instead &lt;a href=&quot;http://paceyourself.heroku.com/2010/07/30/fubu-htmltags-with-aspnet-mvc/&quot; target=&quot;_blank&quot;&gt;if that’s what you prefer&lt;/a&gt;. Do you see that by binding these, you have just been provided with a way to write your views &lt;em&gt;once&lt;/em&gt;, and replace the code bits behind the bindings with an entirely new library of product helpers simply by modifying the Bindings.xml – &lt;a href=&quot;http://www.telerik.com/products/aspnet-mvc.aspx&quot; target=&quot;_blank&quot;&gt;telerik&lt;/a&gt; anyone?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Power to Invent new HTML Tags&lt;/h2&gt;
&lt;p&gt;Don’t think of it as being limited to making HTML Forms prettier. You can also see from the code above that you’re able to create other HTML Tags you’ve always wanted! If you want a &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;&amp;lt;FizzBuzz&amp;gt;&lt;/font&gt; Tag, there’s nothing stopping you. What’s more is that by putting that Tag abstraction in, this give you the freedom to replace your &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;FizzBuzz&lt;/font&gt; Helper with your new and and improved &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;FizzierBuzzing&lt;/font&gt; Helper at a moments notice throughout your views just by modifying the Binding in the xml. But that’s just the start. This thing has oodles of untapped potential under the hood…&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Power to Augment existing HTML tags&lt;/h2&gt;
&lt;p&gt;Let’s say you’re not particularly fond of the idea of adding a &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;&amp;lt;Link&amp;gt;&lt;/font&gt; or &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;&amp;lt;ActionLink&amp;gt;&lt;/font&gt; Tag to your arsenal because you think the Anchor &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;&amp;lt;a&amp;gt;&lt;/font&gt; Tag in HTML is perfectly good for links, but you’d really like the ability to hook that up to the &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;Html.ActionLink()&lt;/font&gt; helper built into ASP.NET MVC or the &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;this.LinkTo()&lt;/font&gt; helper built into &lt;a href=&quot;http://fubumvc.com/&quot; target=&quot;_blank&quot;&gt;FubuMVC&lt;/a&gt;. Why should you have to go and create a new Tag then? Well, with Spark Bindings, you don’t - just put an Anchor Tag into your view like this:&lt;/p&gt;&lt;pre class=&quot;brush: xml; gutter: false; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;a action=&quot;Register&quot; title=&quot;Register&quot;&amp;gt;Register&amp;lt;/a&amp;gt;
&lt;/pre&gt;
&lt;p&gt;… and the Bindings will take care of the rest. Notice that the &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;“title”&lt;/font&gt; attribute is already part of the HTML Spec for the Anchor Tag, and will simply pass straight through the Spark Bindings parser like magic and render just fine on the other side. You’ll also notice that it does not have an &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;“href”&lt;/font&gt; attribute but instead, we’ve invented a new &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;“action”&lt;/font&gt; attribute which Spark Bindings will feed into the HTML Helper and get the rendered output from that before rendering to the view. &lt;/p&gt;
&lt;p&gt;Simple, but remarkably powerful and tidy.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;OK, OK! What does this Bindings.xml look like?&lt;/h2&gt;
&lt;p&gt;Well, firstly we default by convention to looking in the root “Views” folder but this can be overridden if you like – just check the documentation. Then you start by wrapping all your &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;&amp;lt;element&amp;gt;&lt;/font&gt; definitions inside a root &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;&amp;lt;bindings&amp;gt;&lt;/font&gt; element. This is best demonstrated by example, so here’s the simple binding for the Label Html Helper:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;bindings&amp;gt;&lt;br&gt;  &amp;lt;element name=&quot;Label&quot;&amp;gt;Html.LabelFor(m =&amp;gt; m.@For)&amp;lt;/element&amp;gt;&lt;br&gt;&amp;lt;/bindings&amp;gt;&lt;br&gt;&lt;/pre&gt;&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
&lt;p&gt;Then you can get a little more complex. Here’s the binding for the CheckBox Html Helper:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;element name=&quot;CheckBox&quot;&amp;gt;&lt;br&gt;    Html.CheckBoxFor(m =&amp;gt; m.@For, &lt;br&gt;    new Dictionary[[string,object]]{{&quot;@*&quot;}})&lt;br&gt;&amp;lt;/element&amp;gt;&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;What the HECK is that freaky looking Dictionary thingy?! Relax, that’s nothing to do with Spark Bindings, that’s the Dictionary parameter that comes with the Html Helper and Spark is just being a good citizen and allowing you to pass that through to the other side and the &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;“@*”&lt;/font&gt; is just a wild-card means of passing the values back out the same as they came in. But you can check the documentation for further details.&lt;/p&gt;
&lt;p&gt;Next, let’s have a look at how we managed to simplify the Form Html Helper – that one has kept many an ASP.NET MVC developer awake at night:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;element name=&quot;Form&quot;&amp;gt;&lt;br&gt;    &amp;lt;start&amp;gt;# using (Html.BeginForm(&quot;@action&quot;, &quot;@controller&quot;, &lt;br&gt;        new RouteValueDictionary{{&quot;@route-*&quot;}}, &lt;br&gt;        FormMethod.@method, &lt;br&gt;        new Dictionary[[string,object]]{{&quot;@*&quot;}})) {&lt;br&gt;    &amp;lt;/start&amp;gt;&lt;br&gt;    &amp;lt;end&amp;gt;# }&amp;lt;/end&amp;gt;&lt;br&gt;&amp;lt;/element&amp;gt;&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;There, now aren’t you glad we caught that closing curly brace for you and replaced it with a nice &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;&amp;lt;/Form&amp;gt;&lt;/font&gt; closing Tag? :)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Power of Overloading&lt;/h2&gt;
&lt;p&gt;But that’s not all. What if you liked your perfectly good &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;FizzBuzz&lt;/font&gt; Helper, and only wanted to change to your new &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;FizzierBuzzing&lt;/font&gt; Helper in certain places in your project – well you’ll be happy to hear that multiple overloads are supported for any HTML Tag, which means that all you need to do is create an overload in your Bindings.xml and differentiate the two somehow with a flag or parameter of sorts, and then only add that flag to the parts of the project you’d like to use the second version in.&lt;/p&gt;
&lt;p&gt;Here are 4 different Overloads for the standard Anchor &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;&amp;lt;a&amp;gt;&lt;/font&gt; Tag and they are ordered from &lt;em&gt;most specific&lt;/em&gt; to the &lt;em&gt;least specific&lt;/em&gt; in terms of parameters – this is how the Bindings knows which one to pick – it picks the first one where all parameters are satisfied. So you need to put your &lt;em&gt;most specific&lt;/em&gt; overload at the top:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;element name=&quot;a&quot;&amp;gt;&lt;br&gt;    Html.ActionLink(&quot;child::*&quot;, &quot;@action&quot;, &quot;@controller&quot;, &lt;br&gt;    new RouteValueDictionary{{&quot;@route-*&quot;}}, new Dictionary[[string,object]]{{&quot;@*&quot;}})&lt;br&gt;&amp;lt;/element&amp;gt;&lt;br&gt;&amp;lt;element name=&quot;a&quot;&amp;gt;&lt;br&gt;    Html.ActionLink(&quot;child::*&quot;, &quot;@action&quot;,&lt;br&gt;    new RouteValueDictionary{{&quot;@route-*&quot;}}, new Dictionary[[string,object]]{{&quot;@*&quot;}})&lt;br&gt;&amp;lt;/element&amp;gt;&lt;br&gt;&amp;lt;element name=&quot;a&quot;&amp;gt;&lt;br&gt;    Html.ActionLink(&quot;@text&quot;, &quot;@action&quot;, &quot;@controller&quot;, &lt;br&gt;    new RouteValueDictionary{{&quot;@route-*&quot;}}, new Dictionary[[string,object]]{{&quot;@*&quot;}})&lt;br&gt;&amp;lt;/element&amp;gt;&lt;br&gt;&amp;lt;element name=&quot;a&quot;&amp;gt;&lt;br&gt;    Html.ActionLink(&quot;@text&quot;, &quot;@action&quot;, &lt;br&gt;    new RouteValueDictionary{{&quot;@route-*&quot;}}, new Dictionary[[string,object]]{{&quot;@*&quot;}})&lt;br&gt;&amp;lt;/element&amp;gt;&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;You’ll probably recognise the &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;“child::*”&lt;/font&gt; syntax if you’ve ever worked with XPath queries. This is where it gets its roots and it’s nothing to be afraid of. It is basically indicating to Spark that this Binding element definition is not just an element like a self closing &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;&amp;lt;br/&amp;gt;&lt;/font&gt; Tag, but that it will contain child content that needs to be processed as well. This allows you to put Spark code or calls to Macros inside your elements in the view. Something I intend to elaborate on in a deep dive post. &lt;/p&gt;
&lt;p&gt;For Html Helpers that return &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;void&lt;/font&gt;, simply call them by putting a &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;#&lt;/font&gt; up front like this:&lt;/p&gt;&lt;pre class=&quot;brush: xml; gutter: false; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;element name=&quot;Partial&quot;&amp;gt;#Html.RenderPartial(&quot;@name&quot;, new ViewDataDictionary{{&quot;@*&quot;}});&amp;lt;/element&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Can I have multiple Bindings.xml in a project?&lt;/h2&gt;
&lt;p&gt;Ah, so you’re thinking maybe about supporting themes or perhaps want to have elements render differently in different parts of the same site? Well yes you can. Spark provides an &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;IBindingProvider&lt;/font&gt; service that allows you to direct how Bindings are located, and this can be done down to a view by view basis. I’ll have to save that topic for another post though since that’s slightly more in depth and you’ve probably already fallen asleep by now ;) Let me know via the comments though if this is a particularly burning issue for you and I’ll see if I can get it done sooner…&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Now you’re just being silly!&lt;/h2&gt;
&lt;p&gt;I’m sure you’re all going to find new and even more interesting ways to use this feature. I can’t take credit for this one and it’s one of the more, shall we say, &lt;em&gt;creative&lt;/em&gt; examples that &lt;a href=&quot;http://whereslou.com/&quot; target=&quot;_blank&quot;&gt;Lou&lt;/a&gt; came up with for his &lt;a href=&quot;http://vimeo.com/13027900&quot; target=&quot;_blank&quot;&gt;ND2010 talk&lt;/a&gt;. It’s basically a text colorizer that uses an Html Helper to build &amp;lt;span&amp;gt; Tags of text across a spectrum of colours between a min and max colour that you specify as parameters to the Helper. The Html Helper looks like this: &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class=&quot;brush: csharp; toolbar: false; auto-links: false;&quot;&gt;public static object Colorize(this HtmlHelper html, string text, Color min, Color max, double value) {&lt;br&gt;    var color = Color.FromArgb(&lt;br&gt;        Range(min.R, max.R, value),&lt;br&gt;        Range(min.G, max.G, value),&lt;br&gt;        Range(min.B, max.B, value));&lt;br&gt;&lt;br&gt;    var tagBuilder = new TagBuilder(&quot;span&quot;);&lt;br&gt;    tagBuilder.SetInnerText(text);&lt;br&gt;&lt;br&gt;    tagBuilder.MergeAttribute(&quot;style&quot;, &quot;color:&quot; + ColorTranslator.ToHtml(color) + &quot;;&quot;);&lt;br&gt;    return MvcHtmlString.Create(tagBuilder.ToString());&lt;br&gt;}&lt;br&gt;&lt;br&gt;private static int Range(int min, int max, double value) {&lt;br&gt;    return min + (int)((max - min) * value);&lt;br&gt;}
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;and then we invent a new HTML Tag for use in our view – let’s call it &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;&amp;lt;spread&amp;gt;&lt;/font&gt; which maps to our new Html Helper,&amp;nbsp; and we add it to our Bindings.xml like so:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class=&quot;brush: xml; gutter: false; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;element name=&quot;spread&quot;&amp;gt;Html.Colorize(&quot;child::*&quot;, @min, @max, @value)&amp;lt;/element&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So now we make a call to our new Tag in the Spark HTML view like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;p&amp;gt;You&#39;re kidding right? --&amp;gt;&lt;br&gt;    &amp;lt;var words = &quot;new[]{&#39;O&#39;,&#39;oo&#39;,&#39;h&#39;,&#39; Lo&#39;,&#39;ok &#39;,&#39;at &#39;,&#39;al&#39;,&#39;l t&#39;,&#39;he &#39;,&#39;pr&#39;,&#39;et&#39;,&#39;ty &#39;,&#39;co&#39;,&#39;lo&#39;,&#39;ur&#39;,&#39;s&#39;}&quot; /&amp;gt;&lt;br&gt;    &amp;lt;spread &lt;br&gt;        min=&quot;Color.Green&quot; &lt;br&gt;        max=&quot;Color.Red&quot; &lt;br&gt;        each=&quot;var x in new[]{.1,.2,.3,.4,.5,.6,.7,.8,.9,.8,.7,.6,.5,.4,.2,.1}&quot;&lt;br&gt;        value=&quot;x&quot;&amp;gt;${words[xIndex]}&lt;br&gt;    &amp;lt;/spread&amp;gt;&lt;br&gt;&amp;lt;/p&amp;gt;&lt;br&gt;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Now what you see above is a little bit naughty – in reality the &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;“words”&lt;/font&gt; array will come from your strongly typed view model as something like &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;“Model.Words”&lt;/font&gt; and likewise with the array of values, but I put it in the code here so that you can a clear picture of how we got the output you see below. Equally, the &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;“Color.Green”&lt;/font&gt; and &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;“Color.Red”&lt;/font&gt; values, as a best practice should come from something like &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;“Model.Min”&lt;/font&gt; and &lt;font color=&quot;#0080ff&quot; face=&quot;consolas&quot;&gt;“Model.Max”&lt;/font&gt; so you get the idea right? KEEP THE CODE OUT OF YOUR VIEWS… m’kay?! :)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Doing the right thing presents you with much prettier view code that looks something like this:&lt;/p&gt;&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;p&amp;gt;You&#39;re kidding right? --&amp;gt;&lt;br&gt;    &amp;lt;spread &lt;br&gt;        min=&quot;Model.Min&quot; &lt;br&gt;        max=&quot;Model.Max&quot; &lt;br&gt;        each=&quot;var x in Model.SpreadValues&quot;&lt;br&gt;        value=&quot;x&quot;&amp;gt;${Model.Words[xIndex]}&lt;br&gt;    &amp;lt;/spread&amp;gt;&lt;br&gt;&amp;lt;/p&amp;gt;&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;And the output…&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLJ2fzRyxO2dPaENnva39uzvqY8TUqsK_O1VRSH-yogvA7J0v8ouKw-t6weyY42fLAnKooSRombVOqKucvTZpNf5IVh6gvwlNW1NYQL2Q8ceJF9mxuJKGnT-5ovMwkcM5kj9zYUbJltMM/s1600-h/image%5B7%5D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpawWD8GQrGsbmH9MhGeIBO4ckPVJ2e4EPIaDAd9kEBm2huI_o8CZ4GZQ28iJ0ps6ttAQ4bEOaIDQ_eTcFsfccMZ7lWjdTgFgSHr3oSXG4LhJbsSy7m0HyCSfxALcxsMiiRL_SFYFQ14E/?imgmax=800&quot; width=&quot;600&quot; height=&quot;46&quot;&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Nah, that’s just crazy! You wouldn’t actually do &lt;em&gt;that &lt;/em&gt;would you? &lt;em&gt;Would YOU?! &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;In reality, this isn’t necessarily something you’re going to do. What I’m demonstrating here is that you can control your rendering at incredible levels of detail and you can make your rendering subject to functions that you haven’t yet dreamed up! And that because the code is contained in class files behind the scenes, you’re able to control and unit test before they hit a view, and all the view has to do, is call out to those bits, but never has to get involved in the actual thinking. &lt;/p&gt;
&lt;h4&gt;&lt;em&gt;&lt;font color=&quot;#ff8040&quot;&gt;This my friends is the way MVC views were always meant to be…&lt;/font&gt;&lt;/em&gt;&lt;/h4&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Don’t stop now…&lt;/h2&gt;
&lt;p&gt;I wanted to try and keep this post geared towards beginners or people that just want to get up and running quickly, but I’m not sure I’ve succeeded entirely in that undertaking. It may be worth doing a more in depth post highlighting some of the even more powerful possibilities of this feature, so let me know if that’s something you’d be interested in seeing and I’ll put something together.&lt;/p&gt;
&lt;p&gt;But in any case, if you wanted to get the scoop on the syntax and provisions made by the parser for you to extend this feature, then I urge you to have a look at &lt;a href=&quot;http://sparkviewengine.com/documentation/bindings&quot; target=&quot;_blank&quot;&gt;the documentation&lt;/a&gt;, set your mind free and start giving your views the makeover they deserve!&lt;/p&gt;
&lt;p&gt;Also, if you’re looking for a more complete Bindings sample to play with, you can &lt;a href=&quot;http://mvcconf.codeplex.com/releases/view/49503#DownloadId=139213&quot; target=&quot;_blank&quot;&gt;download it&lt;/a&gt; from the &lt;a href=&quot;http://mvcconf.codeplex.com/releases/view/49503&quot; target=&quot;_blank&quot;&gt;slides &amp;amp; samples downloads&lt;/a&gt; for the &lt;a href=&quot;http://blog.robertgreyling.com/2010/07/pragmatic-spark-turning-it-up-to-eleven.html&quot; target=&quot;_blank&quot;&gt;mvcconf talk I did&lt;/a&gt; in July.&lt;/p&gt;
&lt;p&gt;And before I go, I’d like to say a personal thank you to &lt;a href=&quot;http://whereslou.com&quot; target=&quot;_blank&quot;&gt;Lou&lt;/a&gt; for creating such an awesome view engine and giving MVC web developers such an amazing experience! This Bindings feature is surely a crowning glory of sorts and I think it gives Spark an edge that really counts. Things are only going to get better…&lt;/p&gt;
&lt;p&gt;And finally – look out for Bindings IntelliSense support coming soon to you via &lt;a href=&quot;http://blog.robertgreyling.com/2010/08/sparksense-gets-its-first-outing.html&quot; target=&quot;_blank&quot;&gt;SparkSense&lt;/a&gt;…&lt;/p&gt;
&lt;p&gt;Until next time…&lt;br&gt;&lt;a href=&quot;http://twitter.com/RobertTheGrey&quot;&gt;Robert The Grey&lt;/a&gt;&lt;/p&gt;  </description><link>http://blog.robertgreyling.com/2010/08/spark-bindings-are-you-tired-of-eating.html</link><author>noreply@blogger.com (Robert Greyling)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpawWD8GQrGsbmH9MhGeIBO4ckPVJ2e4EPIaDAd9kEBm2huI_o8CZ4GZQ28iJ0ps6ttAQ4bEOaIDQ_eTcFsfccMZ7lWjdTgFgSHr3oSXG4LhJbsSy7m0HyCSfxALcxsMiiRL_SFYFQ14E/s72-c?imgmax=800" height="72" width="72"/><thr:total>9</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-176555281428922408</guid><pubDate>Sun, 15 Aug 2010 13:11:00 +0000</pubDate><atom:updated>2010-08-30T22:39:06.429+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Best Practices</category><category domain="http://www.blogger.com/atom/ns#">Technical</category><title>I don’t want your stinkin’ code comments</title><description>I just read a fantastic &lt;a href=&quot;http://jesseliberty.com/2010/08/14/coding-without-a-net/&quot; target=&quot;_blank&quot;&gt;thought experiment&lt;/a&gt; being put forward and trialled by &lt;a href=&quot;http://jesseliberty.com/&quot; target=&quot;_blank&quot;&gt;Jesse Liberty&lt;/a&gt; at the moment. I’ve written this post in support of that effort and to express my gratitude that he is putting his name behind it! I have to say that I 100% agree with his assertions in the article and I’ve been coding like this for the better part of four years now (even on large production systems with &amp;gt; 2 million LOC) without any of the “missing comment bogeymen” coming to get me or my team mates. In fact, &lt;i&gt;existing&lt;/i&gt; comments in those systems have &lt;a name=&#39;more&#39;&gt;&lt;/a&gt;bitten us more than once – &lt;i&gt;and hard!&lt;/i&gt;&lt;br /&gt;
&lt;h2&gt;Why?&lt;/h2&gt;Because as Jesse asserts, writing code without any comments forces you move away from the “write&amp;nbsp; once” phenomenon and mentality. &lt;a href=&quot;http://www.objectmentor.com/omTeam/martin_r.html&quot; target=&quot;_blank&quot;&gt;Uncle Bob&lt;/a&gt; says it best in his book (&lt;a href=&quot;http://www.amazon.co.uk/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1281877215&amp;amp;sr=8-1&quot; target=&quot;_blank&quot;&gt;Clean Code&lt;/a&gt;) so I’d very much recommend that as a good reference. I agree that it seems &lt;strike&gt;bloody impossible&lt;/strike&gt; tough at first, but this way of working is going to save you hours of heartache and more importantly that of your co-workers and those that come after you’re gone. “Do unto others” remember…&lt;br /&gt;
&lt;h2&gt;Let’s face it&lt;/h2&gt;Most comments you consider putting in code are either:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Stating the bleedin’ obvious (I’m looking at you Method Arguments)&lt;/li&gt;
&lt;li&gt;Put there because you’re too lazy to refactor the code as demonstrated in Jesse’s article and the comments&lt;/li&gt;
&lt;li&gt;Enforced by stupid corporate coding standard mandates that are still stuck in the 90s&lt;/li&gt;
&lt;li&gt;Stale (and sometimes actively harmful) by the next check-in or 6 months later&lt;/li&gt;
&lt;/ul&gt;Comments are an addiction, and it’s about time you kicked the habit. You only have so many keystrokes in you before you die, why spend them writing useless comments instead of useful code?&lt;br /&gt;
&lt;h2&gt;Going even further&lt;/h2&gt;There’s a reason I didn’t just write this up as a comment on Jesse’s post and that is because I really want to drive this particular point home. I would go even further than Jesse did, and remark that his experiment is doomed to fail. That’s because (and I admittedly don’t have enough info from the article) he’s missing a key ingredient in the formula that makes this experiment a success.&lt;br /&gt;
When you find the insane need to write a comment about the “&lt;i&gt;why”&lt;/i&gt; of the code at the top of a method for example, or even worse &lt;i&gt;inline&lt;/i&gt; – the simple fact is, you’re missing a Unit Test, or a BDD specification – depending on your preference. I’ve found after four years of executing on this experiment that you cannot possibly include &lt;i&gt;all&lt;/i&gt; the “&lt;i&gt;why’s&lt;/i&gt;” in the code structure because you end up with too many levels of abstraction which only end up being in place to talk about the “&lt;i&gt;why&lt;/i&gt;”.&lt;br /&gt;
Now that’s fine for certain functional areas of the code, but you cannot possibly justify the time or man power to go all the way through. And besides, we found that you reach a tipping point where the human brain starts to find those heavily sequential abstractions hard to comprehend and piece back together in logical terms, which means you’re back to square one again – unreadable code.&lt;br /&gt;
Instead, why not raise a unit or integration test to prove that your code executes on that business rule or fact? That way, when other developers come to familiarise themselves with the code, they can open the code under execution and the exercising unit test code side by side, and get a really good idea about what the programmer who wrote it was thinking. They get the “&lt;i&gt;What&lt;/i&gt;” and the “&lt;i&gt;Why&lt;/i&gt;” in terms of source code that is easily refactored, debugged, augmented and added to over time without a &lt;strike&gt;useless&lt;/strike&gt; comment in sight.&lt;br /&gt;
You see, the unit test is the “&lt;i&gt;why&lt;/i&gt;” form of abstraction written in such a way that directly exercises a section of code, and it is the way in which it is written that gives it unique power to ask the “why” questions – something that is very difficult to replicate inside the code under test without implementing some kind of internal DSL. The very existence of the unit test means you can remove that complexity from your code and just let it execute the “What”.&lt;br /&gt;
&lt;h2&gt;OK enough with the philosophy – gimme an example!&lt;/h2&gt;Some folks just want cold, hard &lt;strike&gt;facts&lt;/strike&gt; examples. Fair enough, I can understand that, but you need to understand that there are a billion permutations here and what I’m really trying to get the reader to do is ask the question: “Why am I thinking about putting a comment in here?”. &lt;br /&gt;
With that in mind, there’s no point in me putting an example up (since &lt;a href=&quot;http://jesseliberty.com/2010/08/14/coding-without-a-net/&quot; target=&quot;_blank&quot;&gt;Jesse’s is perfectly adequate&lt;/a&gt; to illustrate the point) when people will in any case, just spend time analysing the code pointing out what I “got wrong” or how they would have done it differently. If that’s what you’re thinking about, then you’ve already missed the entire point of the article.&lt;br /&gt;
&lt;h2&gt;Exception to every rule&lt;/h2&gt;One thing I live by is that there is always an exception, and in my case this is true for what I call placeholder comments. These comments take a common shape:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;span style=&quot;color: #0080ff; font-family: consolas;&quot;&gt;//TODO: Rob G Make sure this goes into the logging pipeline when it’s finished&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #0080ff; font-family: Consolas;&quot;&gt;//BUG: Joe B – this is where [Issue:12345] is breaking the JSON call – Rob G needs to fix it after [Issue:9876] fix goes in&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;…and my personal favourite&lt;/li&gt;
&lt;li&gt;&lt;span style=&quot;color: #0080ff; font-family: Consolas;&quot;&gt;//TAUNT: Rob G, do you realise that this section of code broke the build on Friday after you left for home? Team is looking forward to a beer next week on you after you’ve fixed this – Thursday any good?&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;That last one very much depends on the sense of humour in your team, but most importantly, these are short lived comments that DO NOT hang around in the code, but are too complex to write a unit test for – they may require many unit tests or simply make use of an orthogonal concern such as logging.&lt;br /&gt;
Tools like Resharper have windows in Visual Studio dedicated to tracking exactly these kinds of comments with a view to solving them quickly. They are also convention based and can quickly be searched for when you come in the next morning. Context sensitive messages can be left for fellow developers without the need for email, and I feel that this is one way you can get comments to work for you, rather than against you.&lt;br /&gt;
The only other exception I’m barely willing to accept is if you’re developing a public facing closed API that you &lt;i&gt;HAVE TO&lt;/i&gt; produce documentation for otherwise they just won’t pay you. That’s a fair request and you can work that into your pricing, but let’s be honest, when was the last time you opened that &lt;a href=&quot;http://en.wikipedia.org/wiki/Microsoft_Compiled_HTML_Help&quot; target=&quot;_blank&quot;&gt;.CHM file&lt;/a&gt; for someone else’s API and got any true value out of it that couldn’t be gotten more easily by writing a unit test invoking the API? And was the .CHM even up to date?&lt;br /&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;So ultimately, I’d like to say that if you don’t write unit tests (or have BDD specifications or similar), then &lt;i&gt;please do&lt;/i&gt; write comments in your code – it’s the only way we’re gonna find out about the business rules you tried to implement in the code when we’re paid to come in after you’re gone to fix your mess. And it will be exponentially messier for each and every time you’ve blindly gone in there and changed the code without updating the corresponding comments – and don’t say you remembered to update them… I don’t believe you.&lt;br /&gt;
Anyone else found a good use for code comments…leave a comment ;) (pun intended)&lt;br /&gt;
Until next time…&lt;br /&gt;
&lt;a href=&quot;http://twitter.com/RobertTheGrey&quot;&gt;Robert The Grey&lt;/a&gt;</description><link>http://blog.robertgreyling.com/2010/08/i-dont-want-your-stinkin-code-comments.html</link><author>noreply@blogger.com (Robert Greyling)</author><thr:total>17</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-3495103320270947889</guid><pubDate>Mon, 09 Aug 2010 19:58:00 +0000</pubDate><atom:updated>2010-08-16T16:34:09.955+01:00</atom:updated><title>SparkSense gets its first outing</title><description>Well well well, some say “it’s about time”, but personally I say “it’s too soon”, but then again, that’s exactly what they say a beta period is for. There is so much work on the back burner here that I could just keep going for ages in my little cave, but I think it’s important to give SparkSense a little air, even if that means it only ends up being pushed back into its box.&lt;br /&gt;
My expectation is that the current beta version is &lt;i&gt;not&lt;/i&gt; fit for use in a production sense – in other words, you’re not going to be &lt;i&gt;that&lt;/i&gt; much more productive than writing Spark in a plain text editor providing you know the API fairly well. It’s not going to break or overwrite your code or anything like that, but I am still &lt;a name=&#39;more&#39;&gt;&lt;/a&gt;working on making sure it stays out of your way.&lt;br /&gt;
&lt;br /&gt;
For this beta release, I have put a few “catch all” exception blockers in the code to basically make the experience a bit more pleasant. I remove these for development and fix as I go along, but I’m sure you don’t want Visual Studio telling you that an exception occurred in the plug-in every 5 minutes. These do still happen behind the scenes, but the nice thing is that SparkSense recovers from these without needing a restart, so if you do by any chance see one pop up, SparkSense will reset on the next keystroke.&lt;br /&gt;
If someone (currently going through a temporary, insane bout of masochism) would like a version without the safety net and would like to help me track down scenarios under which exceptions are thrown, then feel free to get in touch and I’ll get you a copy of the plug-in.&lt;br /&gt;
&lt;h2&gt;Supported&lt;/h2&gt;Basically, the current Spark API is supported and the plug-in will dig through your project and views finding partials, global &amp;amp; local variables, content areas and macros you’ve defined. The trouble with doing IntelliSense this way around (i.e. Spark API rather than C#) is that the VS2008 plug-in exclusively targeted C# IntelliSense, and now it’s gone! In exchange you get Spark API IntelliSense, but that might not be good enough for you.&lt;br /&gt;
So along with bug fixing and adding to the current features, the next big item on my list is to provide static C# IntelliSense so that you’ll have access to &lt;i&gt;successfully compiled &lt;/i&gt;code from inside the views for which I’ll be using the DynamicTypeResolution bits.&lt;br /&gt;
&lt;h2&gt;Not Supported&lt;/h2&gt;There are always going to be unsupported bits in a beta release. If you see something here that you can’t do without, then it’s better that you don’t use the plug-in at all. I’ll be ticking these off my list one by one with each release.&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;As I said, C# IntelliSense in the HTML view is not currently supported, but it’s next on my list.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Also not supported yet are macro parameters.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;I’ve built a lot of the signature recognition but I’ve turned it off for this release since it’s giving a few false positives that I need to fix first.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;I’ve got a custom presenter in the wings, but I’ve turned it off until we really need and can use it.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Bindings support is also very high up on my list since it’ll be an invaluable feature as people begin to see the true power in them.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Custom settings support – things like reading from your project config for custom prefixes and binding providers etc.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Namespace prefixed elements – this will be fairly trivial to add once I’ve got the API bedded in.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;I want to take community feedback on syntax highlighting which will change the colour of the tags and elements depending whether it’s plain HTML or Spark specific – not sure if this is valuable.&lt;/li&gt;
&lt;/ul&gt;If you see anything that’s not on this list, but clearly missing, then please let me know and I’ll add it post haste!&lt;br /&gt;
&lt;h2&gt;Installation&lt;/h2&gt;I’ve managed to load the plug-in up into the Visual Studio Gallery and so you can just search for Spark from within VS2010 and it should be installable.&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8KpeIRjmBDXGI8623Mfutj5O6x3WhM2_E-Fyyx2dMm9jSSQ4Q2f3cDO1kkMDQCbErV2Yfi5JI67hApKEcutLNvDESbj2PDtuvAgrKOmyGqtn4QFaQvnMQdAthPNj3ZSpBEuAcUxA7m3s/s1600-h/image14.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;415&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKxHBMR1TGNqSE10v8lWYj_LDkhdTIK58YMDoO-ohtAb1ttKsrbA72Bv6QsZKxXLVwLP6mv8mx61PTTc99sTStFU7C_hKvs3BXwpCxjI4eWK7iVxzMwNbwWr6EMq5ermkyp6Gx2WxAKDw/?imgmax=800&quot; style=&quot;border-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;600&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;h2&gt;How to use it&lt;/h2&gt;Well, after it’s installed, you’ll need to ensure that you associate all &lt;i&gt;*.spark&lt;/i&gt; extensions with the VS HTML Editor. This is how we make sure that we still get HTML and JavaScript support when editing, and we basically augment the completion session based on what is happening around the cursor. I’ve chosen a fairly simplistic icon set from the &lt;i&gt;fantastic&lt;/i&gt; &lt;a href=&quot;http://p.yusukekamiyamane.com/&quot; target=&quot;_blank&quot;&gt;Yusuke Kamiyamane&lt;/a&gt; Fugue Icons Collection. This may change in future, but for now it suites its purpose.&lt;br /&gt;
You’ll notice in the screen grab below that I’ve used the (Alt+period) shortcut to filter Spark items only and it is showing some Partials (denoted with a “P” icon) and of course Spark specific elements (denoted with an “S” icon).&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2s-JT1uAsFP3d_XOldvnF6iahw7NuPDfTGmAm6ObP0WqPG8EjVcWXR4ZiXHXY89X7hq8owahApb-E2Loi5mXPpNEDmfspL3QZlk2WNTc-Fl56uT-viXh5hpysu48IMi8ranZ6ispir7c/s1600-h/image28.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;347&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFbhmp-rBVkJ0qS-dRlPeJZFcqqltHfKzXxS7aYBL3q9HbGLFiekbUyioQKHeHG8afTfzowggRn_6x1PREXu2n71OydaRnOl04TES4zRtqum2yPzylRifzoUgpSuw42MicnVATjfy0QEk/?imgmax=800&quot; style=&quot;border-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;428&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
When we don’t have any HTML completion, then only the Spark completion options show up without the filter. This is the case below where Attributes are denoted where they are found with an “A” icon.&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrJdSMiJiYoWAUP2EoL41PDhcVrKiIvksbOLrRwZfug-Qk8h7xXRbzb4RvO1116fms46SJ7allrXWiMRN3AkuGYEKE657m-LwCmOPL70cjCZig-eFtCNhbJ-cB9wr2MG8y6K5Of-9tRTA/s1600-h/image34.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;171&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDGzq0c3vJDnkvjgoSZAV7-nc0DY5G4LjF4tc61IQg3A3XCrfhkOZX7vhG4Q4N_T2N2nbW6Cmm5hz-JUfUVf82vDH-EJNSPD5VGoCtGPJRInkUv7qE1Ga_kggeIkKoT1VChT7bWEsty3U/?imgmax=800&quot; style=&quot;border-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;395&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
Where we’re able to predict the values of an attribute, as is the case with content areas, they will also show up with a context aware icon. This feature will get a lot more polluted when C# IntelliSense is completed.&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVDnuVu6inj0MQP_0TSrrZmD-z3_cZxhyphenhyphenE3ecXE32CWi0Km5y3Z731XE8Wg6_Tfd5jd_GjrpsVugpCAPrITPDr9LT-Gpo4ZSNN6ChlEms5X3cBYTCaeqAlZR_pYfGgKfCjj9UDP1Lhx00/s1600-h/image40.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;150&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZi2Refw7YJWURFoe1xKb0AL6rPm4n98iJgJLBvu-QxGqhq1j2ZVVVylAArnH8Jaw5PJ8qLhwRI8R3aPYRUk6GndjZ14-MBJ2mKPLPshrweIW9XBOcUbzCdICs0h-cQwRKJQSrV6UgCwA/?imgmax=800&quot; style=&quot;border-width: 0px; display: inline;&quot; title=&quot;image&quot; width=&quot;340&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
Currently, the only IntelliSense available in the ${} syntax are variables and macros. This will of course also be subject to massive expansion once C# IntelliSense comes online.&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg0QcUqBU-i1JnmQRTkUNWKI35KViWWUlTXdN_441qDQ1QrEQm3WuMTyjQFyQw1dA3fDvkbag0igq9EXCrZrVTDVa3OetPr4Gw0A3viErBcn1Tk_3_5-suzcBAsThyvW6hjc8hC4rVLCWc/s1600-h/image%5B7%5D.png&quot;&gt;&lt;img alt=&quot;image&quot; border=&quot;0&quot; height=&quot;192&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh9rt-vOwRIuA2CaLWDXvTWqNiQzMxwJTGTDI5wY4Itk0GRdW6wHdxCpQ7iaD8fSyOzrIondF66777dM70nzq16j0MV0XOiEQmFB5y9-2WcwSQTo_DaeQqSGjGIiLSZZObCn9uNt4PG6xQ/?imgmax=800&quot; style=&quot;border: 0px none; display: inline;&quot; title=&quot;image&quot; width=&quot;335&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
Other than that, give it a whirl and let me know how it goes…&lt;br /&gt;
&lt;h2&gt;Bugs (Update)&lt;/h2&gt;It’s probably worth noting that Spark already has &lt;a href=&quot;http://sparkviewengine.codeplex.com/workitem/list/basic&quot; target=&quot;_blank&quot;&gt;issue tracking in place&lt;/a&gt; – it would be wise if issues were logged in the same place so that they can be properly managed.&lt;br /&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;I intend to release updates every time I’ve either fixed a major bug or added functionality that I or the community think will be useful. As you probably know, getting &lt;a href=&quot;http://blog.robertgreyling.com/2010/05/sparksense-getting-started-wheres.html&quot; target=&quot;_blank&quot;&gt;all the plumbing working&lt;/a&gt; for this kind of thing is the tricky part. Adding features is a lot easier when you’ve got a pipeline setup ready to receive them. I look forward to pushing out updates fast and furiously mainly because I know that there’s a lot more to be done before we can say that SparkSense is actually a useful tool.&lt;br /&gt;
Until next time, &lt;a href=&quot;http://twitter.com/RobertTheGrey&quot; target=&quot;_blank&quot;&gt;Robert The Grey&lt;/a&gt;</description><link>http://blog.robertgreyling.com/2010/08/sparksense-gets-its-first-outing.html</link><author>noreply@blogger.com (Robert Greyling)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKxHBMR1TGNqSE10v8lWYj_LDkhdTIK58YMDoO-ohtAb1ttKsrbA72Bv6QsZKxXLVwLP6mv8mx61PTTc99sTStFU7C_hKvs3BXwpCxjI4eWK7iVxzMwNbwWr6EMq5ermkyp6Gx2WxAKDw/s72-c?imgmax=800" height="72" width="72"/><thr:total>25</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-7071346093687601798</guid><pubDate>Wed, 14 Jul 2010 20:02:00 +0000</pubDate><atom:updated>2010-08-30T22:39:47.255+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Presentations</category><title>Pragmatic Spark – Turning it up to eleven</title><description>This is the title for the talk that I’ll be doing at &lt;a href=&quot;http://www.mvcconf.com/&quot;&gt;mvcconf.com&lt;/a&gt; on 22nd July 2010. Registration was closed due to enthusiastic bombardment in the blink of an eye really, but you’ll be glad to know that they say the sessions will be recorded – and trust me, there are &lt;a href=&quot;http://www.mvcconf.com/sessions&quot;&gt;some crackers there&lt;/a&gt; you’ll want to watch for sure if you’re thinking of or already are working in the MVC space on Microsoft technologies. Hopefully mine goes well enough and I’ll post a link to the recorded session on here when it’s available. But if you are attending, or are interested in the agenda of my talk before watching the recording - you know, just in case it’s &lt;a name=&#39;more&#39;&gt;&lt;/a&gt; a waste of time :), then have a look below:&lt;br /&gt;
&lt;h2&gt;Abstract&lt;/h2&gt;Many developers are desperately unsure when it comes to choosing a view engine to use when building MVC applications. A lot of them liked it better when there was only one the choose from with ASP.NET MVC, while others didn’t really like the idea of being saddled with the WebForms baggage they’d heard about or worked with in traditional ASP.NET. When reviewing alternative view engines, mostly the reasons I hear for not using them are all along the lines of:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Lack of documentation&lt;/li&gt;
&lt;li&gt;Lack of training material&lt;/li&gt;
&lt;li&gt;Lack of example applications, especially “real-world” parallels&lt;/li&gt;
&lt;li&gt;No Visual Studio tooling support such as IntelliSense etc.&lt;/li&gt;
&lt;/ul&gt;Very seldom has it been a case of “My boss won’t let me”. Well, when it comes to the &lt;a href=&quot;http://www.sparkviewengine.com/&quot;&gt;Spark View Engine&lt;/a&gt;, I intend to help close that gap considerably and help developers make informed decisions when deciding on parts of their technology stack. Spark is already 90% there on the documentation front, has a metric ton of training material and examples out there, albeit hard to find and centralize and I’m currently getting ready to put the first beta of Visual Studio IntelliSense support for Spark out for &lt;strike&gt;guinea-pig&lt;/strike&gt; public consumption. Come along if you’d like to find out more…&lt;br /&gt;
&lt;h2&gt;Agenda Points&lt;/h2&gt;Time permitting, these are the things I’d like to cover during the session:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Visual Studio Integration – SparkSense stretches its legs&lt;/li&gt;
&lt;li&gt;Getting your Spark on – From setup to solution structure to layout design&lt;/li&gt;
&lt;li&gt;Implicit Partials – By convention, not Html.RenderPartial&lt;/li&gt;
&lt;li&gt;Macros – The hidden power tool of the view&lt;/li&gt;
&lt;li&gt;JavascriptViewResult – Getting your view logic client-side for free&lt;/li&gt;
&lt;li&gt;Output Caching – Pick a shape, any shape – Donut Sir?&lt;/li&gt;
&lt;li&gt;Bindings – No not Model Binders, something much more interesting&lt;/li&gt;
&lt;li&gt;Hand-holding with FubuMVC – oh how nicely they play together&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;h2&gt;In closing&lt;/h2&gt;If there’s something that you’d particularly like to cover in this session that I haven’t mentioned above, then you’ve got a small window to get your requests in and I’ll see what I can do. Otherwise, I hope you enjoy(ed) it and I look forward to “all sorts” of feedback in the comments.&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Update&lt;/h2&gt;The slides and code examples from this talk can be downloaded from &lt;a href=&quot;http://mvcconf.codeplex.com/releases/view/49503&quot;&gt;here&lt;/a&gt;, and the recording can be viewed &lt;a href=&quot;http://www.viddler.com/explore/mvcconf/videos/9/&quot;&gt;here&lt;/a&gt;. Unfortunately the quality leaves a lot to be desired since the recording was going across the Atlantic which resulted in a fairly delayed experience. I would guess that the visual is about a 5 second lag behind the audio which is unfortunate because I&#39;ve actually seen it accidentally change the meaning of something I said once or twice.&lt;br /&gt;
&lt;br /&gt;
In addition, there were two pieces I didn&#39;t actually have time to get to in the time slot which were JavascriptViewResult and FubuMVC integration. As a result, I&#39;ll be doing this same talk again on 1 Sept 2010 for&amp;nbsp;&lt;a href=&quot;http://www.c4mvc.net/&quot;&gt;C4MVC&lt;/a&gt; and this time with lessons learnt, I&#39;ll be recording locally to produce better audio/video and I&#39;ll be able to focus more on the pace in order to get all the content in.&lt;br /&gt;
Until next time&lt;br /&gt;
&lt;a href=&quot;http://twitter.com/RobertTheGrey&quot;&gt;Robert The Grey&lt;/a&gt;</description><link>http://blog.robertgreyling.com/2010/07/pragmatic-spark-turning-it-up-to-eleven.html</link><author>noreply@blogger.com (Robert Greyling)</author><thr:total>9</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-1948075199955356395</guid><pubDate>Sun, 04 Jul 2010 23:41:00 +0000</pubDate><atom:updated>2010-08-16T16:36:06.005+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">FAQ</category><category domain="http://www.blogger.com/atom/ns#">General Info</category><category domain="http://www.blogger.com/atom/ns#">Spark</category><category domain="http://www.blogger.com/atom/ns#">Technical</category><title>Is Razor just a wolf in Spark’s clothing?</title><description>&lt;h2&gt;Coming soon&lt;/h2&gt;ScottGu &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx&quot; target=&quot;_blank&quot;&gt;just announced&lt;/a&gt; the pending arrival of the new View Engine for ASP.NET codenamed “Razor”. This has been met with some diametrically opposed views (no pun intended) and there are definitely three camps emerging – &lt;a href=&quot;http://blog.beigesunshine.com/2010/07/04/look-who-finally-showed-up-an-ode-to-microsoft/&quot; target=&quot;_blank&quot;&gt;those that hate it&lt;/a&gt;, &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx#7553058&quot; target=&quot;_blank&quot;&gt;those that love it&lt;/a&gt;, and the rest that just look like they’re watching a tennis match with very little emotional investment.&lt;br /&gt;
I read the announcement with intrigue and mixed emotions if I’m honest, and so, in order that I can stop banging on about it, I decided to get it off my chest and &lt;a name=&#39;more&#39;&gt;&lt;/a&gt;put down my current thoughts.&lt;br /&gt;
&lt;h2&gt;Disclaimer&lt;/h2&gt;Razor is not even out yet, but will be in beta soon we’re told – and so for goodness sake, please take this writing as it is meant: Constructive feedback on &lt;a href=&quot;http://weblogs.asp.net/scottgu/archive/2010/07/02/introducing-razor.aspx&quot; target=&quot;_blank&quot;&gt;what we’ve been told so far about it&lt;/a&gt;, and hopefully some of these ramblings will feed into the product to make it better and change some of the things I’ve spoken about below:&lt;br /&gt;
&lt;h2&gt;First the good points&lt;/h2&gt;You have to give credit where it’s due, and it looks like from &lt;a href=&quot;http://weblogs.asp.net/blogs/scottgu/AddView9_thumb_6A5950A4.png&quot; target=&quot;_blank&quot;&gt;the screenshot&lt;/a&gt; that the team is adding default support for Spark and NHaml to the project/view templates tooling – exciting news indeed since that will at least give them a fighting chance!&lt;br /&gt;
The design goals for Razor that ScottGu mentions include that it’s “easy to learn” and “has a low concept count”. I think this is very true for current webforms MVC developers and will be a big plus point. Getting rid of the markers (&lt;span style=&quot;color: #0080ff; font-family: Consolas;&quot;&gt;&amp;lt;%= %&amp;gt;&lt;/span&gt;) is indeed a welcome change and making it smarter about multi-line code blocks using minimal markers will be a great time saver and improve readability in a massive way!&lt;br /&gt;
I don’t think the point about being “unit testable” will carry much weight with the large majority – but you never know, it may be the start of a general trend for the average developer in the .Net realm. But don’t go holding your breath now you hear? The part about “works with any text editor” is just marketing fluff, c’mon Scott, I expect better from you :) – I can write webforms or a C# class in notepad too you know – but I won’t, and neither will Razor users.&lt;br /&gt;
But by and large, those who are used to working with webforms in MVC will find the transition pretty refreshing I would have thought. This will be giving the hundreds of thousands of “walled garden” Microsoft developers some exposure to a what is undoubtedly going to be a better view engine overall than webforms – that in itself is justification alone as far as I’m concerned. &lt;br /&gt;
That particular group of developers are the kind that are never likely to read this blog post or try Spark, or fire up bash and push their changes to github, or know how pleasant it is to crank open a Ruby on Rails or FubuMVC project and have the conventions lead you unerringly towards your goal – a finished and tested product. Why stop them then, getting access to a view engine that is clearly going to beat the pants off of webforms? &lt;br /&gt;
Simple answer – don’t – they should move, and they will. If anything, it’s going to open the eyes of many developers to the possibility that &lt;i&gt;&lt;b&gt;more than one&lt;/b&gt;&lt;/i&gt; view engine is even possible! I was lucky enough to be brought up in a fully bilingual environment and I fully understand the benefits of the &lt;i&gt;knowledge of more than one&lt;/i&gt; and how powerful that can be. It made picking up a third and fourth spoken language very easy for me where those who have never been exposed found it very challenging as an adult. &lt;br /&gt;
I’m willing to bet that the same thing will happen here, and that by promoting a second view engine (Razor) will awaken those developers to the idea of perhaps exploring even further than that! Once you know two, the third is a piece of cake. Then go ahead and provide good &lt;a href=&quot;http://blog.robertgreyling.com/2010/05/building-intellisense-engine-for-spark.html&quot; target=&quot;_blank&quot;&gt;tooling support&lt;/a&gt; and it’ll be a dead cert!&lt;br /&gt;
But wait, there’s more! Two words: “The Enterprise” – Razor will no doubt come with the big blue badge of approval, and because of that, large companies (and the developers that work for them) will be able to adopt something better than they’ve got today. This is a step in the right direction folks, let’s not lose sight of that. The Enterprise is a big ship with an even bigger wheel, and it’s never been easy to turn that sucker.&lt;br /&gt;
&lt;h2&gt;Spark’s clothing&lt;/h2&gt;OK now let’s talk turkey - it’s painfully obvious that Razor has gotten many of its design cues from the &lt;a href=&quot;http://sparkviewengine.com/&quot; target=&quot;_blank&quot;&gt;Spark View Engine&lt;/a&gt;. I’m not only talking about code, because that’s clearly what most people think of first when they hear it said. I was vey careful when I chose the words “design cues”, but I’m pretty sure I’ll be roasted alive if I don’t give concrete examples, and I will, so just calm down for now…&lt;br /&gt;
The Spark philosophy is to “blend in” with HTML so that it looks cleaner and can stay out of your way. Now I’m not suggesting that Razor will “get in your way” – no, but it will be obvious which parts of the code are HTML and which parts are Razor blocks – just like it is in webforms today. That’s fine, many people actually prefer it that way. &lt;br /&gt;
I’ve heard people say that their designers get confused by seeing HTML tags (Spark) that they don’t recognise and so don’t know what to do with them. I disagree, but it’s a fair comment, and I think there’s no arguing that this particular thing comes down to personal preference, team composition and developer knowledge and skill.&lt;br /&gt;
&lt;h2&gt;Code oriented vs. Mark-up oriented&lt;/h2&gt;Many &lt;a href=&quot;http://twitter.com/shanselman/statuses/17638812622&quot; target=&quot;_blank&quot;&gt;are saying&lt;/a&gt; that Razor and Spark are two sides of the same coin. Razor would appeal to the more code oriented developer, whereas Spark would appeal to the more mark-up oriented developer. I’m not quite sure what that means, but it sounds like a bit of a &lt;strike&gt;load of crap&lt;/strike&gt; cop-out if I’m honest. My feeling is that if you’re a web developer, you work with code, and you work with mark-up. The goal you’re seeking to achieve is separation of concerns, which means business logic does not belong in the view.&lt;br /&gt;
“Now which do you think is more likely to keep the business logic out of the view – Mark-up oriented, or Code oriented?”&lt;br /&gt;
And yet insistence that Spark is all about HTML mark-up extensions clearly comes from those without much experience with Spark. Spark can also be written in such a way as to define all the display logic via a code oriented means. Being able to do this doesn’t mean it’s a good idea, it’s just a testament to the power and flexibility of Spark.&lt;br /&gt;
Spark does this using the statement marker &lt;span style=&quot;color: #0080ff; font-family: Consolas;&quot;&gt;#&lt;/span&gt;, which you can change from &lt;span style=&quot;color: #0080ff; font-family: Consolas;&quot;&gt;#&lt;/span&gt; to an &lt;span style=&quot;color: #0080ff; font-family: Consolas;&quot;&gt;@&lt;/span&gt; in your Spark configuration if you’d like it to look Razor-like, but there is a clear and present danger inherent in doing this and it is only provided in Spark for completeness and for the times when that edge case is really biting you hard! By bringing C# and VB to the view, you are dishing out a copious amount of rope for inexperienced developers to hang themselves (and those that follow) with.&lt;br /&gt;
This is nothing new – I see it every day in webforms. All this new syntax is going to do is encourage even more developers to (unwittingly) embed more of their business logic in their views because now it’s actually capable of looking somewhat tidy, whereas when &lt;span style=&quot;color: #0080ff; font-family: Consolas;&quot;&gt;&amp;lt;%= %&amp;gt;&lt;/span&gt; were strewn throughout the view, they would tend to use it sparingly, partially just because it looked so ugly. Now it’s gonna look pretty – fantastic news! &amp;lt;/sarcasm&amp;gt;&lt;br /&gt;
&lt;h2&gt;Enter the wolf&lt;/h2&gt;What this basically boils down to is answering the question of whether or not the View Engine is being true to the “V” in MVC. &lt;br /&gt;
If you’re querying &lt;span style=&quot;color: #0080ff; font-family: Consolas;&quot;&gt;DateTime.Now.Year == 2010&lt;/span&gt; in &lt;a href=&quot;http://weblogs.asp.net/blogs/scottgu/image_thumb_4A2A0A1B.png&quot; target=&quot;_blank&quot;&gt;your View&lt;/a&gt;, you’re &lt;i&gt;doin’ it wrong&lt;/i&gt;! For heaven’s sake, that comparison should be a property on your view model! And don’t say it’s just an example – people actually &lt;i&gt;do this&lt;/i&gt;!&lt;br /&gt;
Well - you might say - if Spark and Razor are both capable of allowing the developer to make those mistakes, then it’s the developer’s fault since neither view engine can prevent it! That may be true, but what’s also true is the spirit in which it’s done. &lt;br /&gt;
Spark &lt;i&gt;actively&lt;/i&gt; discourages this behaviour by limiting the syntax it &lt;i&gt;recommends&lt;/i&gt; you use in the view, and providing powerful ways with which to work with the concerns of the view model and display logic – but it tries hard to stop you there, and that is a good thing! You should be doing the rest in the “Model” and “Controller” parts!&lt;br /&gt;
Razor actively sells it! It SELLS the fact that you can write code in your view as a good thing! And in the same way that warning leaflets were not handed out at the door with webforms, Razor will find its reputation equally tarnished by developers who just don’t know any better! IF you use Razor correctly, in the true spirit of MVC, you won’t find a use for half of the code blocks they’re pushing. Your views will actually look very HTML-esque with very few code blocks, and those code blocks will be true to working with the view model and display logic. Why then sell the fact that you can write code in there? Rather spend your time training developers in the right way to do it…&lt;br /&gt;
&lt;h2&gt;Apples with Apples (and Oranges)&lt;/h2&gt;A promised, I’m going to compare and contrast Razor and Spark with examples. Now I don’t want to speculate about Razor, and so I’ll be using those provided by ScottGu in his post rather than making them up. I’m also not going to labour this point too much because it’s not the point of the article. The point is giving developers the tools and understanding to execute the MVC pattern effectively with an exceptionally high degree of future maintainability. We know from bitter experience that writing a heap of code in your view does not achieve this goal:&lt;br /&gt;
&lt;table border=&quot;1&quot; cellpadding=&quot;2&quot; cellspacing=&quot;0&quot; style=&quot;width: 847px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;h2 align=&quot;center&quot;&gt;Razor&lt;/h2&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;h2 align=&quot;center&quot;&gt;Spark in code&lt;/h2&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;303&quot;&gt;&lt;h2 align=&quot;center&quot;&gt;Spark in mark-up&lt;/h2&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;span style=&quot;color: #ff8040;&quot;&gt;Loop through a list of products&lt;/span&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;303&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;pre class=&quot;brush: xml;toolbar: false;gutter: false&quot; name=&quot;code&quot;&gt;&amp;lt;ul&amp;gt;
@foreach(var p in products) {
    &amp;lt;li&amp;gt;@p.Name&amp;lt;/li&amp;gt;
  }
&amp;lt;/ul&amp;gt;&lt;/pre&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;pre class=&quot;brush: xml;toolbar: false;gutter: false&quot; name=&quot;code&quot;&gt;&amp;lt;ul&amp;gt;
#foreach(var p in products) {
    &amp;lt;li&amp;gt;${p.Name}&amp;lt;/li&amp;gt;
  #}
&amp;lt;/ul&amp;gt;&lt;/pre&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;303&quot;&gt;&lt;pre class=&quot;brush: xml;toolbar: false;gutter: false&quot; name=&quot;code&quot;&gt;&amp;lt;ul&amp;gt;
  &amp;lt;li each=”var p in Model.Products”&amp;gt;
    ${p.Name}
  &amp;lt;/li&amp;gt;  
&amp;lt;/ul&amp;gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;span style=&quot;color: #ff8040;&quot;&gt;If Statements&lt;/span&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;303&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;pre class=&quot;brush: xml;toolbar: false;gutter: false&quot; name=&quot;code&quot;&gt;@if(products.Count == 0) {
  &amp;lt;p&amp;gt;Sorry - nothing&amp;lt;/p&amp;gt;
} else {
&amp;lt;p&amp;gt;Got it!&amp;lt;/p&amp;gt;
}&lt;/pre&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;pre class=&quot;brush: xml;toolbar: false;gutter: false&quot; name=&quot;code&quot;&gt;#if(products.Count == 0) {
  &amp;lt;p&amp;gt;Sorry - nothing&amp;lt;/p&amp;gt;
#} else {
&amp;lt;p&amp;gt;Got it!&amp;lt;/p&amp;gt;
#}&lt;/pre&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;303&quot;&gt;&lt;pre class=&quot;brush: xml;toolbar: false;gutter: false&quot; name=&quot;code&quot;&gt;&amp;lt;p if=”products.Count==0”&amp;gt;
Sorry - nothing&amp;lt;/p&amp;gt;
&amp;lt;else&amp;gt;
&amp;lt;p&amp;gt;Got it!&amp;lt;/p&amp;gt;
&amp;lt;/else&amp;gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;span style=&quot;color: #ff8040;&quot;&gt;Layout/Master page selection&lt;/span&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;303&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;pre class=&quot;brush: xml;toolbar: false;gutter: false&quot; name=&quot;code&quot;&gt;@{
  LayoutPage = ”Products.cshtml”;
}&lt;/pre&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;There’s no point really, but can be specified in code by the Controller&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;303&quot;&gt;&lt;pre class=&quot;brush: xml;toolbar: false;gutter: false&quot; name=&quot;code&quot;&gt;&amp;lt;use master=&quot;Products&quot;/&amp;gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;span style=&quot;color: #ff8040;&quot;&gt;Rendering specific sections&lt;/span&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;303&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;pre class=&quot;brush: xml;toolbar: false;gutter: false&quot; name=&quot;code&quot;&gt;@RenderSection(“header”, true)
@RenderBody()
@RenderSection(“footer”, true)&lt;/pre&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;pre class=&quot;brush: xml;toolbar: false;gutter: false&quot; name=&quot;code&quot;&gt;#Content[“header”]
#Content[“body”]
#Content[“footer”]&lt;/pre&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;303&quot;&gt;&lt;pre class=&quot;brush: xml;toolbar: false;gutter: false&quot; name=&quot;code&quot;&gt;&amp;lt;use content=”header” /&amp;gt;
&amp;lt;use:body /&amp;gt;
&amp;lt;use:footer /&amp;gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;span style=&quot;color: #ff8040;&quot;&gt;Section definitions&lt;/span&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;303&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;pre class=&quot;brush: xml;toolbar: false;gutter: false&quot; name=&quot;code&quot;&gt;@section footer{
&amp;lt;div&amp;gt;home footer&amp;lt;/div&amp;gt;
}&lt;/pre&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;No point in code for something this simple, but Spark has two concepts: &amp;lt;content&amp;gt; and &amp;lt;section&amp;gt; left as a research exercise – you’ll love it ;-)&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;303&quot;&gt;&lt;pre class=&quot;brush: xml;toolbar: false;gutter: false&quot; name=&quot;code&quot;&gt;&amp;lt;content name=”footer”&amp;gt;
&amp;lt;div&amp;gt;home footer&amp;lt;/div&amp;gt;
&amp;lt;/content&amp;gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;span style=&quot;color: #ff8040;&quot;&gt;HTML helpers&lt;/span&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;303&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;pre class=&quot;brush: xml;toolbar: false;gutter: false&quot; name=&quot;code&quot;&gt;@Html.LabelFor(m =&amp;gt; m.ProductID)&lt;/pre&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;271&quot;&gt;&lt;pre class=&quot;brush: xml;toolbar: false;gutter: false&quot; name=&quot;code&quot;&gt;#Html.LabelFor(m =&amp;gt; m.ProductID)&lt;/pre&gt;&lt;/td&gt; &lt;td valign=&quot;top&quot; width=&quot;303&quot;&gt;&lt;pre class=&quot;brush: xml;toolbar: false;gutter: false&quot; name=&quot;code&quot;&gt;${Html.LabelFor(m =&amp;gt; m.ProductID)}&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;And so on…I could go on, but is there any point? As for the “Declarative HTML Helpers” mentioned in ScottGu’s post, I could also go into a long diatribe about how that is completely covered (and then some) by using the power behind Spark Partials and Section declarations as well as Macros, but I won’t because I think I’ve already made my point.&lt;br /&gt;
All I’m trying to do here is just show those people who can’t be bothered to do the research, but feel like they can speak with authority when they say that &lt;a href=&quot;http://twitter.com/Grumpydev/statuses/17637098925&quot; target=&quot;_blank&quot;&gt;Razor and Spark look nothing alike&lt;/a&gt;.&lt;br /&gt;
Nuff said…&lt;br /&gt;
&lt;h2&gt;Open Source&lt;/h2&gt;Now I know this is gonna sound crazy, but hear me out – no wait, I can’t suggest it – forget I said anything…let’s just move on. Oh, really? Oh alright then, but I’ll whisper in case someone hears… what if…&lt;i&gt;shhh&lt;/i&gt;…what if Microsoft asked if they could pick up and contribute to the refinement and expansion of Spark for example? Heck, the &lt;a href=&quot;http://whereslou.com/&quot; target=&quot;_blank&quot;&gt;primary author&lt;/a&gt; works for them after all!&lt;br /&gt;
I know…silly idea isn’t it? Don’t tell anyone I mentioned it please. In all seriousness though, there’s no doubt in my mind that this &lt;a href=&quot;http://twitter.com/shanselman/statuses/17639721094&quot; target=&quot;_blank&quot;&gt;conversation came up internally&lt;/a&gt;, but I don’t think the real reasons for deciding against it will be forthcoming any time soon.&lt;br /&gt;
I’m mostly confused because it boils down to resourcing. It stands to reason that Microsoft has put ‘X’ resources full time onto this project. Those resources had to start from scratch and (I’m willing to bet body parts) took many design decisions from Spark (and probably NHaml and NVelocity). Given the similarities, and since Spark already supports the things that Razor does (albeit slightly different), I can only imagine that they didn’t do it because they wanted ownership of their &lt;i&gt;own thing&lt;/i&gt;, or were fearful about partial ownership (and therefore not total control) of an existing OSS code base.&lt;br /&gt;
I’m all for the idea of building things of value, and I’m fairly sure that Razor will end up being just that, but I fail to see why Microsoft didn’t see the value already out there (as they did with jQuery) and put their oversized and underused muscles behind it. I’m trying my best to reserve judgement right now because this thing hasn’t even come off the showroom floor yet, and perhaps there is something huge that we don’t know about that has prevented this scenario from playing out – but that remains to be seen. Perhaps the way they’ve done it is a good hook for control library vendors to get stuck into it? &lt;br /&gt;
Or, maybe this will just go down as yet another opportunity they’ve missed to earn their stripes in the OSS community at large – I mean, what the hell else is &lt;a href=&quot;http://codeplex.org/&quot; target=&quot;_blank&quot;&gt;codeplex.org&lt;/a&gt; for anyway?! In the end, the &lt;i&gt;truth will out&lt;/i&gt;, so for now it’s a waiting game…&lt;br /&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;As you can see, I still think the jury’s out on this one, and we’ll have to wait and see what comes out further down the line. I know that many people in the adjacent Ruby and Java communities etc. are of the opinion that very little innovation has been forthcoming from Microsoft in the last few years and I tend to agree to some extent, but something that I’m acutely conscious of (working with large Enterprises almost daily) is that they are massive ships, and take an absolute age to turn in any direction. For better or worse, this has been (and probably will be for some time) Microsoft’s key area of focus.&lt;br /&gt;
One thing is certain in my mind though – ScottGu is a leader and an innovator and I think he’s the right guy to be driving this kind of thing. He is a ship turner and there are very few people out there who can lay claim a title like that. So I’ll give them the benefit of the doubt for now and in the end, having more choice can’t be a bad thing and if that’s all this ends up being, then so be it.&lt;br /&gt;
I do however personally think, that Microsoft should stand up and say a big public “thank you” to the NHaml, NVelocity and Spark developer communities for solving this View Engine problem for them on the ASP.NET platform and paving a fairly easy path to what could be a successful product. The absolute height of arrogance would be claiming Razor as their own de facto brainchild.&lt;br /&gt;
There, now I feel much better…&lt;br /&gt;
Until next time&lt;br /&gt;
&lt;a href=&quot;http://twitter.com/RobertTheGrey&quot; target=&quot;_blank&quot;&gt;Robert The Grey&lt;/a&gt;</description><link>http://blog.robertgreyling.com/2010/07/is-razor-just-wolf-in-sparks-clothing.html</link><author>noreply@blogger.com (Robert Greyling)</author><thr:total>12</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-2214919648064955508</guid><pubDate>Tue, 25 May 2010 12:31:00 +0000</pubDate><atom:updated>2010-08-16T16:36:19.707+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Spark</category><category domain="http://www.blogger.com/atom/ns#">Technical</category><category domain="http://www.blogger.com/atom/ns#">VS Extensibility</category><title>SparkSense: Getting started - where’s a plumber when you need one?</title><description>This post is &lt;a href=&quot;http://blog.robertgreyling.com/2010/05/building-intellisense-engine-for-spark.html&quot; target=&quot;_blank&quot;&gt;part of a series&lt;/a&gt; and you may want to read them in order.&lt;br /&gt;
&lt;h2&gt;First things first&lt;/h2&gt;If you’re gonna be building an extension to the Visual Studio 2010 Editor, you’ll be needing a couple of resources – and little did I know how scarce those would turn out to be. Microsoft have started what looks like, could be a promising set of documentation around &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/dd885242%28v=VS.100%29.aspx&quot; target=&quot;_blank&quot;&gt;extending the VS2010 editor&lt;/a&gt;. There are err…&lt;a name=&#39;more&#39;&gt;&lt;/a&gt; how can I put it… a few obstacles to overcome though when wading through it all.&lt;br /&gt;
&lt;br /&gt;
For example, the information surrounding the code examples and API descriptions they’ve put together run about as deep as a river through the &lt;a href=&quot;http://en.wikipedia.org/wiki/Atacama_Desert&quot; target=&quot;_blank&quot;&gt;Atacama Desert&lt;/a&gt;. They skim over details where elaboration is crucial to understanding, and they elaborate in other areas which just end up stating the obvious. Sometimes it feels like there’s a chimp mashing the keyboard on the other side of these documents. &lt;br /&gt;
The code samples themselves are also of appalling quality, violating about as many &lt;a href=&quot;http://en.wikipedia.org/wiki/Solid_%28object-oriented_design%29&quot; target=&quot;_blank&quot;&gt;SOLID principles&lt;/a&gt; as you can count on two hands…oh wait, there are only five. But then again, I guess we can’t expect them to everything for us – we need to earn a crust somehow. Just take it as a word of warning, that significant refactoring will result from a copy+paste job from here if you want to produce something maintainable. &lt;br /&gt;
Another big problem I have with the documentation is the &lt;a href=&quot;http://mef.codeplex.com/&quot; target=&quot;_blank&quot;&gt;MEF&lt;/a&gt; imports. Don’t get me wrong – I’m a massive fan of &lt;a href=&quot;http://mef.codeplex.com/&quot; target=&quot;_blank&quot;&gt;MEF&lt;/a&gt;, but when one of the code examples for say, creating an &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;IVsTextViewCreationListener&lt;/span&gt; for signature recognition, they expect you to somehow know (by osmosis) that you’ll be needing to let &lt;a href=&quot;http://mef.codeplex.com/&quot; target=&quot;_blank&quot;&gt;MEF&lt;/a&gt; know to bring along an instance of &lt;span style=&quot;color: #0080c0;&quot;&gt;IVsEditorAdaptersFactoryService&lt;/span&gt; for moral support. And what does an &lt;span style=&quot;color: #0080c0;&quot;&gt;IVsEditorAdaptersFactoryService&lt;/span&gt; do exactly pray tell? I shit you not, &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.editor.ivseditoradaptersfactoryservice.aspx&quot; target=&quot;_blank&quot;&gt;MSDN has this to say&lt;/a&gt;:&lt;br /&gt;
&lt;blockquote&gt;&lt;span style=&quot;color: grey; font-family: Constantia; font-size: medium;&quot;&gt;“Represents a factory service for creating editor adapter objects, and mapping between the adapter and the underlying new editor objects”&lt;/span&gt;&lt;/blockquote&gt;Aha…well why didn’t you just say so? That kind of sentence could easily end a game of “Architect Bingo” midstride. I don’t know about you, but this just doesn’t cut it for me when it comes to proper documentation, and building software this way can only be compared with walking through a cave blindfolded, being led onward by a sadistic mute, never indicating when the ceiling suddenly slopes. &lt;br /&gt;
I’ve come to expect this kind of rubbish over the years from MSDN in general, and I’m not sure why I thought this time would be any different. As luck would have it though, and as I said in my &lt;a href=&quot;http://blog.robertgreyling.com/2010/05/building-intellisense-engine-for-spark.html&quot; target=&quot;_blank&quot;&gt;introduction post to this series&lt;/a&gt;, there has been some brave pioneering in this area before me.&lt;br /&gt;
&lt;h2&gt;No shortcuts&lt;/h2&gt;I’m afraid it’s true though that until a decent book comes out about this stuff, you’re pretty much going to be stuck with &lt;a href=&quot;http://www.hill30.com/MikeFeingoldBlog/index.php/2009/07/29/django-editor-in-vs-2010-part-0-background/&quot; target=&quot;_blank&quot;&gt;blog posts&lt;/a&gt; and knee deep code wading sessions. The best I can do here is outline a skeleton structure to start with and hope that the MSDN documentation catches up one day – although I’ve probably got more chance of falling pregnant. Other than that, it’s code spelunking where others have gone before.&lt;br /&gt;
&lt;h2&gt;Moving parts&lt;/h2&gt;Depending on what you’re planning to deliver with your IntelliSense Engine, there may be various pieces you may be looking at. I would like to deliver SparkSense with the following components to start with:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Statement completion – basically dig out all the right keywords and variables to use at the right times when writing code;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Signature recognition – documentation that appears while writing code providing API assistance when it comes to known terms;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Quick Info – tooltips that provide simple documentation about elements when hovering;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Custom Presenter – This allows for better filtering of Spark keywords from HTML keywords etc.&lt;br /&gt;
&lt;/li&gt;
&lt;/ul&gt;&lt;h2&gt;Plumbing bits&lt;/h2&gt;In order to get the meat of your particular code going, there are a few bootstrapping items that need taking care of. For each of the moving parts above, the VS Team have provided some hooks to get in on the VS Editor pipeline. There is at least a measure of consistency here when it comes to the API at least in terms of convention which is promising. &lt;br /&gt;
You’ll be using &lt;a href=&quot;http://mef.codeplex.com/&quot; target=&quot;_blank&quot;&gt;MEF&lt;/a&gt; to listen for specific signals, and then at that point, use those listeners to pull in additional services and spin up the implementation instance for the particular piece you’re working on. I’m trying to use general terms here in order to emphasise the conventions being used. Those familiar with Service Location breed of patterns should find it fairly simple. Let’s go through some concrete examples:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;For statement completion you’ll derive from &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;ICompletionSourceProvider &lt;/span&gt;and use that instance to instantiate your own derived &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;ICompletionSource&lt;/span&gt;.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;For signature recognition you’ll derive from &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;ISignatureHelpSourceProvider&lt;/span&gt; and use that instance to instantiate your own derived &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;ISignatureHelpSource&lt;/span&gt;.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;For quick info you’ll derive from &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;IQuickInfoSourceProvider&lt;/span&gt; and use that instance to instantiate your own derived &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;IQuickInfoSource&lt;/span&gt;.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;For a custom presenter you’ll derive from &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;IIntellisensePresenterProvider&lt;/span&gt; and use that instance to instantiate your own derived &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;IPopupIntellisensePresenter &lt;/span&gt;(and &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;IIntellisenseCommandTarget&lt;/span&gt; for keyboard support).&lt;/li&gt;
&lt;/ul&gt;Seeing a pattern here? Now that we have a Provider and Source, you’ll be able to actually build and provide things like completion lists and tooltip information by implementing the &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;Augment*&lt;/span&gt; methods in each of the &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;I*Source&lt;/span&gt; interfaces. But there’s a missing piece here – how do we actually hook into the key strokes and mouse move events that get fired moment to moment in the editor. Well, that’s a different bit of bootstrapping you need to setup. They’re not quite as convention based as above, but it’s close enough:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;For both statement completion and signature completion you’ll derive from &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;IVsTextViewCreationListener &lt;/span&gt;and use that instance to instantiate your own derived &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;IOleCommandTarget&lt;/span&gt;.&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;For quick info you’ll derive from &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;IIntellisenseControllerProvider&lt;/span&gt; and use that instance to instantiate your own derived &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;IIntellisenseController&lt;/span&gt;.&lt;/li&gt;
&lt;/ul&gt;Lost? Still thinking it’s a little fluffy? OK, here’s an example of the statement completion implementation of the some of the above interfaces for SparkSense just to give you something a little a more concrete:&lt;br /&gt;
&lt;pre class=&quot;csharp&quot; name=&quot;code&quot;&gt;namespace SparkSense.StatementCompletion
{
[Export(typeof (ICompletionSourceProvider))]
[ContentType(&quot;spark&quot;)]
[ContentType(&quot;HTML&quot;)]
[Name(&quot;Spark Tag Completion&quot;)]
public class CompletionListener : ICompletionSourceProvider
{
[Import]
internal ITextStructureNavigatorSelectorService TextNavigator { get; set; }

#region ICompletionSourceProvider Members

public ICompletionSource TryCreateCompletionSource(ITextBuffer textBuffer)
{
return new CompletionSource(TextNavigator, textBuffer);
}

#endregion
}
}

namespace SparkSense.StatementCompletion
{
public class CompletionSource : ICompletionSource
{
private bool _isDisposed;
private ITextBuffer _textBuffer;

public CompletionSource(ITextBuffer textBuffer)
{
_textBuffer = textBuffer;
}

#region ICompletionSource Members

public void AugmentCompletionSession(ICompletionSession session, IList&lt;completionset&gt; completionSets)
{
SparkSyntaxTypes syntaxType;
IViewExplorer viewExplorer;

session.Properties.TryGetProperty(typeof(SparkSyntaxTypes), out syntaxType);
session.Properties.TryGetProperty(typeof(ViewExplorer), out viewExplorer);

CompletionSet sparkCompletions = SparkCompletionSetFactory.GetCompletionSetFor(session, _textBuffer, viewExplorer, syntaxType);
if (sparkCompletions != null) completionSets.Add(sparkCompletions);
}

public void Dispose()
{
if (_isDisposed) return;
GC.SuppressFinalize(this);
_isDisposed = true;
}

#endregion
}
}
&lt;/completionset&gt;&lt;/pre&gt;Phew! OK, now we’re getting somewhere. This is a snippet of what’s going on under the covers so I wouldn’t try and make too much sense of it unless you’re planning on looking at the rest of it. Soon I’ll be publishing articles that focuses on each of the areas above. Notice the use of &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;[Import]&lt;/span&gt; and &lt;span style=&quot;color: #0080c0; font-family: Consolas;&quot;&gt;[Export]&lt;/span&gt; attributes which help &lt;a href=&quot;http://mef.codeplex.com/&quot; target=&quot;_blank&quot;&gt;MEF&lt;/a&gt; recognise the code as a plug-in and in need of certain services. I know it may seem fairly overwhelming, but implementing one of them is very similar to another, so just focus on one at a time.&lt;br /&gt;
&lt;h2&gt;The Code&lt;/h2&gt;As of this writing I am currently maintaining two separate projects. As I stabilize and unit test the pieces, I am integrating them into my &lt;a href=&quot;http://github.com/RobertTheGrey/spark/tree/SparkSense&quot; target=&quot;_blank&quot;&gt;public fork on github&lt;/a&gt;. What’s not public is currently incubating in a private branch so that I can properly test it. I’m happy to say though that most of the big problems now have solutions and so with a bit of testing and filling out, we should have something useable fairly soon, in fact I’m hopeful that’ll happen before I complete this series. Personally I wouldn’t advise you to actually use the plug-in for Spark development until it’s officially available from the Visual Studio Extensions Gallery, but if it’s the code you’re more interested in, then feel free to come along for the ride.&lt;br /&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;So that’s a brief look into to the plumbing required when setting up an editor extension like this. There are quite a few moving parts to consider, and rather than post all the code here for those that are interested, it’d be far better for you to consult a &lt;a href=&quot;http://github.com/RobertTheGrey/spark/tree/SparkSense&quot; target=&quot;_blank&quot;&gt;living, breathing code base&lt;/a&gt; so that you’re not referring to stale information. Either way, I hope it helps get you part of the way there.&lt;br /&gt;
Until next time, &lt;a href=&quot;http://twitter.com/RobertTheGrey&quot; target=&quot;_blank&quot;&gt;Robert The Grey&lt;/a&gt;</description><link>http://blog.robertgreyling.com/2010/05/sparksense-getting-started-wheres.html</link><author>noreply@blogger.com (Robert Greyling)</author><thr:total>19</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-2281183697971779450</guid><pubDate>Sat, 08 May 2010 12:07:00 +0000</pubDate><atom:updated>2010-08-16T16:36:39.031+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Spark</category><category domain="http://www.blogger.com/atom/ns#">Technical</category><category domain="http://www.blogger.com/atom/ns#">VS Extensibility</category><title>Building an IntelliSense Engine for Spark in Visual Studio 2010</title><description>Spark IntelliSense : I hereby dub thee SparkSense of the vs2010 district!&lt;br /&gt;
&lt;h2&gt;Background&lt;/h2&gt;Turns out there are a fair number of folk using the &lt;a href=&quot;http://sparkviewengine.com/&quot; target=&quot;_blank&quot;&gt;Spark View Engine&lt;/a&gt; these days, and not just in the &lt;a href=&quot;http://www.asp.net/mvc&quot; target=&quot;_blank&quot;&gt;Microsoft ASP.NET MVC&lt;/a&gt; space. Those that are in that space however, pretty much exclusively work in Visual Studio and there have been many concerns voiced in the Spark community that the lack of IntelliSense features built into the editor are potentially hampering the uptake of Spark as a primary choice of View Engine for &lt;a href=&quot;http://www.asp.net/mvc&quot; target=&quot;_blank&quot;&gt;MS MVC&lt;/a&gt; applications. I’m not sure how true that is, but there are a number of &lt;a name=&#39;more&#39;&gt;&lt;/a&gt; other benefits to be explored…&lt;br /&gt;
&lt;br /&gt;
&lt;h2&gt;Documentation can only get you so far…&lt;/h2&gt;I feel the same pain as most of the Spark developers, having to constantly keep the documentation open in a web browser and referring back and forth making many mistakes that increasingly affect my workflow and productivity. And whilst the Spark documentation is pretty good by open source standards, there are a number of subtle and hidden features that are not really discoverable right now without ploughing headfirst into the &lt;a href=&quot;http://github.com/loudej/spark&quot; target=&quot;_blank&quot;&gt;source code&lt;/a&gt;. In addition, we all know that documentation is always playing catch-up because there are no unit tests that fail when it gets out of sync.&lt;br /&gt;
&lt;h2&gt;Productivity&lt;/h2&gt;IntelliSense, whilst considered a crutch by many of the &lt;i&gt;hard-core&lt;/i&gt; types out there, has a proven track record of raising discoverability of an API and improving coding accuracy specifically in areas like HTML, CSS and JavaScript, where we don’t have a compiler to check up on us, and more often than not, we spend our time flicking between code and browser until we’ve well and truly worn out the ALT+Tab and F5 keys.&lt;br /&gt;
My hope is that SparkSense can plug some holes that naturally occur here, and also give one of the best view engines I have ever worked with a fighting chance and more adoption in the greater Visual Studio community. If can shave just a few minutes a day off of developer workflow interruption by building this, then it will have been worth it!&lt;br /&gt;
&lt;h2&gt;What’s a developer to do?&lt;/h2&gt;I recently co-founded a start-up called &lt;a href=&quot;http://blog.cozwecan.com/&quot; target=&quot;_blank&quot;&gt;cozwecan.com&lt;/a&gt; and given that &lt;a href=&quot;http://twitter.com/scottgal&quot; target=&quot;_blank&quot;&gt;Scott&lt;/a&gt; and I will be knee deep in Spark and vs2010 for the foreseeable future, it made sense to have a look at what the new vs2010 Editor extensions had to offer. Overall, I must say I’m pretty pleased with the new API, but once again, documentation has let the side down and is more sparse than reputable politicians, and discoverability doesn’t even feature at all I’m afraid to say!&lt;br /&gt;
&lt;h2&gt;With a little help from my friends…&lt;/h2&gt;Needless to say, I moved past that and whilst I’d like to take credit for this exercise, I couldn’t have gotten this far without standing on the shoulders of some pretty tall blokes. I couldn’t find anyone who had singlehandedly gone as far as I’d like to see SparkSense go, but I found some that have done bits and pieces here and there:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.hill30.com/MikeFeingoldBlog/index.php/2009/07/29/django-editor-in-vs-2010-part-0-background/&quot; target=&quot;_blank&quot;&gt;Mike Feingold on building the Django Editor&lt;/a&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://dotneteers.net/blogs/divedeeper/archive/2010/03/02/visual-studio-packages.aspx&quot; target=&quot;_blank&quot;&gt;Inovak’s work on Package Development&lt;/a&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://github.com/NoahRic/MarkdownMode&quot; target=&quot;_blank&quot;&gt;Noah Richard’s work on Markdown Mode&lt;/a&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://karlshifflett.wordpress.com/2010/03/21/visual-studio-2010-xaml-editor-intellisense-presenter-extension/&quot; target=&quot;_blank&quot;&gt;Karl’s work on the XAML IntelliSense Presenter&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;Their selfless contributions to the community at large in this area have been and continue to be an invaluable resource for me! And in the spirit of open source, I have borrowed ideas from their work, and hopefully my contributions made in the same spirit can help someone else in their endeavours into what can only be described as the wasteland of Visual Studio Editor extensions developer documentation. Thanks &lt;i&gt;a bunch&lt;/i&gt; for your hard work guys and unwittingly helping me plough on through!&lt;br /&gt;
&lt;h2&gt;So what’s on the menu?&lt;/h2&gt;Rather than wait until I’m completely done building this thing and forgetting about the issues I faced on the journey, I’ve decided to document that journey here and break up the key development areas just as &lt;a href=&quot;http://www.hill30.com/MikeFeingoldBlog/&quot; target=&quot;_blank&quot;&gt;Mike&lt;/a&gt; did, since &lt;a href=&quot;http://www.hill30.com/MikeFeingoldBlog/index.php/2009/07/29/django-editor-in-vs-2010-part-0-background/&quot; target=&quot;_blank&quot;&gt;his series&lt;/a&gt; was incredibly informative and useful to me. I’m a fair way through coding already, but there’s still a long way to go before V1.0 and I’m still reeling from some of the pain points I’ll mention in the series. Since this was a learning exercise for me, I thought others might benefit from that format too and so my intention is to post regularly over the next few weeks covering the following topics as I try and get this puppy out the door:&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;&lt;a href=&quot;http://blog.robertgreyling.com/2010/05/sparksense-getting-started-wheres.html&quot; target=&quot;_blank&quot;&gt;Getting started – where’s a plumber when you need one?&lt;/a&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Our old friend COM and the Visual Studio DTE&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Working with the Spark Parser, Grammar and Compiler&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Adding Statement completion&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Adding Quick Info and Signature Recognition&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Making a better Presenter for multiple completion sets&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Dealing with parsing performance headaches&lt;/li&gt;
&lt;/ol&gt;I hope this breakdown will be informative for you, but if there is something in particular you want covered and I haven’t got it listed above, then mention it in the comments and I’ll see what I can do. I’ll occasionally update the list above and announce on &lt;a href=&quot;http://www.twitter.com/RobertTheGrey&quot; target=&quot;_blank&quot;&gt;twitter&lt;/a&gt; as I publish each section or you could also &lt;a href=&quot;http://feeds.feedburner.com/RobertTheGrey&quot; target=&quot;_blank&quot;&gt;subscribe to the feed&lt;/a&gt; if you prefer.&lt;br /&gt;
Until next time… &lt;a href=&quot;http://twitter.com/RobertTheGrey&quot; target=&quot;_blank&quot;&gt;Robert The Grey&lt;/a&gt;</description><link>http://blog.robertgreyling.com/2010/05/building-intellisense-engine-for-spark.html</link><author>noreply@blogger.com (Robert Greyling)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-4970962262425771887</guid><pubDate>Fri, 12 Feb 2010 01:39:00 +0000</pubDate><atom:updated>2010-08-16T16:37:12.345+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">FubuMVC</category><category domain="http://www.blogger.com/atom/ns#">Spark</category><category domain="http://www.blogger.com/atom/ns#">Technical</category><title>Spark learns to master the Fubu View</title><description>I swear I’ll eventually run out of crazy titles that include the names “Spark” and “Fubu”, but until then you’ll just have to take what you can get :)&lt;br /&gt;
In my &lt;a href=&quot;http://blog.cozwecan.com/2010/02/spark-learns-to-speak-fubu.html&quot;&gt;last post&lt;/a&gt;, I talked about getting &lt;a href=&quot;http://www.fubumvc.com/&quot;&gt;FubuMVC&lt;/a&gt; up and running with Spark as the view engine of choice. That dealt with all the bootstrapping stuff and getting a basic “hello world” example off the ground.&lt;br /&gt;
This time we’re digging a little deeper by bringing to bear the powerful &lt;a href=&quot;http://sparkviewengine.com/documentation/master-layouts&quot;&gt;3-pass layout rendering system&lt;/a&gt; built into the &lt;a href=&quot;http://sparkviewengine.com/&quot;&gt;Spark View Engine&lt;/a&gt;. I’m also going to talk about using &lt;a href=&quot;http://sparkviewengine.com/documentation/organizingcontent&quot;&gt;Spark Partials&lt;/a&gt;, mainly showing that they will now work in conjunction with &lt;a href=&quot;http://www.fubumvc.com/&quot;&gt;FubuMVC&lt;/a&gt;. &lt;br /&gt;
&lt;h2&gt;The goal&lt;/h2&gt;As I said &lt;a href=&quot;http://blog.cozwecan.com/2010/02/spark-learns-to-speak-fubu.html&quot;&gt;last time&lt;/a&gt;, Spark is very opinionated, and if you &lt;a name=&#39;more&#39;&gt;&lt;/a&gt;work &lt;i&gt;with&lt;/i&gt; those in mind, you can pretty much get a lot of complex wiring-up for free. The Spark documentation talks about 4 ways (conventions) in which a master layout can be defined and automatically picked up in Ascending order of importance (&lt;i&gt;number 4 wins every time&lt;/i&gt;):&lt;br /&gt;
&lt;ol&gt;&lt;li&gt;Application.spark file in the Shared or Layouts folders&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;A [&lt;i&gt;ControllerName&lt;/i&gt;].spark in the Shared or Layouts folders (Pssst….the convention is to strip off “Controller”)&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Naming the Layout as an argument when returning the View – I’ve deliberately not added support for this method because I feel it’s a code smell. Disagree with me? Then just say so and tell me why, and I’ll think about it ;)&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;Naming the master layout in the .spark file using the &lt;i&gt;&amp;lt;use master=”MasterOfTheUniverse” /&amp;gt;&lt;/i&gt; syntax. &lt;/li&gt;
&lt;/ol&gt;The goal here for me was to ensure that people familiar with using Spark on &lt;a href=&quot;http://www.castleproject.org/monorail/index.html&quot;&gt;Castle MonoRail&lt;/a&gt; or &lt;a href=&quot;http://www.asp.net/mvc/&quot;&gt;ASP.NET MVC&lt;/a&gt; projects could pretty much hit the ground running when it came to working with their Views in terms of Master Layouts and Partial use.&lt;br /&gt;
FubuMVC has its own opinions on how partials and layouts are derived, but for now they are separate. I’m not quite up to speed yet on how it all works, but if there is a gap that Spark isn’t filling, then I’ll be making use of the Fubu way where it makes sense. For now though – if you’re coming from a Spark background, you should be able to use it very comfortably.&lt;br /&gt;
&lt;h2&gt;How do I use it?&lt;/h2&gt;Well, I’ve tried to make it as easy as possible. I’ve created a &lt;a href=&quot;http://github.com/RobertTheGrey/fubumvc-examples&quot;&gt;fork of my own&lt;/a&gt; from the main &lt;a href=&quot;http://github.com/DarthFubuMVC/fubumvc-examples&quot;&gt;FubuMVC-examples repository&lt;/a&gt; where you’ll be able to see all the code I’ll show below. One day I hope to have this integrated into the main branch, but for now you’ll have to get it from &lt;a href=&quot;http://github.com/RobertTheGrey/fubumvc-examples&quot;&gt;my fork&lt;/a&gt;.&lt;br /&gt;
I’ve taken the liberty of compiling the latest dlls from the Spark integration work on my fork and put them in the lib folder. After creating a standard ASP.NET Web Application, You can reference them along with all the Fubu bits like so:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDVcjKdRTCoiK-gKMxQn18xsP7jFMzE-K5A0kdCyw5iiunKL0ORk0kMclprObKT9y8YQFduwHxh3EXHT_tGA8XASiCrZLb8x0tteM55d_W4NED1F0oyAAJgP_Y7FxFPDYNCt7mynWA_l8/s1600-h/References%5B4%5D.png&quot;&gt;&lt;img alt=&quot;References&quot; border=&quot;0&quot; height=&quot;343&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6ae6WQuAssKIO_iuzJQATcjMqlo9WS4vp64PYPJz_Cf0jD8SY8to9k2V2pliAJLhn6V6aIeMx4Rx002W1X76aB7PYYsJIospOf467jLp-LCyqxwpxi4wm0N0GW-0XHnBuF8bVIpvCjeM/?imgmax=800&quot; style=&quot;border-width: 0px; display: inline;&quot; title=&quot;References&quot; width=&quot;288&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;h2&gt;Project setup&lt;/h2&gt;Here are files we’ll be working with for this example:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgyFnWzvMfRuYMPyJwJUg5lqKgCtkWJjU7p9SJLFf2KvRpeoV_RoT3ZX94w7GC-N7KZn_Zcqo2pAgO7kkLfiiKpLWtfG_DPcTUi8rKNsamvKEZkWZKEVX4t1YxNxa6hqwRl2LoXARHzmls/s1600-h/Files%5B4%5D.png&quot;&gt;&lt;img alt=&quot;Files&quot; border=&quot;0&quot; height=&quot;377&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjyGZZWKRFDLyR_BiBII7xgdS5LB8WA8J8At8JSU6b1e9HJOGieHD161Oh2_XcIoClns5SNG6ekGZgLApVLlXYHhTnwPwCQB4X8tYHy4SQg0yYQPMKos67r0cgpzdNnaPM2ziRsd-Cj_o0/?imgmax=800&quot; style=&quot;border-width: 0px; display: inline;&quot; title=&quot;Files&quot; width=&quot;288&quot; /&gt;&lt;/a&gt; &lt;br /&gt;
&lt;h2&gt;From the top&lt;/h2&gt;Once you’ve done a few of these, it really does start to get easier. Start with the Global.asax which is as empty as ever given that I’ve following my pre-built conventions discussed in the &lt;a href=&quot;http://blog.cozwecan.com/2010/02/spark-learns-to-speak-fubu.html&quot;&gt;last post&lt;/a&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: csharp; toolbar: false; auto-links: false;&quot;&gt;namespace MasterAndPartialViews
{ 
public class Global : SparkStructureMapApplication 
{ 
}
} 
&lt;/pre&gt;&lt;br /&gt;
Next I like to go straight for the controller. For this example I chose a simple question-answer app that I can build out more and more as I find more things to write about. For now though, it’s only demonstrating this particular topic. Two methods on the controller – easy:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: csharp; toolbar: false; auto-links: false;&quot;&gt;using MasterAndPartialViews.Models.Question;
namespace MasterAndPartialViews.Controllers
{
public class QuestionController
{
public QuestionListViewModel Ask()
{
return new QuestionListViewModel();
}
public AnswerViewModel Answer(QuestionInputModel model)
{
return new AnswerViewModel(model.Question);
}
}
}
&lt;/pre&gt;&lt;br /&gt;
The models I’ve used are also fairly simple, although at this point you could see them calling out to a Repository or Data Service somewhere: &lt;br /&gt;
&lt;pre class=&quot;brush: csharp; toolbar: false; auto-links: false;&quot;&gt;using System.Collections.Generic;
namespace MasterAndPartialViews.Models.Question
{
public class QuestionListViewModel
{
public List Questions = new List
{
&quot;What is the answer to life, the universe, and everything?&quot;,
&quot;What is the first decimal place of Pi?&quot;
};
}
}
&lt;/pre&gt;&lt;br /&gt;
&lt;pre class=&quot;brush: csharp; toolbar: false; auto-links: false;&quot;&gt;namespace MasterAndPartialViews.Models.Question
{
public class QuestionInputModel
{
public string Question { get; set; }
}
}
&lt;/pre&gt;&lt;br /&gt;
&lt;pre class=&quot;brush: csharp; toolbar: false; auto-links: false;&quot;&gt;namespace MasterAndPartialViews.Models.Question
{
public class AnswerViewModel
{
public AnswerViewModel(string question)
{
Answer = GetAnswer(question);
}

public string Answer { get; set; }

private string GetAnswer(string question)
{
switch (question)
{
case &quot;What is the answer to life, the universe, and everything?&quot;:
return &quot;42&quot;;
case &quot;What is the first decimal place of Pi?&quot;:
return &quot;1&quot;;
default:
return &quot;I used to know that one. Hmm, let&#39;s see...&quot;;
}
}
}
}
&lt;/pre&gt;At this stage, our code compiles, but we haven’t added any views. Let’s have a look at what the handy FubuMVC diagnostics are telling us so far – Hit F5:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgGaUhYWsya7ZJ1eBaJCCgwZ5RjI2Suj3Gmd32dr5zeuy51sYmj0RDLFbC9Mxqe_vQgqmwHMiSE1RfIth2ubtrqVHclUfD89R5AWnys9utduECKmZhgqfGNoDUP568X_sY_dyfQHMENdjU/s1600-h/No%20Views%5B18%5D.png&quot;&gt;&lt;img alt=&quot;No Views&quot; border=&quot;0&quot; height=&quot;415&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuZ9wjmwk0FoTxISyPI5TLjE-Ncj5d1vynDW2CnaBASbT2ydFLFGE4a4wOEiOASdFGzKZt2msmMKEI6enXJbgcpmTGctv7du9pe1euQNyBDjGf8zhuvnQGRLwBabJxrGhLzSP-Oh6_S5w/?imgmax=800&quot; style=&quot;border-width: 0px; display: inline;&quot; title=&quot;No Views&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
We create the two Spark files (Ask.spark and Answer.spark) as per the controller method names and place them inside a folder (see project layout above) decided by conventions already configured. The files can be blank, but as long as they’re there, they’ll be picked up by the conventions. Hit F5 on the browser this time:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkNgXQRPk4oizUZPyExT7FV-YsTAbqFBJIe7k9-GPT8xFviPKaawVmbeKFIl9unFlDrr27D1svGoHiSpPIGvpMV6rz622SmCE4nWf1sg2ZFeUzJ-I45WLpataY1A-BIK3GbwkR1CL1WfE/s1600-h/Views%20Bound%5B5%5D.png&quot;&gt;&lt;img alt=&quot;Views Bound&quot; border=&quot;0&quot; height=&quot;415&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsskGMWtDIOePCPQRrJ4XZvZF18eyDCmBV7ABef6Yrxrf8vI_DTpZ4VXpmJv5lxsC15TZnt_YkLpwA8jqSJnpOljPOQ1KeF_RdMVJION_hKFzS8jl1n5eGpbnKx6-p7VcsxtvTHU6Chqo/?imgmax=800&quot; style=&quot;border-width: 0px; display: inline;&quot; title=&quot;Views Bound&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
OK – now that we’ve established that FubuMVC has spotted our views and bound them to the correct Actions, we’re ready to start mucking about with the layouts and partials. First let’s take a look at the Ask.spark view:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;viewdata model=&quot;MasterAndPartialViews.Models.Question.QuestionListViewModel&quot; /&amp;gt;

&amp;lt;QuestionList questions=&quot;Model.Questions&quot; /&amp;gt;

&amp;lt;form action=&quot;Answer&quot; method=&quot;POST&quot;&amp;gt;
&amp;lt;div&amp;gt;Ask your question: 
&amp;lt;input id=&quot;SomeId&quot; type=&quot;text&quot; width=&quot;500&quot; name=&quot;Question&quot;/&amp;gt;
&amp;lt;input type=&quot;Submit&quot;/&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;/form&amp;gt;

&lt;/pre&gt;You’ll notice I’ve specified that it is a strongly typed view using the &amp;lt;viewdata&amp;gt; Spark convention. Now the view has access to dig into the ViewModel. &lt;br /&gt;
Next you’ll notice an Html tag called QuestionList. “What the HELL is that ?!?!” You may ask…Well that’s our partial, and that fact that we’ve used the Spark convention of naming the partial (see project files above) starting with an underscore means that we can refer to it as a native Html tag and the vIew engine will pick it up as part of the rendering pipeline. We can also “feed” it part or all of the ViewModel coming in to help it construct itself. Here is the _QuestionList.spark in the flesh:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;!-- expects a list of questions as an input from anything that uses this partial –&amp;gt;
&amp;lt;div&amp;gt;
Here is the list of questions you can ask:
&amp;lt;ul&amp;gt;
&amp;lt;li each=&quot;var question in questions&quot;&amp;gt;${question}&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
The Answer.spark view is just a simple display that has a strongly typed ViewModel of its own:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;viewdata model=&quot;MasterAndPartialViews.Models.Question.AnswerViewModel&quot; /&amp;gt;
&amp;lt;div&amp;gt;&amp;lt;h2&amp;gt;The answer is: ${Model.Answer}&amp;lt;/h2&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;div&amp;gt;&amp;lt;a href=&quot;/Question/Ask&quot;&amp;gt;Ask another...&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
There you have it – partials for a start. Trust me, you can go so much further with them, and I plan on putting a few more complex samples together to demonstrate everything from separation of concerns for your views up to doughnut caching techniques for the more extreme optimizers among us. We’ve only just begun!&lt;br /&gt;
&lt;h2&gt;Mastering the Layouts&lt;/h2&gt;Following the conventions at the top of this post, and looking at my project layout above, you’ll see I have two layouts defined: Application.spark, and Question.spark. Given the order of preference rules at the top, the layout that the whole site with use is Application.spark, except for views that are tied to the Question Controller – all of which will use the Question.spark layout instead as an override. The two layouts look like this:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;use content=&quot;head&quot; /&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div&amp;gt;&amp;lt;------- I&#39;m from the Application Layout Begin -------&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;use content=&quot;view&quot; /&amp;gt;
&amp;lt;div&amp;gt;&amp;lt;------- I&#39;m from the Application Layout End-------&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;use content=&quot;head&quot; /&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div&amp;gt;&amp;lt;------- I&#39;m from the Question Layout Begin -------&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;use content=&quot;view&quot; /&amp;gt;
&amp;lt;div&amp;gt;&amp;lt;------- I&#39;m from the Question Layout End-------&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
The output of the Ask view looks like this:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGWubUYesjXr5ixkma8YqRxoyoKO5kQp697EYUMiB-eey-bhMNOptOFHIsJws5qmRHqQiNRnFNA1kGPQy4IBSHRyWA-_CVT91iiJF6YK3i2te7Xg-dmmUrDBS87T2005ICeJMfwcRi7eY/s1600-h/QuestionLayout%5B4%5D.png&quot;&gt;&lt;img alt=&quot;QuestionLayout&quot; border=&quot;0&quot; height=&quot;232&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirXdV56EfWYx0LbMiN6pZpwbbbaxRr8c0lY70WJObE8Jdo88-ER5oDjfivUlsJdSE2ATuYocVNaOjDFzvL0efkdO-XTGxobJKszbeaxfJ_vS5G0ZUg0sYybG0S8zAFFs9DWROikUvyyKU/?imgmax=800&quot; style=&quot;border-width: 0px; display: inline;&quot; title=&quot;QuestionLayout&quot; width=&quot;430&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
You can then employ override rule number 4 to the layouts by changing the Question.spark layout like so:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;use master=&quot;Application&quot; /&amp;gt;

&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;use content=&quot;head&quot; /&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div&amp;gt;&amp;lt;------- I&#39;m from the Question Layout Begin -------&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;use content=&quot;view&quot; /&amp;gt;
&amp;lt;div&amp;gt;&amp;lt;------- I&#39;m from the Question Layout End-------&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
And then you have an output that contains one layout wrapped within another like so:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgNed14MhOFlPuS4zNETq-iMQCltG4QLHb01-3P_YlWGkssCzaIXb6-1Q16QGLGspg6OWxbECYo4LieLlqqvt5EXQYUueI9n-QQZqvuPjDAcB0hJzCxZ21J5M_B4FvWKwJW6hymiOQJWks/s1600-h/WrappedLayout%5B4%5D.png&quot;&gt;&lt;img alt=&quot;WrappedLayout&quot; border=&quot;0&quot; height=&quot;273&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqSj-vSpQ5qCMWLzdRckCJ6OmWBykSCfZbcMf04ZGXwE8dzE0Zr8lkXULxkAg2ydYFeqtTiuEbZIKShJb0h5Q4ztuOGIUqR4bk59kyVKiWBwsrpHnub8aL4liimfxQtC0GQyA8an4FKnQ/?imgmax=800&quot; style=&quot;border-width: 0px; display: inline;&quot; title=&quot;WrappedLayout&quot; width=&quot;426&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Of course it doesn’t make sense to have two &amp;lt;html&amp;gt; elements etc nested inside one another, but you get the idea – you can stack layouts inside one another as they make sense to build up a page like Lego(TM) blocks.  The possibilities are endless here and I really think this post is getting a bit long. If there are specific scenarios you’d like to tackle, but can’t figure out how, then I’d be keen to put an example like that out – so let me know. Either way, I hope you find this useful…&lt;br /&gt;
&lt;h2&gt;What’s next?&lt;/h2&gt;As you’ll see from my code samples above, I’m using POHF – Plain Old Html Forms. Whilst this is not necessarily a bad thing, many of you will be used to HtmlHelpers if you’ve come from ASP.NET MVC background or perhaps some other for of fluent html tag building or convention based mechanism. Well as it turns out, &lt;a href=&quot;http://codebetter.com/blogs/jeremy.miller&quot;&gt;Jeremy Miller&lt;/a&gt; been working on just &lt;a href=&quot;http://codebetter.com/blogs/jeremy.miller/archive/2010/01/29/shrink-your-views-with-fubumvc-html-conventions.aspx&quot;&gt;such a mechanism&lt;/a&gt; for FubuMVC – but alas, this only works with the standard Webforms View Engine code at the moment.  I see this as the area can possibly provide another piece of integration, and I’m probably gonna focus on that next. If you disagree, or have a particular show-stopper that’s preventing you from using the &lt;a href=&quot;http://sparkviewengine.com/&quot;&gt;Spark&lt;/a&gt; View Engine on FubuMVC, then by all means get my attention and I’ll see what I can do.  That goes for you too Jeremy, Chad, Josh, Mark et al :) Let me know where you think I should focus regarding this work…&lt;br /&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;I haven’t been able to test everything regarding partials and master layouts, but I’m hoping that with just a few people using it, they can discover if I’ve left anything out and shout for help. I’d be very keen to plug any holes if they’re found, but for the most part, I’ve been using it to put something together the way I have using ASP.NET MVC before and I’ve pretty much plugged all the holes for my personal use – now go find me some more! ;)&lt;br /&gt;
Until next time…  &lt;a href=&quot;http://www.twitter.com/RobertTheGrey&quot;&gt;Robert The Grey&lt;/a&gt;</description><link>http://blog.robertgreyling.com/2010/02/spark-learns-to-master-fubu-view.html</link><author>noreply@blogger.com (Robert Greyling)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6ae6WQuAssKIO_iuzJQATcjMqlo9WS4vp64PYPJz_Cf0jD8SY8to9k2V2pliAJLhn6V6aIeMx4Rx002W1X76aB7PYYsJIospOf467jLp-LCyqxwpxi4wm0N0GW-0XHnBuF8bVIpvCjeM/s72-c?imgmax=800" height="72" width="72"/><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-8424531435508568435</guid><pubDate>Tue, 02 Feb 2010 01:08:00 +0000</pubDate><atom:updated>2010-08-14T16:09:52.255+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">FubuMVC</category><category domain="http://www.blogger.com/atom/ns#">Spark</category><category domain="http://www.blogger.com/atom/ns#">Technical</category><title>Spark learns to speak Fubu</title><description>&lt;p&gt;About three weeks ago, I heard that the &lt;a href=&quot;http://fubumvc.com/&quot;&gt;FubuMVC framework&lt;/a&gt; was undergoing a &lt;a href=&quot;http://codebetter.com/blogs/jeremy.miller/archive/2009/12/15/an-update-on-the-fubumvc-reboot.aspx&quot;&gt;reboot of sorts&lt;/a&gt;, and the team are driving an effort primarily by means of a call for help – or a call to action if you will. FubuMVC natively supports the Web Forms model for page generation, but I’ve always wondered what it would be like to use &lt;a href=&quot;http://sparkviewengine.com/&quot;&gt;Spark&lt;/a&gt; as the View Engine of choice on FubuMVC, and so I figured that I may as well give it a go!&lt;/p&gt; &lt;h2&gt;Opinionated meets Opinionated&lt;/h2&gt; &lt;p&gt;As you may already know, FubuMVC favours a convention over configuration (to the extreme) approach to building your MVC application, and on the other side we have Spark which has its own ideas (opinions) about how views should be stored, discovered and created. Luckily for me, this was &lt;strong&gt;&lt;em&gt;not&lt;/em&gt;&lt;/strong&gt; a case of “the unstoppable force” meets “the immovable object” – quite the opposite in fact! Both frameworks present strong opinions, which are categorically &lt;em&gt;weakly held&lt;/em&gt; – which made my life much easier when integrating the two. I got to decide which parts of FubuMVC I thought were a better approach and vice versa. It doesn’t necessarily mean I’m right, but at least I got to choose.&lt;/p&gt; &lt;p&gt;&lt;br&gt;Needless to say, if you disagreed with my approach, you could also go ahead and replace the bits I’ve written as default integration points with your own strategies and conventions. But assuming you just want to see it working, here’s how you setup a basic Hello Spark Application:&lt;/p&gt; &lt;h2&gt;The Project&lt;/h2&gt; &lt;p&gt;Assuming you’re using Visual Studio and not something more hard-core (like notepad), fire up a bog standard new ASP.NET Web Application - no not an MVC application, and no, not an empty MVC application either – although you’re welcome to do that if you’re willing to fix your references. You may need to adjust references anyway, so it’s easier if I just show you that you end up with something roughly like this:&lt;/p&gt; &lt;p&gt;&lt;br&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdqTJ7YzHmjGQlPNulSNtlFx4zTl4R1vnPQumDG-vQ1l1Tj-O5Ui3ZcGx2Qp7up1VYx2tAXTleDY6QW5vsrY9CYE_miKdAnJziA0lxCZHUsZlf-6KeqzPfWkQ-6lZ1apBP2tFnMmXA8wo/s1600-h/References2.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;References&quot; border=&quot;0&quot; alt=&quot;References&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJdR_HXolCE9UvuMSLdH9pBIdLJo3KEpRmlxHbJ4cozjdNBmB3r641ZPGe1YYECyEJ_qBL3aj8Wlsy-EG8ExVttz2EkMgLkgqq1Uq6OBS7DdP5fm3db5Z2O40MBVxn242ls2VNTbhJHLI/?imgmax=800&quot; width=&quot;201&quot; height=&quot;244&quot;&gt;&lt;/a&gt; &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh38OWd6-ZcvA3eEcYdMlxDfIUapHKNMIjvxSLHcOOMSHzU4PyDlJd3DdVGS17GoUm3KTT-Diz4GV0S76m6q_EahcT90zLhb7mKcd_Xo4ynuS0tYFFh49Dz7qYZftThgF4s-HeJQdePQKQ/s1600-h/Project2.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;Project&quot; border=&quot;0&quot; alt=&quot;Project&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuUOjk8itSvDfUnj43nzm0jwdX4Ym9BXCYg2xIIIwStMb0MSp8DrZx2uIbMainFJ_tAfPqXZJIN1jTZklWyMcdKIAk3qa3zUJuA-GrqrKBaigmuCZgNnF2BWdsgdmnFKqgHGNCbzZMFIY/?imgmax=800&quot; width=&quot;181&quot; height=&quot;244&quot;&gt;&lt;/a&gt; &lt;/p&gt; &lt;h2&gt;Bootstrapping&lt;/h2&gt; &lt;p&gt;The default IoC Container for FubuMVC is &lt;a href=&quot;http://structuremap.sourceforge.net/Default.htm&quot;&gt;StructureMap&lt;/a&gt;, although I believe work is currently under way to swap out with one of your choice. Regardless, it stands to reason that you’d want to put some bootstrapping code in there. Wanna get a sneak peak at my Glabal.asax? Yup – that’s it – all wrapped up nice and snug…&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class=&quot;brush: csharp; toolbar: false; auto-links: false;&quot;&gt;namespace FubuMVC.HelloSpark  &lt;br&gt;{ &lt;br&gt;    public class Global : SparkStructureMapApplication &lt;br&gt;    { &lt;br&gt;    } &lt;br&gt;}
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;“What?” you may ask does that SparkStructureMapApplication contain then? Well, not much really – it inherits directly from HttpApplication and the important bits are as follows:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class=&quot;brush: csharp; toolbar: false; auto-links: false;&quot;&gt;public virtual FubuRegistry GetMyRegistry() &lt;br&gt;{ &lt;br&gt;    return new SparkDefaultStructureMapRegistry(EnableDiagnostics, &lt;br&gt;    ControllerAssembly, ViewFactory);   &lt;br&gt;} &lt;br&gt;protected void Application_Start(object sender, EventArgs e) &lt;br&gt;{ &lt;br&gt;    RouteCollection routeCollection = RouteTable.Routes; &lt;br&gt;    SparkStructureMapBootstrapper.Bootstrap(routeCollection, GetMyRegistry());   &lt;br&gt;}
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Most of it is standard stuff. The ControllerAssembly helps tell us where to look for actions and views and the ViewFactory finds and describes them. The bootstrapping comes next, and I’ve provided a default SparkStructureMapBootstrapper that you can use as long as you like the same conventions as I do:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class=&quot;brush: csharp; toolbar: false; auto-links: false;&quot;&gt;public class SparkStructureMapBootstrapper&lt;br&gt;{&lt;br&gt;    private readonly RouteCollection _routes;&lt;br&gt;&lt;br&gt;    private SparkStructureMapBootstrapper(RouteCollection routes)&lt;br&gt;    {&lt;br&gt;        _routes = routes;&lt;br&gt;    }&lt;br&gt;&lt;br&gt;    public static void Bootstrap(RouteCollection routes, FubuRegistry fubuRegistry)&lt;br&gt;    {&lt;br&gt;        new SparkStructureMapBootstrapper(routes).BootstrapStructureMap(fubuRegistry);&lt;br&gt;    }&lt;br&gt;    &lt;br&gt;    private void BootstrapStructureMap(FubuRegistry fubuRegistry)&lt;br&gt;    {&lt;br&gt;        UrlContext.Reset();&lt;br&gt;        ObjectFactory.Initialize(x =&amp;gt;&lt;br&gt;        {&lt;br&gt;            x.For&amp;lt;ISparkSettings&amp;gt;().Use&amp;lt;SparkSettings&amp;gt;();&lt;br&gt;            x.For(typeof(ISparkViewRenderer&amp;lt;&amp;gt;))&lt;br&gt;                .Use(typeof(SparkViewRenderer&amp;lt;&amp;gt;));&lt;br&gt;        });&lt;br&gt;        var bootstrapper = &lt;br&gt;            new StructureMapBootstrapper(ObjectFactory.Container, fubuRegistry);&lt;br&gt;        bootstrapper.Bootstrap(_routes);&lt;br&gt;    }&lt;br&gt;} 
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The important points to note here are the usage of the default FubuRegistry and StructureMapBootstrapper which do most of the heavy lifting in terms of building the object graph across the application. You can still wire up your own classes here though as I’ve done with SparkSettings and SparkViewRenderer.&lt;/p&gt;
&lt;h2&gt;Create some views and controllers&lt;/h2&gt;
&lt;p&gt;For this simple application, I’m not going to go into too much detail regarding view and controller creation. Suffice it to say that you can &lt;a href=&quot;http://github.com/RobertTheGrey/fubumvc&quot;&gt;view and download the code yourself right here&lt;/a&gt;. To get this going, you can see the files I created for this small web app in the folder structure above. We have Application.spark which is our primary Master page:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;html&amp;gt; &lt;br&gt;  &amp;lt;head&amp;gt;   &lt;br&gt;    &amp;lt;title&amp;gt;&amp;lt;use content=&quot;title&quot;&amp;gt;Default Title&amp;lt;/use&amp;gt;&amp;lt;/title&amp;gt; &lt;br&gt;  &amp;lt;/head&amp;gt; &lt;br&gt;  &amp;lt;body&amp;gt; &lt;br&gt;    &amp;lt;div id=&quot;header&quot;&amp;gt; &lt;br&gt;      &amp;lt;use content=&quot;header&quot;&amp;gt; &lt;br&gt;        &amp;lt;div&amp;gt;no header by default&amp;lt;/div&amp;gt; &lt;br&gt;      &amp;lt;/use&amp;gt; &lt;br&gt;    &amp;lt;/div&amp;gt; &lt;br&gt;    &amp;lt;div id=&quot;main&quot;&amp;gt; &lt;br&gt;      &amp;lt;use content=&quot;view&quot;/&amp;gt; &lt;br&gt;    &amp;lt;/div&amp;gt; &lt;br&gt;    &amp;lt;div id=&quot;footer&quot;&amp;gt; &lt;br&gt;      &amp;lt;use content=&quot;footer&quot;&amp;gt; &lt;br&gt;        &amp;lt;div&amp;gt;no footer by default&amp;lt;/div&amp;gt; &lt;br&gt;      &amp;lt;/use&amp;gt; &lt;br&gt;    &amp;lt;/div&amp;gt; &lt;br&gt;  &amp;lt;/body&amp;gt; &lt;br&gt;&amp;lt;/html&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I’ve followed my preferred method of organising Views and Controllers. With FubuMVC, there’s nothing stopping you from putting them any which way you like because the entire assembly is scanned regardless and a mapping of routes, views and actions are built by associations that you get to establish in code – or you can just use the defaults :)&lt;br&gt;&lt;br&gt;First you add a Controller like so:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class=&quot;brush: csharp; toolbar: false; auto-links: false;&quot;&gt;public class FireController &lt;br&gt;{ &lt;br&gt;    public FireViewModel Create(FireInputModel model) &lt;br&gt;    { &lt;br&gt;        return model.GotALight() &lt;br&gt;                   ? new FireViewModel {Text = &quot;Light &#39;em up!&quot;} &lt;br&gt;                   : new FireViewModel {Text = &quot;Light &#39;em up anyway!&quot;}; &lt;br&gt;    }  &lt;br&gt;} &lt;br&gt;public class FireInputModel &lt;br&gt;{  &lt;br&gt;    public bool GotALight() &lt;br&gt;    { &lt;br&gt;        return true; &lt;br&gt;    }  &lt;br&gt;} &lt;br&gt;public class FireViewModel &lt;br&gt;{   &lt;br&gt;    public string Text { get; set; }   &lt;br&gt;}
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Next, you implement a view (Create.spark) to go with the “Create” controller method like so:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class=&quot;brush: xml; toolbar: false; auto-links: false;&quot;&gt;&amp;lt;viewdata model=&quot;FubuMVC.HelloSpark.Controllers.FireViewModel&quot; /&amp;gt; &lt;br&gt;&amp;lt;content:title&amp;gt;Let the Sparks fly!&amp;lt;/content:title&amp;gt; &lt;br&gt;&amp;lt;content:header&amp;gt;What do we wanna do?&amp;lt;/content:header&amp;gt; &lt;br&gt;&amp;lt;h1&amp;gt;${Model.Text}&amp;lt;/h1&amp;gt; &lt;br&gt;&amp;lt;content:footer&amp;gt;That&#39;s right baby!&amp;lt;/content:footer&amp;gt;
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And then you hit F5 like so:&lt;/p&gt;
&lt;p&gt;&lt;br&gt;&lt;br&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjYeSdYiBEL0KKuoXONZi64R7p-_MbQEdT1IIpi4oGZLrHF_fe-bJPWuBEtDNB1cMuDU2stGg2QCDsNIh5EkS9mMKsavsGClNraDmHP-wTmOFB8LDyQMqF5ez-FUvmBofzRDklYv3l6t8/s1600-h/Browse%5B4%5D.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;Browse&quot; border=&quot;0&quot; alt=&quot;Browse&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKSJSNTAgx44wZQEZRqUmlcM0uBBhHj7-hF4E64-vK6visr-M7V22jqQ0LDt62Rz5ZbTYme7aqWk8IAVgYqLcNnQG6howlWN3vZ1xjr4xm3uWvdUuYvp1CtqykvluHFrOcA-_FOooLxWw/?imgmax=800&quot; width=&quot;461&quot; height=&quot;317&quot;&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Behind the scenes&lt;/h2&gt;
&lt;p&gt;I’ve created the integration work which contains all the glue between the &lt;a href=&quot;http://sparkviewengine.com/&quot;&gt;Spark View Engine&lt;/a&gt; and the FubuMVC pipeline in a separate assembly for the moment, the &lt;a href=&quot;http://github.com/RobertTheGrey/fubumvc/tree/master/src/Spark.Web.FubuMVC/&quot;&gt;source code for which&lt;/a&gt; you only really have to go in if you’re curious, but you don’t need to if you just want to start building with Spark. It’s not yet integrated into the main &lt;a href=&quot;http://github.com/DarthFubuMVC/fubumvc&quot;&gt;Github branch&lt;/a&gt;, but I hope that after some scrutiny and more additions that I make, that we can find a more permanent home for it.&lt;/p&gt;
&lt;h2&gt;What next?&lt;/h2&gt;
&lt;p&gt;My next port of call is to get master pages and areas properly supported. I haven’t yet delved into how areas and slices work in the FubuMVC code, and so I was reluctant to do any work in this area until I at least got the basic page lifecycle done. Spark also has it’s own implementation of partials as well as caching and so I’m going to have to explore those parts a bit more before I decide who’s opinion is stronger. I haven’t started on it yet, so if you want to give me your two pennies, I’d be happy to take notice.&lt;/p&gt;
&lt;h2&gt;Cudos&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://codebetter.com/blogs/jeremy.miller/&quot;&gt;Jeremy&lt;/a&gt;, &lt;a href=&quot;http://chadmyers.lostechies.com/&quot;&gt;Chad&lt;/a&gt;, &lt;a href=&quot;http://joshuaflanagan.lostechies.com/&quot;&gt;Joshua&lt;/a&gt; and the rest of the gang have done a great job on the framework so far! There are more extensibility points and configurable bits than there are spikes on a blow fish – a veritable candy shop of choice – and yet just going with the defaults will get you going in no time at all. I hope this post, and the examples to come will help you learn more about these fantastic frameworks – and do let me know if there is something specific you’d like covered here… I’m always looking for ideas.&lt;/p&gt;
&lt;p&gt;Till next time, &lt;br&gt;&lt;a href=&quot;http://twitter.com/RobertTheGrey&quot; target=&quot;_blank&quot;&gt;Robert The Grey&lt;/a&gt;&lt;/p&gt;  </description><link>http://blog.robertgreyling.com/2010/02/spark-learns-to-speak-fubu.html</link><author>noreply@blogger.com (Robert Greyling)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJdR_HXolCE9UvuMSLdH9pBIdLJo3KEpRmlxHbJ4cozjdNBmB3r641ZPGe1YYECyEJ_qBL3aj8Wlsy-EG8ExVttz2EkMgLkgqq1Uq6OBS7DdP5fm3db5Z2O40MBVxn242ls2VNTbhJHLI/s72-c?imgmax=800" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-3743232967507988725</guid><pubDate>Sun, 06 Dec 2009 16:43:00 +0000</pubDate><atom:updated>2010-04-29T20:54:43.444+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Technical</category><category domain="http://www.blogger.com/atom/ns#">Windows Azure</category><title>Windows Azure Functional bits and tooling comparison</title><description>&lt;p&gt;This is post is part of an &lt;a href=&quot;http://blog.cozwecan.com/2009/12/windows-azure-clearly-inferior-cloud.html&quot;&gt;ongoing series&lt;/a&gt; I am writing about Microsoft’s new &lt;a href=&quot;www.azure.com/&quot;&gt;Windows Azure&lt;/a&gt; platform. Feel free to read that first for an introduction to this.&lt;/p&gt;  &lt;h2&gt;Scalability and Reliability&lt;/h2&gt;  &lt;p&gt;Each of the vendors provide various services in their offerings, many of them common. The first thing they’ll tell you is that they provide the means of infinitely scaling your application and ensuring high availability. These points are not worth debating because I’m fairly certain that they can all live up to that promise, and I’m even more certain that at some point in time, they will all break that promise – and some &lt;a href=&quot;http://www.theregister.co.uk/2009/07/02/google_app_engine_fail/&quot;&gt;have already&lt;/a&gt; had &lt;a href=&quot;http://www.techcrunch.com/2008/02/15/amazon-web-services-goes-down-takes-many-startup-sites-with-it/&quot;&gt;the opportunity&lt;/a&gt; to do so.&lt;/p&gt;  &lt;p&gt;What we really need to dig into here is: assuming that high availability and scalability have been removed from the equation as problems areas – how else does the cloud make your life easier than regular hosting? That’s the real question here, as well as how it pertains to Windows Azure versus the other providers.&lt;/p&gt;  &lt;p&gt;When it comes to comparing &lt;a href=&quot;www.azure.com/&quot;&gt;Windows Azure&lt;/a&gt; and the competition, there are quite a few areas I’ve delved into. What’s the one thing every developer dreads when they start a new project? Well…actually &lt;em&gt;deploying&lt;/em&gt; the project of course! If they manage to get that far, most projects would already have put plenty of thought and planning in to architecture, resilience, performance and so on…right? Right?! &lt;/p&gt;  &lt;p&gt;Well at least you hope they have – but one thing that generally always gets left as an afterthought is deployment – mainly because it is often mistakenly diagnosed as “the easy part”. Yeah – about as easy as grilling your rib-eye with a box of matches – you &lt;em&gt;could do it&lt;/em&gt;, but not without a seriously good plan, and even then it’s gonna go wrong more often than it’s gonna work out. And you better be prepared to eat a rare steak!&lt;/p&gt;  &lt;h2&gt;Deployment – the hard way&lt;/h2&gt;  &lt;p&gt;Of the competition I’ve evaluated, &lt;a href=&quot;http://aws.amazon.com&quot;&gt;Amazon Web Services&lt;/a&gt; and &lt;a href=&quot;http://www.gogrid.com/&quot;&gt;GoGrid&lt;/a&gt; are like the irresponsible parents in the group. They basically hand you the keys to the Ferrari without making sure you’ve passed the driving test first. As with everything else, this can be both a good and a bad thing. If the kids are self-disciplined and responsible then the parents are just seen as ultra-liberal and have no need to worry. If not, well then they can expect to be putting in a hefty insurance claim pretty soon.&lt;/p&gt;  &lt;p&gt;When it comes to having full control of your own VM (or many), they’re basically trusting you to know exactly what you’re doing when it comes to all aspects of the machine – from networking, security, patching, stability and installation – and that’s all before you’ve even managed to get your application on there – not to mention upgrades.&lt;/p&gt;  &lt;p&gt;Now that’s fine if you really get enjoyment from that fine grained level of control. Some developers get a kick out of putting their network admin hat on sometimes – hell yes, I &lt;em&gt;freakin’ love &lt;/em&gt;doing that stuff! They also give you the ability to set your machine up the way you want, and then persist that as a custom image from which you can boot up multiple instances as and when you need them – &lt;em&gt;sweet&lt;/em&gt;!&lt;/p&gt;  &lt;p&gt;I really loved doing that and the power and flexibility it gave me was seriously awesome…for about 6 weeks, at which point I had downgraded it to “pretty cool”, and a short time after that, to “Seriously?! Again?! This is becoming a royal pain where the sun don’t shine”. I had all the power and flexibility in the world at my fingertips, but still couldn’t derive a click-once deploy scenario that spun up a new instance perfectly.&lt;/p&gt;  &lt;p&gt;I can honestly say that if you want to go this route, make sure you have a network admin at the ready who loves this kind of stuff, because in the end – if you’re serious about cloud deployment, you’re gonna need someone full time on this kind of task. It absorbs more time on the project than a dry sponge in the desert - at noon!&lt;/p&gt;  &lt;h2&gt;Deployment – The Easy Way&lt;/h2&gt;  &lt;p&gt;And now we come to the other side of the coin. Both &lt;a href=&quot;http://googleappengine.blogspot.com&quot;&gt;Google App Engine&lt;/a&gt; and &lt;a href=&quot;www.azure.com/&quot;&gt;Windows Azure&lt;/a&gt; are able to provide intelligent deployment mechanisms because of the tight control they &lt;strike&gt;lord&lt;/strike&gt; keep over the environment. This again can be a good and a bad thing because these parents want to sit in the back seat while you go on your hot date. As long as you can live within the controlled experience they provide, and are willing to make some sacrifices in that department, they promise to take all the heavy lifting on for you, and leave you free to focus on the one thing that really matters here – &lt;em&gt;&lt;font color=&quot;#ff8080&quot;&gt;your application&lt;/font&gt;&lt;/em&gt;!&lt;/p&gt;  &lt;p&gt;Both &lt;a href=&quot;www.azure.com/&quot;&gt;Windows Azure&lt;/a&gt; and &lt;a href=&quot;http://googleappengine.blogspot.com&quot;&gt;Google App Engine&lt;/a&gt; provide a classic “staging and production” deployment scenario. You can upload your changes and test them separately from the live running instances, and once you’re happy, you can just swap out the instance you want “live”, and roll back instantaneously again of course if everything goes hay-wire.&lt;/p&gt;  &lt;p&gt;This provides a pretty comfortable experience during a time when stress levels have traditionally been pretty high in corporate environments. Nobody wants to damage their brand, so this kind of thing is a bare minimum really. &lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;www.azure.com/&quot;&gt;Windows Azure&lt;/a&gt; takes the science of deployment another step forward to allow for a lot more flexibility and have basically found a way for you to ensure there is zero downtime between upgrades – barring of course you doing something stupid ;-). Microsoft announced a new feature called &lt;a href=&quot;http://www.kefalidis.me/archive/2009/11/28/patterns-windows-azure-ndash-rolling-upgrades.aspx&quot;&gt;Rolling or In-place Upgrades&lt;/a&gt; at &lt;a href=&quot;http://microsoftpdc.com/Sessions/SVC08&quot;&gt;PDC2009&lt;/a&gt; which allow you to more effectively control the life cycle management of your application by making use of &lt;a href=&quot;http://www.kefalidis.me/archive/2009/11/27/windows-azure-ndash-what-is-an-upgrade-domain.aspx&quot;&gt;upgrade domains&lt;/a&gt; to isolate instances.&lt;/p&gt;  &lt;p&gt;This really does allow for the hardcore among us to come up with some pretty creative and safe ways of deploying changes that affect portions of large systems – many of which I’m sure we’ll see in the cloud some day.&lt;/p&gt;  &lt;h2&gt;Storage&lt;/h2&gt;  &lt;p&gt;All of the providers provide some kind of blob storage, and most provide the equivalent of table and queue services and storage. GoGrid is the only one lacking in the latter, but make up for it in the former by giving you 10GB free blob storage straight away.&lt;/p&gt;  &lt;p&gt;Amazon give you 1GB of storage and 1Gb in bandwidth free per month, Microsoft aren’t charging yet, so it’s &lt;a href=&quot;http://blog.cozwecan.com/2009/12/windows-azure-pricing-its-always-all.html&quot;&gt;tough to tell&lt;/a&gt;, and Google have similar free quotas for new starters. You can expect these to fluctuate dramatically over the next few cycles as they jostle for position. Either way, it’s good for the consumer.&lt;/p&gt;  &lt;p&gt;One really neat thing that Amazon have provided is a Transact-SQL-like interface on top of their &lt;a href=&quot;http://aws.amazon.com/simpledb/&quot;&gt;SimpleDB&lt;/a&gt;&amp;#160; service and Google have done something similar with &lt;a href=&quot;http://code.google.com/appengine/docs/python/datastore/gqlqueryclass.html&quot;&gt;GQL&lt;/a&gt; which really makes things a lot easier for those trying to transition from a relational world. Microsoft have gone the whole hog and put the real thing – &lt;a href=&quot;http://www.microsoft.com/windowsazure/sqlazure/&quot;&gt;SQL Azure&lt;/a&gt; – in the cloud for those who just can’t do without.&lt;/p&gt;  &lt;p&gt;Overall I’d say it’s a pretty even race at the moment between the big three and it’ll take some pretty big innovations to distinguish themselves as the leader – but who are we kidding – it’s probably going to come down to price, isn’t it?&lt;/p&gt;  &lt;h2&gt;The Developer Experience&lt;/h2&gt;  &lt;p&gt;Again I’ll start with the VM providers. &lt;a href=&quot;http://www.gogrid.com/&quot;&gt;GoGrid&lt;/a&gt; don’t really go out of their way to encourage developers to get onto their platform, but Amazon seem to be pulling out all the stops lately to try and achieve this. They’ve recently come out of the stone age and announced a new revamped &lt;a href=&quot;http://aws.amazon.com/sdkfornet/&quot;&gt;SDK for .Net&lt;/a&gt; for connecting to and using their web services. It’s jam packed with great samples and at least they did it for VS2008 this time.&lt;/p&gt;  &lt;p&gt;That, I’m afraid is where all help stops from them. After that you’re on your own. There is no such thing as a local or disconnected development environment or sandbox where you can test or develop your code. Everything needs to be against the cloud environment. I know the general consensus these days is that you’re “always connected” anyway, but I’m sure they’d be surprised to find out how often that’s &lt;em&gt;&lt;strong&gt;not &lt;/strong&gt;&lt;/em&gt;the case.&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://googleappengine.blogspot.com&quot;&gt;Google App Engine&lt;/a&gt; and &lt;a href=&quot;www.azure.com/&quot;&gt;Windows Azure&lt;/a&gt; however, have done incredibly well by taking the full development life cycle into account! Both provide a disconnected means by which you can develop and test your application locally over pretty much all the available services.&lt;/p&gt;  &lt;p&gt;This, to me, is the way it should be if you want developers to pick your platform and run with it. The minute there are barriers to entry, developers will probably try and find the path of least resistance. Price can be, just such a barrier to entry as well and so it’ll be interesting to see how the pricing fluctuates over the next year or so.&lt;/p&gt;  &lt;h2&gt;Diagnostics and Performance profiling&lt;/h2&gt;  &lt;p&gt;&lt;a href=&quot;www.azure.com/&quot;&gt;Windows Azure&lt;/a&gt; hasn’t even launched yet, but already I feel they are are &lt;a href=&quot;http://microsoftpdc.com/Sessions/SVC15&quot;&gt;leading the pack by a massive amount&lt;/a&gt; in this department. &lt;a href=&quot;http://googleappengine.blogspot.com&quot;&gt;Google App Engine&lt;/a&gt; is a distant second with their online dashboard which gives paltry stats that are more relevant to them rather than the health of your application. Amazon, as expected, can only provide services from the outside such as &lt;a href=&quot;http://aws.amazon.com/cloudwatch/&quot;&gt;CloudWatch&lt;/a&gt; which can help you automatically scale your instances up. That’s great, but can it tell you &lt;em&gt;&lt;font color=&quot;#ff8080&quot;&gt;why&lt;/font&gt; &lt;/em&gt;you were forced to do so?&lt;/p&gt;  &lt;p&gt;It’s fine if you nailed a slam dunk in some viral marketing campaign, and you got more virtual feet than Time Square on New Year’s Eve, but what if that’s not it – what if there is some kind of runaway memory leak in your application – sorry, you’re on your own…again – and we can’t really blame them, they did give us the keys to the Ferrari after all…&lt;/p&gt;  &lt;p&gt;Microsoft have pulled out all the stops on this one – there is a seriously good and friction-free developer experience that comes with &lt;a href=&quot;http://microsoftpdc.com/Sessions/SVC15&quot;&gt;logging, tracing and diagnostic collection&lt;/a&gt; and the API they’ve provided is incredible! This thing enables all sorts of cloud and desktop driven scenarios for diagnosis, scaling, throttling, you name it, and I think there are partners queuing up left, right and centre to deliver something in this space.&lt;/p&gt;  &lt;h2&gt;Conclusion&lt;/h2&gt;  &lt;p&gt;This post is getting a little long, but if there are any specific areas you’d like me to cover in more detail, or things I may have failed to mention – drop me a comment and I’ll get right on it!&lt;/p&gt;  &lt;p&gt;Taking a view across all areas, for now, from the perspective of what I want and need for &lt;a href=&quot;http://cozwecan.com/&quot;&gt;cozwecan.com&lt;/a&gt;, it’s looking more and more like &lt;a href=&quot;www.azure.com/&quot;&gt;Windows Azure&lt;/a&gt; is going to provide everything we need…everything &lt;a href=&quot;http://blog.cozwecan.com/2009/12/windows-azure-pricing-its-always-all.html&quot;&gt;except cost effective pricing&lt;/a&gt; unfortunately.&lt;/p&gt;  &lt;p&gt;I know it’s a tired subject, but in the end, it doesn’t really matter how good your cloud is – when there are cheaper and proven business viable alternatives with Big names out there – you can bet your Ferrari you’ll be losing plenty of business to them…&lt;/p&gt;  &lt;p&gt;Until next time,   &lt;br /&gt;Rob G&lt;/p&gt;  </description><link>http://blog.robertgreyling.com/2009/12/windows-azure-functional-bits-and.html</link><author>noreply@blogger.com (Robert Greyling)</author><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-130345912027920377</guid><pubDate>Sat, 05 Dec 2009 20:04:00 +0000</pubDate><atom:updated>2010-04-29T20:54:43.435+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Technical</category><category domain="http://www.blogger.com/atom/ns#">Windows Azure</category><title>Windows Azure Pricing – it’s always all about the money</title><description>&lt;p&gt;This is post is part of an &lt;a href=&quot;http://blog.cozwecan.com/2009/12/windows-azure-clearly-inferior-cloud.html&quot;&gt;ongoing series&lt;/a&gt; I am writing about Microsoft’s new &lt;a href=&quot;www.azure.com/&quot;&gt;Windows Azure&lt;/a&gt; platform. Feel free to read that first for an introduction to this.&lt;/p&gt;  &lt;h2&gt;Storage&lt;/h2&gt;  &lt;p&gt;Let’s cut to the chase, everyone wants to know how much data they can store &lt;em&gt;up there&lt;/em&gt; and for how much. Hosted solutions are woefully inadequate in this department. They treat their hard drives like bars of gold instead of the cheap storage units they’ve become. ISPs just can’t (or won’t) compete with the cloud providers in this area. Don’t believe me? Just try asking for a price on 6 terabytes of space on their SAN. That’s why rackspace now do both &lt;a href=&quot;http://www.rackspace.com/managed_hosting/index.php&quot;&gt;managed hosting&lt;/a&gt; and &lt;a href=&quot;http://www.rackspacecloud.com/&quot;&gt;cloud hosting&lt;/a&gt;. They knew they couldn’t compete just using the old model.&lt;/p&gt;  &lt;p&gt;I’m not going to list pricing of each provider since that kind of detail changes too often as they seek to compete, suffice it to say that they’re all pretty much in the same ball park at the moment, which means you’re not going to choose on that basis. &lt;a href=&quot;http://www.gogrid.com/&quot;&gt;GoGrid&lt;/a&gt; however, have again raised the stakes by offering the first 10GB of cloud storage for free! Google gives you a measly 500MB, but that’s still better than &lt;a href=&quot;http://aws.amazon.com/s3/&quot;&gt;Amazon S3&lt;/a&gt; who start charging immediately, and unfortunately, it seems Microsoft are following suit by charging from the gates.&lt;/p&gt;  &lt;p&gt;I’m really surprised Microsoft has not decided to blow the competition out of the water – they are by far the biggest of the bunch, and they have the perfect opportunity to undercut prices and provide generous starting quotas given they have come to market a fair bit later. But they haven’t so far, which basically means they can only compete on features - let’s &lt;a href=&quot;http://blog.cozwecan.com/2009/12/windows-azure-functional-bits-and.html&quot;&gt;see where that leaves them&lt;/a&gt;…&lt;/p&gt;  &lt;p&gt;In fairness though, they haven’t started charging &lt;em&gt;&lt;strong&gt;at all yet&lt;/strong&gt;&lt;/em&gt;, but there’s currently no indication of whether or not you’re going to get discounts to help you get started – and that being the case, I’m afraid it is keeping a lot of potential customers at arms length.&lt;/p&gt;  &lt;h2&gt;Bandwidth&lt;/h2&gt;  &lt;p&gt;Every single little byte that travels to and from your cloud solution is going to cost money (or quota). Many traditional hosts will give you free incoming bandwidth which in my view is a substantial saving! So far, it seems that &lt;a href=&quot;http://www.gogrid.com/&quot;&gt;GoGrid&lt;/a&gt; are the only ones who have adopted this for their cloud offering as well. It does &lt;strike&gt;piss me off&lt;/strike&gt; bug me somewhat that I have to pay money just to get my application and supporting data up to the cloud. Isn’t it enough that I’m agreeing to go into business with them in the first place?! I’m almost tempted to host with &lt;a href=&quot;http://www.gogrid.com/&quot;&gt;GoGrid&lt;/a&gt; on principle for that reason alone. &lt;/p&gt;  &lt;p&gt;I think it’s a stupid stealth tax which you wouldn’t normally incur with traditional hosting, and I feel that cloud providers could use this as a competitive advantage. Other than that, the providers are pretty much on a par with their pricing.&lt;/p&gt;  &lt;p&gt;Outgoing bandwidth – fair enough, traffic is traffic and you can’t expect to get that for free if you plan on running a business, and all the parties are once again, on par with one another. Disappointing really…&lt;/p&gt;  &lt;h2&gt;Compute&lt;/h2&gt;  &lt;p&gt;This is where the real hidden (or hard to pin down) costs lie when it comes to cloud hosting. Google really do have right idea here. They charge per CPU core hour which translates to the actual time taken during the processing of a request! Simple and unambiguous – this will literally scale with your business and does not charge you for “idle” time.&lt;/p&gt;  &lt;p&gt;Unfortunately &lt;em&gt;all of the others&lt;/em&gt; charge you per hour to&lt;em&gt; have the machine up and running&lt;/em&gt; – even when there is no traffic. Just a green light on the box – you’re paying for that! Now when it comes to &lt;a href=&quot;http://aws.amazon.com/ec2/&quot;&gt;Amazon EC2&lt;/a&gt; and &lt;a href=&quot;http://www.gogrid.com/&quot;&gt;GoGrid&lt;/a&gt;, this is understandable because their model is basically to provide you with a virtual machine instance which it seems they have no other choice but to charge you for.&lt;/p&gt;  &lt;p&gt;Most surprisingly, Microsoft seem to have gone for this model as well, but since their application deployment model is much more akin to Google’s, they’re basically shooting themselves in the proverbial foot. Not only will they be directly compared with Google App Engine, but they will also be an order of magnitude more expensive for the same apples when it boils down to cold hard numbers.&lt;/p&gt;  &lt;p&gt;If you’re thinking in terms Azure’s “Web Role” or “Worker Role” instances, they’re basically classifying each one of those as its own VM – which means you pay the cost of that particular VM being up and running. Compare that directly with an Amazon VM, it’s basically a windows machine (for example) that you can run IIS on, and put 10 websites up if that’s what you want to do. Clearly neither are redundant until you run two &lt;em&gt;instances&lt;/em&gt; but you get the picture – Amazon is going to work out cheaper by miles in this scenario.&lt;/p&gt;  &lt;p&gt;This for me, makes &lt;a href=&quot;www.azure.com/&quot;&gt;Windows Azure&lt;/a&gt; a complete non-starter I’m afraid. The fact that you pay for the privilege of spinning up a web application on IIS in the cloud is ridiculous! Luckily they haven’t gone commercially live yet and are still &lt;a href=&quot;http://www.mygreatwindowsazureidea.com/pages/34192-windows-azure-feature-voting&quot;&gt;taking feedback&lt;/a&gt;. Guess what the &lt;a href=&quot;http://www.mygreatwindowsazureidea.com/pages/34192-windows-azure-feature-voting/suggestions/392901-make-it-less-expensive-to-run-my-very-small-service-on-windows-azure-?ref=title&quot;&gt;&lt;strong&gt;number one feedback item&lt;/strong&gt;&lt;/a&gt; is – yes this ridiculous method of charging. For their sake, I really do hope they sort this out before commercial availability, otherwise, &lt;em&gt;commercial viability&lt;/em&gt; is going to be the question on everybody&#39;s lips.&lt;/p&gt;  &lt;h2&gt;Content Delivery Networks&lt;/h2&gt;  &lt;p&gt;CDN functionality is available from all of these providers and it’s a bit of a premium service. Unnecessary it seems, until you really start noticing your application take off on a global scale, and serving your content &lt;strike&gt;fast&lt;/strike&gt; close to the speed of light becomes a requirement, not just a feature!&lt;/p&gt;  &lt;p&gt;Easy to configure, but you better be prepared for your cloud application to start costing a fair bit more money per month! Either way, it’s something that start-ups are probably not going to leverage right at the beginning, but it’s nice to know they’re available if you need them.&lt;/p&gt;  &lt;h2&gt;Azure-Spark!&lt;/h2&gt;  &lt;p&gt;If you didn’t already know about Microsoft’s fantastic initiatives for getting start-ups going, have a look at their &lt;a href=&quot;http://www.microsoft.com/web/websitespark/default.aspx&quot;&gt;WebsiteSpark&lt;/a&gt; and &lt;a href=&quot;http://www.microsoft.com/BizSpark/&quot;&gt;BizSpark&lt;/a&gt; programmes. These basically provide free software and services (everything a growing business needs) at a cost of $100 – which is only payable at the end of three years. By that time, you &lt;em&gt;should&lt;/em&gt; have a fairly good idea of whether or not your start-up is going anywhere. There are a few qualifying criteria, so take a look if they’ll work for you.&lt;/p&gt;  &lt;p&gt;What I’d &lt;em&gt;&lt;font color=&quot;#ff8080&quot;&gt;very much&lt;/font&gt;&lt;/em&gt; like to see is the launch of something similar for &lt;a href=&quot;www.azure.com/&quot;&gt;Windows Azure&lt;/a&gt;. Let’s call it “AzureSpark” for instance, and this could provide (similarly to the BizSpark programme) free or significantly discounted &lt;a href=&quot;www.azure.com/&quot;&gt;Windows Azure&lt;/a&gt; bits for 3 years which could definitely see a start-up get going in the cloud.&lt;/p&gt;  &lt;p&gt;This would create significant buy-in to the &lt;a href=&quot;www.azure.com/&quot;&gt;Windows Azure&lt;/a&gt; platform on the start-up’s behalf who would not want to take everything down after 3 years to change providers if it was working well. This could be a truly symbiotic relationship, and if anyone can afford to take this bold step, it’s Microsoft. This move alone would cement my choice of cloud provider as well as many other start-ups out there I’m sure. Not to mention all the talk it would create in the cloud-space, but this certainly could be a curve ball that other cloud providers probably couldn’t counteract with ease.&lt;/p&gt;  &lt;h2&gt;What about the little guy?&lt;/h2&gt;  &lt;p&gt;Clearly this wouldn’t work so well for the hobbyist programmer out there who just wants a cost effective long term solution, so lets not forget about them Microsoft – m’kay?&lt;/p&gt;  &lt;p&gt;Right now &lt;a href=&quot;http://googleappengine.blogspot.com&quot;&gt;Google App Engine&lt;/a&gt; will be getting all of these guys because of the “no risk and no cost” up front option – and it’s &lt;em&gt;&lt;font color=&quot;#ff8080&quot;&gt;these people&lt;/font&gt;&lt;/em&gt; that will be hauled into the boardroom meetings in their day jobs being asked to recommend a provider they trust and have tried out. You’ll be surprised what word of mouth coming from well-connected developers can bring your way – just sayin’…&lt;/p&gt;  &lt;h2&gt;Conclusion&lt;/h2&gt;  &lt;p&gt;For me at the moment, it’s all still up in the air. I have high hopes for this platform when it comes to pricing, but at the moment, the competition are already well established, ahead on numbers and support AND looking like they’re gonna be cheaper to boot!&lt;/p&gt;  &lt;p&gt;The ball is in your court Microsoft… should I bother picking up my racquet?&lt;/p&gt;  &lt;p&gt;Here’s hoping…    &lt;br /&gt;Rob G&lt;/p&gt;  </description><link>http://blog.robertgreyling.com/2009/12/windows-azure-pricing-its-always-all.html</link><author>noreply@blogger.com (Robert Greyling)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-6888065510022161578</guid><pubDate>Sat, 05 Dec 2009 20:02:00 +0000</pubDate><atom:updated>2010-04-29T20:54:43.426+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Technical</category><category domain="http://www.blogger.com/atom/ns#">Windows Azure</category><title>Windows Azure - clearly the inferior cloud platform…right?</title><description>&lt;h2&gt;Says who?&lt;/h2&gt;  &lt;p&gt;This is the feedback I’m getting time and time again when chatting to technical types about the various cloud offerings. But is it though? Really? Most people I’ve spoken to haven’t been able to articulate exactly why they say that. Upon digging a little deeper into their reasoning, two major themes have come up every time:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href=&quot;www.azure.com/&quot;&gt;Windows Azure&lt;/a&gt; is late to the party and are too far behind the competition &lt;/li&gt;    &lt;li&gt;and it’s Microsoft - duh! &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Well I hope I can be forgiven for not basing my business upon those two weak opinions. They firstly lack any substance or reasoning, but they also lack depth in evidence. This is the main problem – most people &lt;em&gt;just don’t know&lt;/em&gt; if it’s gonna work or not. And so they default to one of these two positions – or both!&lt;/p&gt;  &lt;p&gt;If you have other reasoning, then I’d be interested in hearing it, but due to the lack of evidence out there, I felt this was necessary, even if it is just for me to&amp;#160; work through my reasoning with clarity – and hey, while I’m about it, I may was well put it out there…&lt;/p&gt;  &lt;p&gt;A while ago, I decided I couldn’t dismiss it out of hand, but back in the early CTP days, it wasn’t really possible to compare apples with apples. Leading up to and since the PDC2009, things have taken a big enough step I think where comparisons can now start being made. Below is the result of my investigation so far.&lt;/p&gt;  &lt;h2&gt;The competition&lt;/h2&gt;  &lt;p&gt;Firstly, I can only really speak about competition that I’ve actually tried out. There are more of them out there, but I don’t feel comfortable talking about things second hand. And so, the ones I have personally evaluated are:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href=&quot;http://googleappengine.blogspot.com&quot;&gt;Google App Engine&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://aws.amazon.com&quot;&gt;Amazon Web Services&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;and &lt;a href=&quot;http://www.gogrid.com/&quot;&gt;GoGrid&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Given the fact that the website I’m building is based on the &lt;a href=&quot;http://www.asp.net/mvc/&quot;&gt;ASP.NET MVC&lt;/a&gt; framework, it’s pretty much a given that Google’s offering cannot help me in it’s current form. I’ve kept it in here for the simple fact that I think they’ve gotten plenty of things right and it therefore still bears comparison, which I’ll mention from time to time.&lt;/p&gt;  &lt;h2&gt;First – a brief comparison to traditional hosting&lt;/h2&gt;  &lt;p&gt;Only one of the cloud providers can compete with regular shared hosting from a pricing perspective I’ve found – and that’s Google with their generous free quota, but it is of course never going to support a thriving business, but it will support a fairly static one. I’m not entirely sure that the cloud providers are after the kinds of folks who would use shared hosting effectively. I think it is unlikely that they will grab much of the micro-website market – people who just want a home page for their restaurant that shows the menu and a phone number, and maybe a map for directions. So far Google can do it, but none of the others are competing in this space.&lt;/p&gt;  &lt;p&gt;In addition, if you are just planning on putting up a “home page”, you won’t be making the best usage of the resources available to you. The cloud was built for scalability and processing power in mind, easy global deployments via CDNs with all the gadgetry behind that to support running a business online. If you don’t need that, then shared hosting is probably your best bet.&lt;/p&gt;  &lt;p&gt;There is a slice of the market however, that feel rather cramped, and would love to grow out of the shared hosting scene – but for those people – many of them young start-ups – having a dedicated server with an ISP is prohibitively expensive, and even worse, it’s nowhere near resilient, and completely riddled with single points of failure.&lt;/p&gt;  &lt;p&gt;That’s when they start down the arduous path of redundant database servers, then a web tier with load balancing, and before they know it, they have their own private little web farm and are probably going out of business in the next six months because of the massive overheads.&lt;/p&gt;  &lt;p&gt;This is the perfect moment for a cloud hosting salesman to step up to the plate. Giving you multiple machines, at the drop of a hat, with fully redundant data solutions and scalability of the gods – this is what they were born to do…at least that’s what they tell us.&lt;/p&gt;  &lt;h2&gt;The Cloud Comparison&lt;/h2&gt;  &lt;p&gt;This post is already getting a little long, and there’s a fair bit to come. If your mind is starting to wonder off, then by all means stop right here, but if you’re still interested at this point and would like to read about the comparisons I’ve made to date, then feel free to click on your topic of interest which I’ve separated into a series below:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href=&quot;http://blog.cozwecan.com/2009/12/windows-azure-pricing-its-always-all.html&quot;&gt;Pricing – it’s always all about the money&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://blog.cozwecan.com/2009/12/windows-azure-functional-bits-and.html&quot;&gt;Functional bits and tooling&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I’ll try to update these to keep them fairly current, but inevitably things change over time and I can’t keep up with all of it – I encourage you to do your own investigations and if I’ve gotten something wrong, or it has changed drastically, then let me know in the comments and I’ll be sure to update it.&lt;/p&gt;  &lt;p&gt;For now, take care…    &lt;br /&gt;Rob G&lt;/p&gt;  </description><link>http://blog.robertgreyling.com/2009/12/windows-azure-clearly-inferior-cloud.html</link><author>noreply@blogger.com (Robert Greyling)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-7330475002864454102</guid><pubDate>Tue, 03 Nov 2009 00:54:00 +0000</pubDate><atom:updated>2010-04-29T20:54:43.464+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Spark</category><category domain="http://www.blogger.com/atom/ns#">Technical</category><title>Teaching JavaScript how to render your views using Spark</title><description>&lt;p&gt;&lt;font color=&quot;#ff8080&quot;&gt;This post applies to Spark View Engine version 1.0.3 and up (to my knowledge)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;This is a little known, and (currently) just about “undocumented” feature that I feel deserves more kudos purely because of the sheer breadth of its possible applications. I first read about it on &lt;a href=&quot;http://odetocode.com/blogs/scott/archive/2009/03/12/client-rendering-views-with-spark-and-asp-net-mvc.aspx&quot;&gt;K. Scott Allen’s blog&lt;/a&gt;, but even after reading that I didn’t quite realise how significant this would end up being, and more importantly, how difficult this is to achieve using the Web Forms View Engine. I also experienced a few difficulties in wrapping my head around, and using the technique. My first attempt was a dismal failure for two reasons:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Firstly, I didn’t even get what it (the technique) was supposed to be doing – it just looked cool &lt;/li&gt;    &lt;li&gt;Even when I thought I knew what it was doing, I was way off in my understanding, I thought it was meant to do “x” when it was actually doing “y” &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;About now, you’re probably feeling somewhat like I did at the time: A little lost, but that this could be an important nugget waiting around the corner. As such, I’ll try my best to explain this by remembering what it felt like to be in my shoes before I &lt;em&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Grok&quot;&gt;grokked&lt;/a&gt; &lt;/em&gt;it, and even now I’m not entirely sure that I do. Here goes:&lt;/p&gt;  &lt;h2&gt;Same old same old…&lt;/h2&gt;  &lt;p&gt;OK – to describe this clearly, I think I’m gonna have&amp;#160; to drop in about a thousand words here first:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid1SvToahisx138HhazlnDkK9EY5sG9O4muAn1dZ9_r7HoBN8cilA2DXby2DivI-CrGoa8JvrahuTJPBXQEUArCut1kvAsfC6tgl-GT9itFFzz2wlR8FsPOa3aFCa0HqIslKj14UM2Pb0/s1600-h/image10.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnqLIsrV0q2jp_DtVWMlDxF82i9NUu3KWE8ZgmFCSa2BF7KadESjd0MhYC3wj3NGjHlMKhF4XUTxeB8otzLddG5MJn_A-G0wzEVZHIjqOKJWMLbW6DP-qEX2JEISqpNyTquXWzqVfAKSs/?imgmax=800&quot; width=&quot;689&quot; height=&quot;413&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Let’s say you’re trying to build the view above. This is actually a mock-up of our photographer list (modelled similarly to the very simplistic &lt;a href=&quot;http://www.stackoverflow.com/users&quot;&gt;user list I really like on StackOverflow.com&lt;/a&gt;). On the face of it, this seems fairly simple to build as long as you’ve got a decent grasp on HTML and CSS, and of course already have the graphics. But yes, that’s only on the face of it. Let’s take it a bit further by saying that you have a &lt;em&gt;very&lt;/em&gt; long list of photographers and don’t want any post backs in order to page through them. In that case you’ll want to lazy load them as the user pages through them right? Or what about collapsing 4 columns down to 1 when a photographer is clicked with the resulting space taken up by the photographer’s details? Chew on that one for a while…&lt;/p&gt;  &lt;p&gt;OK – easy so far, we’ve got some HTML, CSS, Graphics and a little bit of jQuery to handle the AJAX lazy loading and innerHtml replacement bits. Can you see the gaping hole yet? If you can – then &lt;em&gt;pretend &lt;/em&gt;you can’t, so we can dig a little deeper…&lt;/p&gt;  &lt;p&gt;Ask yourself : “What exactly is that AJAX response going to look like?”. Well, first guess is that it will return the &lt;em&gt;exact required &lt;/em&gt;Html that makes up the “next page” of photographers in the list. If you think about it, that particular Html will contain two things:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Structure - all the divs and stuff that make it look pretty. (if you think that’s pretty of course) &lt;/li&gt;    &lt;li&gt;and Data - the actual names and details of the photographers – most of mine above are of Latin decent ;-) &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Secondly, even if you use &lt;a href=&quot;http://www.nikhilk.net/Ajax-MVC.aspx&quot;&gt;RenderPartial&lt;/a&gt; and &lt;a href=&quot;http://stackoverflow.com/questions/750543/mvc-using-ajax-to-render-partial-view&quot;&gt;do it over AJAX&lt;/a&gt;, you’re still rendering the same “Structure” out multiple times, and only the “Data” is changing. Let’s call a spade a spade here – that’s just plain inefficient!&lt;/p&gt;  &lt;h2&gt;Injecting “the ability to render” Views client-side&lt;/h2&gt;  &lt;p&gt;What if we could get all the divs and pretty stuff down to the client only once (at page load), and just send requests for data (say via JSON) back to the server and completely short circuit the rendering cycle. Well you can – easily – with Spark!&lt;/p&gt;  &lt;p&gt;Spark has a built in mechanism for taking any partial view that you have code for on the server side, and that you may use in various places, and without changing a thing, it can percolate that &lt;em&gt;rendering capability &lt;/em&gt;as a JavaScript call that can be called at any point on the client side. Time for some code that shows 1, 2, 3 *magic* me thinks:&lt;/p&gt;  &lt;p&gt;1. Make use of an awesome &lt;a href=&quot;http://sparkviewengine.com/&quot;&gt;Spark View Engine&lt;/a&gt; asset – the JavascriptViewResult inside the PhotographerController:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRhnqtaC6UOgztIwmGxlcuCpyzIQKagaXWtjaRuZD0_DFs7hz-91zz324ggPR3i15CL6-YoLx1IEF9yPTA0n6n9G8fbw-usMqWM5eZMoWOav34W0ZjYuxANe1AZZcOz4PV3gmLr98VSYc/s1600-h/image19.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic98aJd6VrYpQepzW2Rh-NP36jBEfGeCLrOCpFBGHxvxrkl3dMV8xCOoL51kR1j9EAF4l6YQ3LLr9bAc0YUuRqef5jSSHEtmM8aspqYc4k4RVviMmZjra3si5eYrQTn-viP6OQhY6pRjM/?imgmax=800&quot; width=&quot;485&quot; height=&quot;107&quot; /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;2. In the same Controller, make sure you add a method that will return the appropriate data to you, like so:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2Bo1mQQZcvtoLGVVSCs-hufNESwiHR_DC6Z6IhpR0IGGL9rIbwe-lx2OBraFMvPW_9M-fq2gvdqzv9xw-nfXa5vBkfEU_-NQVAW7aBQHcDXjB7H-TCW6_igtOvovFB9xRfQvo34u230A/s1600-h/image24.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiBptJoQcgJqoTeZg7aRfUMzxHrcn8Vi4R-ikL2xPd7Sd0GUDNW_T4CNFb4mQiqN-wH6-ROk5FnTIhMReJ402Pn_VmrzfwNP_tWo6Heqka25CJwQXfp8X3xYTwDjB2BoZXCvW23VAW3slU/?imgmax=800&quot; width=&quot;488&quot; height=&quot;134&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;3. If you’re new to Spark, then just add this next bit to your master page in the head section, otherwise best practice is to add it to a &lt;a href=&quot;http://sparkviewengine.com/documentation/organizingcontent#Namedcontentsections&quot;&gt;Spark Section called “head”&lt;/a&gt; in the Spark View which gets rendered during the Spark life-cycle:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhnKayFmQ1j7KltmrPQqdnHDcopOe6wEp-KGPZ_32vrmO-wJQA28J3wIC-AxjM4L7kDe6PUtkerQZ8mAWDgWkVOdC0GTMnlsRONrZbr-9Wuk4VByvX0GifC5m4gr0fH7sl7OYoECXlmgJk/s1600-h/image33.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFSRjNIL_KrdiimIU44HInUbqB1_3ZX4DRANelNokkZC1gUVoISqnuOIDVZfSUnEE49VvqXAQyXOprB3-QSm7ntRFAFPv-LR_I4tKOodm94Tx5K_zGEfv3BV-l42A52oXQrzBMc1c21CE/?imgmax=800&quot; width=&quot;510&quot; height=&quot;60&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;See what we’re doing there? We’re adding our View from the Controller as Script – Spark takes care of the rest…&lt;/p&gt;  &lt;p&gt;4.And finally – I use &lt;a href=&quot;http://jQuery.com&quot;&gt;jQuery&lt;/a&gt; to make a JSON server call:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhq5xGXyvdvAmZFQfAOR_p5BPnek9tmx-ZcZ4CcnprhwXCWT6TPfudofskywNkrHPunnZ6CTeT8N3T_keTmudfGwiZrUEvfG_NWc2Vr1WvM3J7uLx6Cnc7yPCBJ7C6diT8CikNWTgmFpM4/s1600-h/image37.png&quot;&gt;&lt;img style=&quot;border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px&quot; title=&quot;image&quot; border=&quot;0&quot; alt=&quot;image&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPIzfqkJKyF9pXTTvyq0q1NQS5MUk08kd7G1xOAsNVGDb7nCletmulp9gDI16Q3rLaS1lIaSrY3Y9w72BvD7M0d3QaLBebyuyQlUnmb49Jn9CXkVH1Cn9AVAjMV1drNW9xbNDWvg7rqeI/?imgmax=800&quot; width=&quot;480&quot; height=&quot;117&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I’m not sure it needs much more explaining because it’s just so simple (and yes I didn’t get it at first because I was neck deep in web forms paradigms and couldn’t pull my head out!), but I’ve highlighted the points of interest in the code. This last one in particular – that &lt;em&gt;Spark.Photographer._ListPage.RenderView&lt;/em&gt; call is actually a JavaScript function that got rendered down to the page because of the script tag used in (3) above. That means that I only need to call the server for data (which comes down in incredibly efficient JSON), and the user can happily page through until the end without that view needing to be rendered again.&lt;/p&gt;  &lt;h2&gt;Taking it another step further&lt;/h2&gt;  &lt;p&gt;At the beginning I mentioned loading the photographer detail this way too. Think about it, if I collapse the columns from 4 down to 1, and fill up the remaining space with photographer detail, the column that’s left can be clicked on to load another photographer, and the next hyperlink could be used to either scroll through the photographers one by one, or to scroll one column at a time – it’s up to you! All that would require is one more View (the detail view) created as per the example above, rendering capability sent down to the client, and from then on, only data calls going backwards and forwards. Did I hear someone say…”Gmail-esque” ?&lt;/p&gt;  &lt;p&gt;The key here is that there are no postbacks and it feels very responsive because the data calls are tiny, and the power of the desktop is being put to good use, and we’re even applying the DRY principle to our server calls ;-)&lt;/p&gt;  &lt;h2&gt;Warning and Closing Thoughts&lt;/h2&gt;  &lt;p&gt;As is the case with everything, overuse can too quickly lead to problems. If I were you, I wouldn’t turn this into your new hammer and go on a nail hunting expedition. Used wisely, I have found this technique to be very helpful in scenarios where lots of different data is coming back, but is continuously using the same views. Page transitions are a breeze for related data (e.g. All about photographers) and play very nicely with tools like &lt;a href=&quot;http://jQuery.com&quot;&gt;jQuery&lt;/a&gt;. But I still use postbacks to move between Controllers say, it’s kind of a boundary I’ve set myself. You don’t have to, you could build your entire app using calls like these, but I tried that for a day once, and I’m still a little cross-eyed as a result.&lt;/p&gt;  &lt;p&gt;Remember, keep things simple, and make use of all the tools in your belt at the right times, and you’ll be able to keep a tidy ship when it comes to your code. This is a particularly shiny tool that I like to use, but don’t use it too often, lest it lose its shine too quickly…&lt;/p&gt;  &lt;p&gt;All the best,    &lt;br /&gt;Rob G&lt;/p&gt;  </description><link>http://blog.robertgreyling.com/2009/11/teaching-javascript-how-to-render-your.html</link><author>noreply@blogger.com (Robert Greyling)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnqLIsrV0q2jp_DtVWMlDxF82i9NUu3KWE8ZgmFCSa2BF7KadESjd0MhYC3wj3NGjHlMKhF4XUTxeB8otzLddG5MJn_A-G0wzEVZHIjqOKJWMLbW6DP-qEX2JEISqpNyTquXWzqVfAKSs/s72-c?imgmax=800" height="72" width="72"/><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-7446376599880388063</guid><pubDate>Tue, 03 Nov 2009 00:51:00 +0000</pubDate><atom:updated>2010-05-08T13:19:33.227+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">FAQ</category><category domain="http://www.blogger.com/atom/ns#">Spark</category><category domain="http://www.blogger.com/atom/ns#">Technical</category><title>Adventures in the land of Spark</title><description>&lt;p&gt;Welcome to what I hope will be an informative list of &lt;a href=&quot;http://sparkviewengine.com/&quot;&gt;Spark View Engine&lt;/a&gt; “How To’s” and hopefully show a little bit about how it has helped me whilst building &lt;a href=&quot;http://cozwecan.com/&quot;&gt;cozwecan.com&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;I’ll prefix each post with the version that it applies to in order to make it easier for you to decide the applicability for your scenario. If there are drastic changes between versions, then I may consider writing a new post on it, but small changes (if I happen to use them) may just come in the form of updates to existing posts.&lt;/p&gt; &lt;p&gt;In my &lt;a href=&quot;http://blog.cozwecan.com/2009/09/cozwecancom-lights-up-with-spark-under.html&quot;&gt;previous post&lt;/a&gt;, I spoke about Spark and the ASP.Net Web Forms View Engine and contrasted the two. In this series I’ll also try and describe the way in which you would attempt to achieve the same goals using both engines, hopefully clarifying why it is that Spark is my View Engine of choice.&lt;/p&gt; &lt;p&gt;I do feel however that I need to put a specific disclaimer in here at this point: I am by no means a expert on the Spark View Engine, if you’re looking that – his name is &lt;a href=&quot;http://whereslou.com/&quot;&gt;Lou&lt;/a&gt;! I can’t even really say that I’m an expert on the ASP.Net MVC Web Forms engine, but I have been &lt;strike&gt;fighting&lt;/strike&gt; using it since the early previews. I figure there’s a gap in the market here for somebody to “do it better” and I believe &lt;a href=&quot;http://sparkviewengine.com/&quot;&gt;Spark&lt;/a&gt; is the one I’ve been waiting for.&lt;/p&gt; &lt;p&gt;One thing holds true, and will always hold true concerning these posts: I am first and foremost a creature of least resistance – yes that’s right, I &lt;em&gt;am&lt;/em&gt; it. I used to seek that path, but having developed a severe dislike for anything that puts up a barrier, I’ve pretty much found over the years that I’ve been on it more often than not, and I’ve developed a certain knack for spotting things that will hurt more than a root canal, and separating them from things that are as simple as falling off a log.&lt;/p&gt; &lt;p&gt;I enjoy seeking out the simple ways in which to achieve a complex goal. Tools form a very large part of this, and the posts in this series best illustrate how Spark has made my life simple when building web applications. I hope you enjoy them:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;&lt;a href=&quot;http://blog.cozwecan.com/2009/09/cozwecancom-lights-up-with-spark-under.html&quot;&gt;cozwecan.com Lights Up with a Spark under the hood&lt;/a&gt;  &lt;li&gt;&lt;a href=&quot;http://blog.cozwecan.com/2009/11/teaching-javascript-how-to-render-your.html&quot;&gt;Teaching JavaScript how to render your views&lt;/a&gt;  &lt;li&gt;&lt;a href=&quot;http://blog.robertgreyling.com/2010/02/spark-learns-to-speak-fubu.html&quot;&gt;Spark learns to speak Fubu&lt;/a&gt; &lt;li&gt;&lt;a href=&quot;http://blog.robertgreyling.com/2010/02/spark-learns-to-master-fubu-view.html&quot;&gt;Spark learns to master the Fubu View&lt;/a&gt; &lt;li&gt;&lt;a href=&quot;http://blog.robertgreyling.com/2010/05/building-intellisense-engine-for-spark.html&quot;&gt;Building an IntelliSense Engine for Spark in Visual Studio 2010&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;All the best &lt;br&gt;&lt;a href=&quot;http://twitter.com/RobertTheGrey&quot; target=&quot;_blank&quot;&gt;Robert The Grey&lt;/a&gt;&lt;/p&gt;  </description><link>http://blog.robertgreyling.com/2009/11/adventures-in-land-of-spark.html</link><author>noreply@blogger.com (Robert Greyling)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-7023497807109781050</guid><pubDate>Sun, 27 Sep 2009 21:06:00 +0000</pubDate><atom:updated>2010-04-29T20:54:43.506+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Spark</category><category domain="http://www.blogger.com/atom/ns#">Technical</category><title>cozwecan.com Lights Up with a Spark under the hood</title><description>&lt;p&gt;Greetings all!&lt;/p&gt;  &lt;p&gt;It’s been a while I know, and there are a couple of reasons for that. I’ve been in the process of relocating my little family from London to Swansea in Wales which has knocked most of September’s plans out the window and I’ve had to steal little bits of time on trains, here and there to work on &lt;a href=&quot;http://cozwecan.com/&quot;&gt;cozwecan.com&lt;/a&gt;. But enough about all that…&lt;/p&gt;  &lt;p&gt;As you may have seen from my &lt;a href=&quot;http://blog.cozwecan.com/2009/06/cozwecan-technology-stack.html&quot;&gt;previous post&lt;/a&gt;, I’m using &lt;a href=&quot;http://www.asp.net/mvc/&quot;&gt;ASP.Net MVC&lt;/a&gt; on the front end. As I’ve been working along, the specifics of implementing the various views have (as you’d expect) been getting more and more &lt;em&gt;complex &lt;/em&gt;as I add more functionality. This I don’t mind. It’s when it gets &lt;em&gt;complicated &lt;/em&gt;that I start to worry. I don’t think I could put it more succinctly than &lt;a href=&quot;http://codebetter.com/blogs/dru.sellers/archive/2009/09/25/complex-vs-complicated.aspx&quot;&gt;Dru Sellers did&lt;/a&gt;:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;It is ok if something is complex so long as it is not complicated.&lt;/p&gt;    &lt;p&gt;complex: composed of many interconnected parts; compound; composite&lt;/p&gt;    &lt;p&gt;complicated: difficult to analyze or understand&lt;/p&gt; &lt;/blockquote&gt;  &lt;h2&gt;The Latest Hurdle&lt;/h2&gt;  &lt;p&gt;There are many things that can cause complication on a project, the one I want to highlight now is that of the View Engine that comes built into the ASP.Net MVC 1.0 release. One could have seen this coming when one of the most popular things that made it into the &lt;a href=&quot;http://mvccontrib.org/&quot;&gt;MvcContrib&lt;/a&gt; project was the concept of &lt;a href=&quot;http://jeffreypalermo.com/blog/mvccontrib-latest-release-now-with-subcontroller-support/&quot;&gt;SubControllers&lt;/a&gt;. One of the primary reasons for this was so that controllers could be “stacked” in order to return cross-cutting concerns to a single View, but keeping the logic separated. But the out-of-the-box experienced kinda expects you to throw all of those cross-cutting concerns into one controller. The need for this was apparent to some and &lt;a href=&quot;http://haacked.com/archive/2008/11/04/areas-in-aspnetmvc.aspx&quot;&gt;not unknown to the ASP.Net MVC team&lt;/a&gt;, but they just didn’t have it on their radar as a v1.0 goal. I’m not one to complain though, it’s &lt;em&gt;still &lt;/em&gt;my platform of choice, and for good reason – the extensibility points are absolutely superb! If you don’t like a particular piece, swap it out with something you prefer – it’s the very thing that makes &lt;a href=&quot;http://mvccontrib.org/&quot;&gt;MvcContrib&lt;/a&gt; viable! But I digress…&lt;/p&gt;  &lt;h2&gt;On with the…umm…well…’View’&lt;/h2&gt;  &lt;p&gt;Microsoft have this big problem see – they’re not trying to &lt;em&gt;make&lt;/em&gt; everyone happy, they’re trying to &lt;em&gt;keep&lt;/em&gt; everyone (read: existing customers) happy, and so they’ve chosen (OK – been forced somewhat) to stick to this strong paradigm they’ve &amp;lt;%enclosed%&amp;gt; themselves in for the last few years. In short, the View Engine that comes built into ASP.Net MVC is…well…how to put this delicately…it just doesn’t cut the mustard when it comes to separating concerns on large, functionally rich websites. Others have said far worse!&lt;/p&gt;  &lt;p&gt;The problems with the View Engine are not immediately apparent. This is because it’s a lot like erecting scaffolding up the side of an old building. The walls look straight and you think erecting it shouldn’t be &lt;em&gt;too&lt;/em&gt; difficult, and so you begin one piece at a time. The problems don’t show themselves when you build your first view output, or the second. They start creeping in surreptitiously, and when next you look back, you realise your scaffolding is leaning outwards because the building actually leans out over the street! Let’s be clear, there’s nothing wrong with the building, it’s been standing like that for years! Your scaffolding is what needs to be adaptable to the circumstances when something is not “normal”.&lt;/p&gt;  &lt;p&gt;You know that if you go much higher, the scaffolding is just going to get top heavy and come crashing down, and instead of undoing the hard work you’ve already done and moving it a few feet back from the ground up, you bolt it into the wall so that it can’t fall backwards, and you can go higher. When you eventually get to the top, you’re left with a tightly coupled mess that cannot be adjusted one way or the other because it has become completely dependent on the building for stability, and the building on it for maintenance. This relationship can only end in tears…&lt;/p&gt;  &lt;h2&gt;Where to from here?&lt;/h2&gt;  &lt;p&gt;To be clear, from the beginning I have always wanted &lt;a href=&quot;http://cozwecan.com/&quot;&gt;cozwecan.com&lt;/a&gt; to be success story for ASP.Net MVC in a very direct manner. I wanted to be able to say that MVC gave you everything you needed, without having to fish around for bits and pieces to finish the work. That probably means I have tried for a little too long to cut the corners off this square peg called a View Engine. I have always been open to ideas though and looked at various alternatives to try and help along the way. I’ve tried to go extreme in the convention-over-configuration approach by using &lt;a href=&quot;http://fubumvc.pbworks.com/&quot;&gt;FubuMVC&lt;/a&gt;. And I’ve also looked at just replacing the View Engine with something like &lt;a href=&quot;http://andrewpeters.net/2007/12/19/introducing-nhaml-an-aspnet-mvc-view-engine/&quot;&gt;NHAML&lt;/a&gt; or &lt;a href=&quot;http://www.chadmyers.com/blog/archive/2007/11/28/testing-scottgu-alternate-view-engines-with-asp.net-mvc-nvelocity.aspx&quot;&gt;NVelocity&lt;/a&gt; for example, but I still found too many friction points that meant staying with the standard framework wasn’t any worse – something always eventually got in the way, or I had to jump through hoops-a-plenty, and those would eventually catch on fire…and I’m pretty sure there were &lt;a href=&quot;http://www.hanselman.com/blog/ILikeCakeCakemailNinjasOnFireAndOtherAnecdotes.aspx&quot;&gt;ninjas in there&lt;/a&gt; sometimes too. &lt;/p&gt;  &lt;p&gt;I really needed to find something that could offer &lt;a href=&quot;http://whereslou.com/2009/07/28/spark-output-caching&quot;&gt;real solutions&lt;/a&gt;, not &lt;a href=&quot;http://haacked.com/archive/2008/11/04/areas-in-aspnetmvc.aspx&quot;&gt;tiresome workarounds&lt;/a&gt; to things like partial or donut caching, and elegant means of creating reusable parts that I could pepper around the site. Something that didn’t make the HTML look like it just threw up on itself, &lt;a href=&quot;http://www.codinghorror.com/blog/archives/001155.html&quot;&gt;leading to tag soup&lt;/a&gt; and maintenance nightmares. Something that was more simple, but gave me more control and was still quick to work with. Something that could just be good at being a View Engine and stay the hell out of my way at other times!&lt;/p&gt;  &lt;p&gt;Not asking for much eh?!&lt;/p&gt;  &lt;h2&gt;Queue the angelic chorus!&lt;/h2&gt;  &lt;p&gt;It was when &lt;a href=&quot;http://codebetter.com/blogs/karlseguin/default.aspx&quot;&gt;Karl Seguin&lt;/a&gt; announced that &lt;a href=&quot;http://codebetter.com/blogs/karlseguin/archive/2009/09/01/canvas-gets-a-spark.aspx&quot;&gt;CodeBetter Canvas had been altered to use Spark&lt;/a&gt;, my ears immediately pricked up! “There’s no way that this could be just another view engine!” I said, and that was when I committed to taking a deep and meaningful look at the &lt;a href=&quot;http://sparkviewengine.com/&quot;&gt;Spark View Engine&lt;/a&gt; developed by &lt;a href=&quot;http://whereslou.com/&quot;&gt;Louis DeJardin&lt;/a&gt;. Yes, I had previously heard of it and had seen it back when it was part of the &lt;a href=&quot;http://mvccontrib.org/&quot;&gt;MvcContrib&lt;/a&gt; project early on, but I must be honest, I didn’t think it was going to bring anything more to the party than &lt;a href=&quot;http://www.chadmyers.com/blog/archive/2007/11/28/testing-scottgu-alternate-view-engines-with-asp.net-mvc-nvelocity.aspx&quot;&gt;NVelocity&lt;/a&gt; did. Turns out that &lt;a href=&quot;http://www.chadmyers.com/blog/archive/2007/11/28/testing-scottgu-alternate-view-engines-with-asp.net-mvc-nvelocity.aspx&quot;&gt;NVelocity&lt;/a&gt; (and other factors) were big contributors to the final design. A final design, which I must say, is PURE GENIUS in its simplicity!&lt;/p&gt;  &lt;p&gt;I’ve been using it for 3 days now and I didn’t beat around the bush either. I wanted to know &lt;em&gt;very&lt;/em&gt; soon if this thing was going to work for me, so I went in &lt;em&gt;straight &lt;/em&gt;for the pain! Well…so far it has been like getting an epidural to be honest, and I feel fuzzy all over! It seems that everything I have a need for, has &lt;a href=&quot;http://sparkviewengine.com/documentation&quot;&gt;documentation&lt;/a&gt; available or somebody &lt;a href=&quot;http://odetocode.com/Blogs/scott/archive/2009/03/12/12631.aspx&quot;&gt;has already blogged&lt;/a&gt; about it! Writing out &lt;em&gt;.spark&lt;/em&gt; files for various concise pieces of output, only to have the Engine sew them up beautifully together during the page lifecycle has been an absolute pleasure, from a building, migration and refactoring point of view! You won’t see any samples in this post because there are many better ones already out there, but I plan on doing a series where I show small things that &lt;a href=&quot;http://sparkviewengine.com/&quot;&gt;Spark&lt;/a&gt; is doing for me that I couldn’t do elegantly before – and if I find any more hoops, I’ll talk about those too.&lt;/p&gt;  &lt;h2&gt;Conclusions&lt;/h2&gt;  &lt;p&gt;So, you may be asking why I’ve bothered to publicise this small, particular niche of the website. Well, because nobody should have to get as far as I did with the &lt;strike&gt;wrong&lt;/strike&gt; built in View Engine only to find they’re going to be throwing away weeks of code. Luckily here &lt;a href=&quot;http://sparkviewengine.com/&quot;&gt;Spark&lt;/a&gt; has come to the rescue once again, because without me having that expectation, it already supports the &amp;lt;% %&amp;gt; syntax for this very purpose – to ease migration. So I’m happy to say I haven’t lost the premise of most of my views, but I will be able to reengineer the paradigms behind them now more elegantly.&lt;/p&gt;  &lt;p&gt;Secondly, I don’t think Spark gets enough publicity – &lt;a href=&quot;http://whereslou.com/2009/09/16/building-42&quot;&gt;Microsoft have HIRED the guy&lt;/a&gt; for goodness sake and it’s still got relatively low adoption rate. It’s nothing to do with Lou himself – I mean he’s largely responsible for building the damn the thing, and &lt;a href=&quot;http://sparkviewengine.com/documentation&quot;&gt;documenting the hell out of it&lt;/a&gt; – so why lump him with the marketing too?! That’s OUR job as bloggers now and I’m really &lt;em&gt;stoked&lt;/em&gt; that the &lt;a href=&quot;http://herdingcode.com/&quot;&gt;Herding Code&lt;/a&gt; lads have &lt;a href=&quot;http://herdingcode.com/?p=216&quot;&gt;picked this one up&lt;/a&gt; and ran with it! I’ll do what I can, but it’s more important that developers learn that they can build better websites by switching.&lt;/p&gt;  &lt;p&gt;I’ve never met Lou personally, but I sure do hope he donates his brain to science in about 90 years or so. He’s a FREAKIN’ GENIUS man! But he’s not going to tell you that. He has taken what seems to be such a complex problem and turned it into something so simple that it makes us mere mortals feel like we’re wielding Poseidon’s own trident spewing pure, beautiful and maintainable mark-up into views that now truly live up to their potential as once described in Fowler’s definition! Keep up the good work Lou, your efforts are truly appreciated here…&lt;/p&gt;  &lt;p&gt;For the most part though, I really just wanted to make sure developers understood that I’ve been to &lt;em&gt;hell and back&lt;/em&gt; hand-in-hand with the built in View Engine, and I didn’t want you to have to go through the same pain. Seriously, stop what you’re doing and play with &lt;a href=&quot;http://sparkviewengine.com/&quot;&gt;Spark&lt;/a&gt; for a day and don’t discount it until then – it’s an absolute WINNER!&lt;/p&gt;  &lt;p&gt;All the best!   &lt;br /&gt;Rob G&lt;/p&gt;  </description><link>http://blog.robertgreyling.com/2009/09/cozwecancom-lights-up-with-spark-under.html</link><author>noreply@blogger.com (Robert Greyling)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-4853738336620281670</guid><pubDate>Thu, 30 Jul 2009 09:04:00 +0000</pubDate><atom:updated>2010-04-29T20:54:43.474+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Technical</category><title>Why we need the Cloud - Traditional Hosts: FAIL and you!</title><description>&lt;em&gt;&lt;/em&gt;  &lt;div&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;   &lt;div&gt;     &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Howdy all!&lt;/font&gt;&lt;/p&gt;     &lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Today we&#39;re going to tackle a particularly tough subject - and by tough, I mean it in terms of getting concrete data regarding the most important thing to a young Start-up: &lt;/font&gt;&lt;i&gt;&lt;b&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;costs&lt;/font&gt;&lt;/b&gt;&lt;/i&gt;&lt;i&gt;&lt;b&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;!!&lt;/font&gt;&lt;/b&gt;&lt;/i&gt;&lt;/p&gt;     &lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;OK - so I want to get our new website on-line, and I want to do it as quickly and as easily as possible in order to start &amp;quot;doing business&amp;quot;. I guess this is where I&#39;d need to define what &amp;quot;doing business&amp;quot; means to us. &lt;/font&gt;&lt;/p&gt;     &lt;font class=&quot;Apple-style-span&quot; face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;If your website would serve as more of an auxiliary sales channel, or information portal, or just a means of getting your &lt;/font&gt;&lt;i&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Name in lights&lt;/font&gt;&lt;/i&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;, then the rest of this article isn&#39;t really going to apply to you. That&#39;s mainly because with a little research, you can pretty much sign up with any of the cheap hosting deals out there today, and get away with it. &lt;/font&gt;&lt;/p&gt;     &lt;font class=&quot;Apple-style-span&quot; face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;What I&#39;m referring to here, is when the life and soul of your business lives and dies by the internet, and this applies directly to us at &lt;/font&gt;&lt;a href=&quot;http://cozwecan.com&quot; target=&quot;_blank&quot;&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;cozwecan.com&lt;/font&gt;&lt;/a&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;.&lt;/font&gt;&lt;/p&gt;     &lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Here are some of the things I&#39;ve thought about when it comes to this:&lt;/font&gt;&lt;/p&gt;     &lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;h2&gt;Applications &amp;amp; deployment&lt;/h2&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Unless you&#39;re planning on spending the money on a dedicated server or two at a traditional host, you&#39;ll more than likely be on shared hosting of some description. This will limit your deployment and application options. For instance - let&#39;s say that you choose your host based on&amp;#160; the fact that they offer the .Net v2.0 framework on Windows upon which to deploy your site. &lt;/font&gt;&lt;/p&gt;     &lt;font class=&quot;Apple-style-span&quot; face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Everything is peachy until .Net v3.5 comes out and you want to use some of the new language features. Well, you&#39;ll have a better chance of lighting a cigarette in a thunderstorm, than getting them to advance their upgrade plans. Host-hopping seems like the only way to go about ensuring your upgrade path on your terms - but then again, that could be why they like to lock you into these 12 and 24 month contracts...I wonder...&lt;/font&gt;&lt;/p&gt;     &lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;a href=&quot;http://code.google.com/appengine/&quot; target=&quot;_blank&quot;&gt;Google App Engine&lt;/a&gt; and &lt;a href=&quot;http://www.microsoft.com/azure/default.mspx&quot; target=&quot;_blank&quot;&gt;Microsoft Windows Azure&lt;/a&gt; have similar characteristics to those mentioned above, but with very important distinguishing features. As a start, there are no lock-in contracts, you get to deploy on the latest respective frameworks, which are frequently updated in lock-step with those that are using them and the infrastructure that you leverage can span multiple servers, not a small fraction of one! &lt;/font&gt;&lt;/p&gt;     &lt;font class=&quot;Apple-style-span&quot; face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Scalability and ease of deployment are the obvious benefactors here then. But you do still have the situation of running in their sandbox with access to only the bits they will allow. This can be problematic for some. With &lt;a href=&quot;http://aws.amazon.com/ec2/&quot; target=&quot;_blank&quot;&gt;Amazon EC2&lt;/a&gt;, you get total freedom to run riot on the one or many servers you spin up. But therein lies the rub - &lt;i&gt;run riot you will&lt;/i&gt; if you&#39;re not careful! With great freedom comes great responsibility, and you&#39;ll need to be willing to setup and keep tabs on all your deployed servers if you go that route.&lt;/font&gt;&lt;/p&gt;     &lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;But look what I&#39;m getting at here: With cloud providers coming along, the start-ups among us are beginning to get ACTUAL choice, where traditional hosts only ever gave me the ILLUSION of choice.&lt;/font&gt;&lt;/p&gt;     &lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;h2&gt;Bandwidth&lt;/h2&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Most traditional hosting providers will include a &lt;i&gt;nominal &lt;/i&gt;amount of outgoing bandwidth in &lt;/font&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;your package and this would be fine for most small businesses I&#39;ll admit. The problem here though&amp;#160; is similar to that of public transport - just try taking the bus on a day when you really &lt;i&gt;really &lt;/i&gt;need to be on time for a meeting...you know where I&#39;m going with this, right?! &lt;/font&gt;&lt;/p&gt;     &lt;font class=&quot;Apple-style-span&quot; face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;The day your teeny tiny start-up hits some form of publicity bubble &lt;a href=&quot;http://en.wikipedia.org/wiki/Slashdot_effect&quot; target=&quot;_blank&quot;&gt;via which ever medium you care to imagine&lt;/a&gt;, is the day you&#39;re really &lt;i&gt;really&lt;/i&gt; going to want your website to be up. And I don&#39;t mean up as in &lt;i&gt;it exists somewhere&lt;/i&gt;... I mean up like a &lt;i&gt;honeymooner&#39;s prick&lt;/i&gt;! &lt;/font&gt;&lt;/p&gt;     &lt;font class=&quot;Apple-style-span&quot; face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;To achieve this, you&#39;re firstly going to want to avoid what many traditional hosts &lt;i&gt;still do&lt;/i&gt; to this day. As soon as you reach your outgoing bandwidth cap, they throw up a nice error message saying that you&#39;ve exceeded your allowable quota. Nice! Especially when you&#39;re trying to get your brand new start-up off the ground. Others employ a less evil, but just as damaging tactic - instead, they set your cheque book on fire with exorbitant pricing per MB over quota. Need I go on?!&lt;/font&gt;&lt;/p&gt;     &lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Cloud providers seem to have seen right through this farce, and they&#39;ve all come up with their own pricing, but none the less pricing based upon usage and this is a MUCH more sane approach for a start-up in my opinion. The other hidden gem here is scale - most people don&#39;t see that one is missing until it&#39;s too late. But enough about the pipes already! I&#39;m sure the dinosaurs will begin catching up - it&#39;s just a matter of time, or market forces...whichever comes first.&lt;/font&gt;&lt;/p&gt;     &lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;h2&gt;Storage&lt;/h2&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;I&#39;ve often heard it said: &amp;quot;&lt;i&gt;Disk space is cheap!&lt;/i&gt;&amp;quot; Oh yeah? Try calling up a hosting provider and ask them for 6 terabytes on their SAN. Then ask them if it&#39;s fully redundant (Pssst - that means 12 or 18 terabytes total now if th&lt;/font&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;ey&#39;ll do it for you). &lt;/font&gt;&lt;i&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Then&lt;/font&gt;&lt;/i&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt; ask them how often they&#39;ll back it up for you. &lt;/font&gt;&lt;i&gt;&lt;b&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Then&lt;/font&gt;&lt;/b&gt;&lt;/i&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt; ask (and I&#39;d take a seat at this point if I were you) how much it&#39;s going to cost you. Lastly, ask them if you can pay as you grow?&lt;/font&gt; &lt;/p&gt;     &lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Just a quick glance over at &lt;/font&gt;&lt;a href=&quot;http://aws.amazon.com/s3/#pricing&quot; target=&quot;_blank&quot;&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Amazon&#39;s cloud storage solution&lt;/font&gt;&lt;/a&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt; (at the time of writing) reveals the following: &lt;/font&gt;&lt;/p&gt;     &lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;div&gt;       &lt;blockquote style=&quot;border-left: rgb(204,204,204) 1px solid; margin: 0px 0px 0px 0.8ex; padding-left: 1ex&quot; class=&quot;gmail_quote&quot;&gt;         &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;$0.150 per GB – first 50 TB / month of storage used&lt;/font&gt;&lt;/p&gt;       &lt;/blockquote&gt;        &lt;blockquote style=&quot;border-left: rgb(204,204,204) 1px solid; margin: 0px 0px 0px 0.8ex; padding-left: 1ex&quot; class=&quot;gmail_quote&quot;&gt;         &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;$0.140 per GB – next 50 TB / month of storage used&lt;/font&gt;&lt;/p&gt;       &lt;/blockquote&gt;        &lt;blockquote style=&quot;border-left: rgb(204,204,204) 1px solid; margin: 0px 0px 0px 0.8ex; padding-left: 1ex&quot; class=&quot;gmail_quote&quot;&gt;         &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;$0.130 per GB – next 400 TB /month of storage used&lt;/font&gt;&lt;/p&gt;       &lt;/blockquote&gt;        &lt;blockquote style=&quot;border-left: rgb(204,204,204) 1px solid; margin: 0px 0px 0px 0.8ex; padding-left: 1ex&quot; class=&quot;gmail_quote&quot;&gt;         &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;$0.120 per GB – storage used / month over 500 TB&lt;/font&gt;&lt;/p&gt;       &lt;/blockquote&gt;     &lt;/div&gt;     &lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;That&#39;s FIVE HUNDRED TERABYTES!!! Not that we would ever use that much disk space in our wildest dreams, but c&#39;mon...these solutions are clearly leading the way when it comes to modern day requirements, while your traditional host is still stuck in the dark ages charging you a premium because they had to go buy some extra hard drives. &lt;/font&gt;&lt;/p&gt;     &lt;font class=&quot;Apple-style-span&quot; face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Heck, Google gives you the &lt;a href=&quot;http://code.google.com/appengine/kb/billing.html#freequota&quot;&gt;first 500MB storage free&lt;/a&gt; if you go with them! I estimate that for our first project we&#39;ll need between 3 to 6 terabytes in the first 18 months, so unless the traditional hosts can compete at those kind of levels, going with cloud storage is a no-brainer.&lt;/font&gt;&lt;/p&gt;     &lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;h2&gt;Scalability and Reliability&lt;/h2&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Obviously if you &lt;a href=&quot;http://www.codinghorror.com/blog/archives/001279.html&quot;&gt;throw enough money at the solution&lt;/a&gt;, you&#39;re going to end up with something that satisfies both of these criteria. I&#39;m certainly not against going this kind of route as a long term goal for two reasons: firstly, I&#39;m comfortable in the hosted world with racks and servers you can touch and feel - &lt;a href=&quot;http://blog.stackoverflow.com/2009/01/new-stack-overflow-servers-ready/&quot;&gt;I love it&lt;/a&gt;! Secondly, the cloud still needs to prove that it can stay up 24/7! &lt;a href=&quot;http://www.theregister.co.uk/2009/06/12/lightning_strikes_amazon_cloud/&quot;&gt;Amazon have already failed&lt;/a&gt; in this department, and so have &lt;a href=&quot;http://www.theregister.co.uk/2009/07/06/dziuba_google_app_engine/&quot;&gt;Google for that matter&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;     &lt;font class=&quot;Apple-style-span&quot; face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;But managing your own machines does come at a price, and I&#39;m not just talking about the price tag...hardware failures are a bitch and cannot be predicted. Don&#39;t even get me started on shared hosting!! Not even the mighty Amazon and Google cloud offerings can get it right all the time. But let me ask you this then - who do you think will learn the most from hardware failures and downtime: Google, Amazon, or me? Why &lt;i&gt;me&lt;/i&gt; of course...just kidding! &lt;/font&gt;&lt;/p&gt;     &lt;font class=&quot;Apple-style-span&quot; face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;I&#39;d bet some fairly vital body parts that the cloud providers (although young today by hosting standards) are learning from these mistakes and putting contingency plans in place as a matter of utmost urgency to prevent PR meltdown. Not because they care about &lt;i&gt;little old me&lt;/i&gt;, but because they care about their brand! And I for one would much rather have it that way. &lt;/font&gt;&lt;/p&gt;     &lt;font class=&quot;Apple-style-span&quot; face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;I think a few speed bumps here and there are more noticeable in today&#39;s world of course, but that can only work in our favour. Start-ups have historically struggled to get viable low cost solutions to scale and reliability.&lt;/font&gt;&lt;/p&gt;     &lt;font class=&quot;Apple-style-span&quot; face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;h2&gt;Conclusion&lt;/h2&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Traditional Hosting is cheap until you want something more than the standard package. Extras cost...well...extra! And from a pricing perspective it commonly ends up in what I call: &lt;i&gt;Scale Fail&lt;/i&gt;&lt;i&gt;!&lt;/i&gt; Start-ups don&#39;t have the money to burn on a rack with a beefy server that won&#39;t hit full potential in the first year, and may never get a chance at all! &lt;/font&gt;&lt;/p&gt;     &lt;font class=&quot;Apple-style-span&quot; face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Once you clear away the Vaseline-edged, rose-tinted, misty-eyed view of the world, &lt;i&gt;estimating&lt;/i&gt; the success of your start-up needs to be based in reality, and whilst renting a big juicy server is fun and can cause significant overload to your saliva glands, I guarantee that you&#39;ll start feeling the sharp, sour, pang of regret approximately, no exactly 3 months in! Been there....done that. &lt;/font&gt;&lt;/p&gt;     &lt;font class=&quot;Apple-style-span&quot; face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;I&#39;ll caveat it all of course with this one simple fact: I&#39;ve never put anything substantial in the cloud before and I have no idea if it&#39;s going to work, but one thing is for sure: the costing model sure is a hell of a lot better from what I can see, and there are enough successful cloud projects out there already for me to be confident enough to have a fair crack at it. For these reasons and more I&#39;ll get to in future posts, we at &lt;a href=&quot;http://cozwecan.com&quot; target=&quot;_blank&quot;&gt;cozwecan.com&lt;/a&gt; &lt;i&gt;&lt;b&gt;need the cloud&lt;/b&gt;&lt;/i&gt; - perhaps more than it needs us...&lt;/font&gt;&lt;/p&gt;     &lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;I&#39;d be interested to hear if you have any particular views on this topic, and next time, I&#39;ll be going into more detail about the choice(s) of cloud solutions I&#39;ll be going with for &lt;a href=&quot;http://cozwecan.com&quot; target=&quot;_blank&quot;&gt;cozwecan.com&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;     &lt;font face=&quot;verdana, sans-serif&quot;&gt;&lt;/font&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Over and out!&lt;/font&gt;&lt;/p&gt;      &lt;p&gt;&lt;font face=&quot;verdana, sans-serif&quot;&gt;Rob G&lt;/font&gt;&lt;/p&gt;   &lt;/div&gt; &lt;/div&gt;  </description><link>http://blog.robertgreyling.com/2009/07/why-we-need-cloud-traditional-hosts.html</link><author>noreply@blogger.com (Robert Greyling)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-4756013596433741870</guid><pubDate>Thu, 25 Jun 2009 22:28:00 +0000</pubDate><atom:updated>2010-04-29T20:54:43.494+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Technical</category><title>The cozwecan technology stack</title><description>&lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;Greetings all!&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;     &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;I know we&#39;ve been a little quiet lately, but that&#39;s because we&#39;ve just had a great two week vacation visiting family overseas, and catching up with my sister F&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;ra&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;nkie (co-author on the cozwecan blog) in South Africa. We didn&#39;t get as much work done as we might have liked, but at least we can say we did literally &amp;quot;unplug&amp;quot; for a few days. I don&#39;t think the value of that can EVER be over estimated. I &lt;span style=&quot;font-size: small&quot;&gt;fe&lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;el refreshed and ready to get ba&lt;span style=&quot;font-size: small&quot;&gt;ck to &lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;work...&lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;S&lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;o &lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;w&lt;/span&gt;ithout any mor&lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;e ram&lt;/span&gt;bling, let me introduce you to the &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://cozwecan.com/&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;cozwecan.com&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt; technology stack as it stands in development today. I&#39;ll tell you when it changes next week, and then again the week afte&lt;span style=&quot;font-size: small&quot;&gt;r &lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;that ;-)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;  &lt;h2&gt;The website&lt;/h2&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;The website te&lt;/span&gt;&lt;span style=&quot;font-size: small&quot;&gt;chnolog&lt;/span&gt;y I&#39;ve chosen is the &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://www.asp.net/mvc/&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;ASP.NET MVC Framework&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt; - is there an acronym for the word &amp;quot;Framework&amp;quot;? Coz then I could just say it in one massive acronym...awesome!&amp;#160; Version 1.0 has just recently been released, but I&#39;ve been playing with it since the early CTPs.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;h2&gt;The dynamic bits and pieces&lt;/h2&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;No dynamic website today, worth its salt, is without some form of established JavaScript Framework. Or, you could go ahead and roll your own &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://buffered.io/2009/04/13/i-dont-need-your-frickin-framework/&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;if you think it&#39;s a good idea&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;. If you do though, I&#39;m afraid the &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://www.imdb.com/name/nm0001525/&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;Dr. Cox&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt; in me just &lt;/span&gt;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;has &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;to force his way out thusly: &lt;/span&gt;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&amp;quot;Any other day I’d say no, but today I&#39;m gonna go ahead and just say no.&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt; - been there, tried that - no thanks!&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;/span&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;My personal weapon of choice is &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://jquery.com/&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;jQuery&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;, but I can also highly recommend &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://mootools.net/&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;MooTools&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt; and &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://developer.yahoo.com/yui/&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;YUI&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;. I&#39;ve used all three and they all do a good job of abstracting the various browser nuances, but I generally come back to jQuery for two reasons: I love the fluent chaining paradigm, and it has a kick-ass plug-in extensibility model. I&#39;ll go into more depth on another post about how I&#39;m using jQuery on &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://cozwecan.com/&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;cozwecan.com&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;.&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;                     &lt;h2&gt;The languages&lt;/h2&gt;                   &lt;/span&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;Well, I&#39;m pretty sure you&#39;ve guessed already that it&#39;s a .NET platform, and yes, C# is my language of choice for this project. However, there just so happens to be a rather chunky piece of work coming up that is very suited to a more functional approach. As you can imagine with a photography site, there are a lot of image processing and background tasks that have nothing to do with the website work flow, and I&#39;m still trying to decide whether to go for something like F#, or if I should rather take this opportunity to see what &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/.NET_Framework#.NET_Framework_4.0&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;.NET 4.0&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt; and the &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_Language_Runtime&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;DLR&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt; and some of the more dynamic approaches might offer. I&#39;m open to suggestions here, and I&#39;ll certainly be blogging about my experiences in this arena.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;h2&gt;General Storage&lt;/h2&gt;  &lt;h2&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;  &lt;h2&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;font-family: &amp;#39;Times New Roman&amp;#39;&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;OK, so it&#39;s a photography based website. Needless to say, we&#39;re going to need a gig-or-two here and there to store said media. &lt;/span&gt;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;Ahem&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;.... &lt;/span&gt;&lt;/span&gt;&lt;i&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;all right, all right&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;, so we&#39;re going to need TERABYTES dammit! Where, pray-tell does one go to fulfill such lofty aspirations? Well one thing&#39;s for sure, you can&#39;t go to your traditional hosting providers, but that&#39;s a topic for another blog post. Long story short, I&#39;ve got two possibilities on the table: &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://aws.amazon.com/s3/&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;Amazon&#39;s S3&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt; and &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://channel9.msdn.com/posts/smarx/Windows-Azure-Blob-Storage/&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;Microsoft&#39;s Azure Blob Storage&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;. I&#39;m already leaning towards one of these, so stay tuned to find out which one and why...&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;h2&gt;The Database&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h2&gt;  &lt;p&gt;&lt;b&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;This one is a little tougher, of course there&#39;s Microsoft SQL Server, which I have worked on for many years and have tons of man hours spent troubleshooting and grinding away bottlenecks. It&#39;d be a shame not to put any of that experience to good use it seems. Or maybe I should try something new? What about the cloud solutions on offer? If I&#39;m going for Microsoft or Amazon on general storage, why not take advantage of their &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://channel9.msdn.com/posts/smarx/Windows-Azure-Table-Storage/&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;Table Storage&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt; or &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://aws.amazon.com/simpledb/&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;Simple DB&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt; respectively? Can you feel it? I can! Feels like yet another blog post for discussion... how excitin&#39; !!&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;h2&gt;and of course – work flow&lt;/h2&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;Due to the asynchronous nature of some of this solution, there will be a need to spin up some queues for worker processes. Of course there&#39;s trusty old &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Microsoft_Message_Queuing&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;MSMQ&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;, or the shiny new &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/azure/dd464806.aspx&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;Azure Queues&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;, and of course, the already well established &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://aws.amazon.com/sqs/&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;Amazon Queue offering&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;. I&#39;ll be looking into each one of these discussing the pro&#39;s and con&#39;s before making a decision.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;h2&gt;What about hosting?!&lt;/h2&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;This doesn&#39;t strictly form part of the technology stack, but since some of the technologies on the table are quite specific, this may lead me down a path that presents very few hosting choices. &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://www.microsoft.com/azure/default.mspx&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;Azure&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt; in its current form springs to mind. I need to be very careful of this because it doesn&#39;t just work like a &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://www.lego.com/en-US/default.aspx&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;LEGO&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt; set where I can pick and choose the pieces with a guarantee that they will work or host together. I&#39;ll definitely be discussing the advantages and pitfalls in more detail soon.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;But until then, feel free to ask questions here regarding the technology choices, or you might have some suggestions. Either way, I&#39;d be keen to hear your thoughts...&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;Until next time...over and out!&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot;&gt;Rob G&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  </description><link>http://blog.robertgreyling.com/2009/06/cozwecan-technology-stack.html</link><author>noreply@blogger.com (Robert Greyling)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-6163229697457544811.post-8631197206348931891</guid><pubDate>Sat, 06 Jun 2009 21:28:00 +0000</pubDate><atom:updated>2010-04-29T20:54:43.484+01:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">FAQ</category><category domain="http://www.blogger.com/atom/ns#">General Info</category><category domain="http://www.blogger.com/atom/ns#">Technical</category><title>Let&amp;#39;s get technical!</title><description>&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;Hi everyone,&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;Thanks for coming along. In this post, I&#39;m going to outline the kinds of technical articles I plan on publishing here. Hopefully that&#39;ll help you decide if I intend to cover anything in the near future that may be of interest to you and hopefully, if I get some feedback I&#39;ll have a good idea of your order of preference...your suggestions or requests are most welcome!&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;h2&gt;On with the show&lt;/h2&gt;  &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;When building a new website (or any software product), a good portion of my time at first is spent just researching the different applicable technologies out there - both &amp;quot;established&amp;quot; as well as &amp;quot;up-and-coming&amp;quot;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;      &lt;p&gt;Depending on when you plan on launching the site, it can sometimes be advantageous to piggy-back the timing of your release on top of that of a larger company&#39;s brain child. As an example, Microsoft is currently promoting the virtues of their new cloud offering - the Azure Services Platform currently in CTP. If your product is good enough and happens to show off the advantages of using their platform, then there can be an opportunity for early adopters to get some &amp;quot;free marketing&amp;quot; if they play their cards right. Unfortunately, from what I&#39;ve seen, this often comes down to being in the right place at the right time, or knowing a guy, who knows a gal, who knows....well, you get the idea.&lt;/p&gt;      &lt;p&gt;But that doesn&#39;t stop you from trying to hitch a ride on roller blades right behind their victory parade. You should be persistent with your activity in the community space around the technology you&#39;ve chosen, and take advantage of the many ways you can get noticed these days. This will all help build momentum towards promoting what you&#39;ve got to offer. Well - that&#39;s the theory anyway, and that&#39;s the main reason I&#39;ve decided to talk about my wanderings through the technological landscape, where I&#39;ve stumbled a few times (who am I kidding - many times!), and those are probably some of the most valuable things I&#39;ve got to talk about.&lt;/p&gt;      &lt;p&gt;Not for one second am I trying to tell you that I&#39;ve made it to the other side of the landscape. Quite the opposite in fact - I&#39;m still knee deep, and loving every minute of it. I have now chosen this place as my home, and wish to remain here for many years to come. I know it may sometimes be wild and unpredictable, but I&#39;d like to think I&#39;ve learned how to survive by foraging for sustenance the first few years, and then by learning to hunt proactively as my experiences taught me. One day I hope to be included at the top of the food chain here - but I certainly hope that doesn&#39;t happen too soon because I really do enjoy the adventure - and I hope that you enjoy coming along for the ride...&lt;/p&gt;   &lt;/span&gt;&lt;/p&gt;  &lt;h2&gt;Topical by nature&lt;/h2&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;     &lt;p&gt;Without further ado (and yes, I know it&#39;s been quite an &amp;quot;ado&amp;quot; up until now), here are some of the topics I intend to cover in due course...&lt;/p&gt;   &lt;/span&gt;&lt;/span&gt;  &lt;ul&gt;&lt;/ul&gt;  &lt;div&gt;   &lt;ul&gt;     &lt;li&gt;       &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;Firstly, I&#39;ll be introducing the cozwecan.com technology stack of course, and this will set the basis for many of the articles to follow. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;I&#39;ll talk about considerations surrounding hosting, both traditional and cloud-based and how that can affect the bottom line. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;I&#39;m also going to delve into actual code, design and best practices that I&#39;ve adopted as part of my toolbox over the years. I don&#39;t pretend to have invented them, but I&#39;m a firm believer in standing upon the shoulders of giants, and I&#39;ve learned a great deal from the leaders in our community. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;I tell you a little more about some of the tough technology decisions and choices I&#39;ve made along the way and why I made them. There are still a fair few to make though - so perhaps you can help! &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;Short articles specifically written &amp;quot;for dummies&amp;quot; - and I count myself in that group too! There&#39;s nothing worse than trying to dig into a new technology and all you can find are complex examples that assume way too much! So I&#39;ll share with you what I&#39;ve learned using a simplistic approach and you get to tell me if it works or not! &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/li&gt;      &lt;li&gt;       &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;Spotlights on specific bits of technology and tools I&#39;ve used to make life a little easier. I like to dabble with many different platforms, but I&#39;ve been making money using .NET, so you can probably expect that to be the main flavour here. I&#39;d like to expand on that some day though....who knows? &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;     &lt;/li&gt;   &lt;/ul&gt; &lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;ul&gt;&lt;/ul&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;I think that&#39;s a fairly broad and adequate description of where I think my posts will take you. If that floats your boat, then I look forward to discussing it with you.&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&lt;/p&gt; &lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;     &lt;p&gt;Look out for them coming your way...&lt;/p&gt;      &lt;p&gt;&lt;span style=&quot;font-family: verdana, sans-serif&quot;&gt;&lt;span style=&quot;font-size: small&quot; class=&quot;Apple-style-span&quot;&gt;Rob G&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/span&gt;&lt;/span&gt;  </description><link>http://blog.robertgreyling.com/2009/06/let-get-technical.html</link><author>noreply@blogger.com (Robert Greyling)</author><thr:total>1</thr:total></item></channel></rss>