<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2224487183720340652</id><updated>2011-11-27T15:17:13.770-08:00</updated><title type='text'>Corcoranp's Tech Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://corcoranpstech.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2224487183720340652/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://corcoranpstech.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Peter Corcoran</name><uri>http://www.blogger.com/profile/04589167954416521145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_YeOS63C7yWQ/S3q_UUVBFiI/AAAAAAAAGdY/u89x5rB3tiw/S220/me.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2224487183720340652.post-8531217868476441680</id><published>2009-05-19T13:24:00.000-07:00</published><updated>2009-05-19T14:00:31.756-07:00</updated><title type='text'>Logic</title><content type='html'>&lt;style&gt;pre {&lt;br /&gt; /*background-color: transparent;*/&lt;br /&gt;color: green;&lt;br /&gt; border: medium inset #CCCCCC;&lt;br /&gt; font-family: "Courier New", Courier, monospace;&lt;br /&gt; margin: 1em 2em 1em 2em;&lt;br /&gt; overflow: auto;&lt;br /&gt; padding: .5em .5em .5em .5em;&lt;br /&gt; white-space: nowrap;&lt;br /&gt;&lt;/style&gt;I ran into an interesting challenge today.  I had some conditions that needed to be met in order for me to add an item to a drop down box. &lt;br /&gt;&lt;br /&gt;Here are the conditions:&lt;br /&gt;&lt;br /&gt;1. When ActiveOnly flag is true, then only add items that are active.&lt;br /&gt;2. When ActiveOnly flag is false, add all items.&lt;br /&gt;&lt;br /&gt;Ok, I know it seems simple, and it was very easy to write this as an if statement.  This is what I started with:&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;...&lt;br /&gt;if(activeOnly)&lt;br /&gt;{&lt;br /&gt;  if(item.IsActive){&lt;br /&gt;     dropdown.Items.Add(item.Name);   &lt;br /&gt;  }&lt;br /&gt;} else {&lt;br /&gt;dropdown.Items.Add(item.Name);&lt;br /&gt;}&lt;br /&gt;...&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Ok that gets the job done, but it doesn't look very elegant, and I've repeated my insert code twice.&lt;br /&gt;&lt;br /&gt;After looking at this a while, I decided that there had to be a better way to write that code, so I did a classic truth table:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;       ACTIVE&lt;br /&gt;ONLY    -------------&lt;br /&gt;ACTIVE  |  T  |  F  |&lt;br /&gt;        -------------&lt;br /&gt;        |  T  |  T  |&lt;br /&gt;        -------------&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Basically indicating to me that the only time that I DON'T want to write a value is when ONLYACTIVE = true AND ACTIVE = false.&lt;br /&gt;&lt;br /&gt;At this point this is starting to look like an opportunity for a specification pattern but I'm trying to just get the job done AND I didn't want to over kill it.  Thinking in terms of specifications does shed light on how we should think about this test.  If the ONLY time we DON'T write a value is when ONLYACTIVE = true AND ACTIVE = false, then shouldn't we TEST to see if this CONDITION is TRUE?&lt;br /&gt;&lt;br /&gt;This is the final if statement result:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;code&gt;&lt;br /&gt;...&lt;br /&gt;if(!(activeOnly &amp;amp;&amp;amp; !item.IsActive)){&lt;br /&gt; dropdown.Items.Add(item.Name);&lt;br /&gt;}&lt;br /&gt;...&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now isn't that less smelly??&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2224487183720340652-8531217868476441680?l=corcoranpstech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corcoranpstech.blogspot.com/feeds/8531217868476441680/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2224487183720340652&amp;postID=8531217868476441680' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2224487183720340652/posts/default/8531217868476441680'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2224487183720340652/posts/default/8531217868476441680'/><link rel='alternate' type='text/html' href='http://corcoranpstech.blogspot.com/2009/05/logic.html' title='Logic'/><author><name>Peter Corcoran</name><uri>http://www.blogger.com/profile/04589167954416521145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_YeOS63C7yWQ/S3q_UUVBFiI/AAAAAAAAGdY/u89x5rB3tiw/S220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2224487183720340652.post-2295257818743920720</id><published>2008-06-24T19:09:00.000-07:00</published><updated>2008-06-25T06:11:06.554-07:00</updated><title type='text'>Facebook MVC</title><content type='html'>&lt;div style="text-align: center;"&gt;&lt;span style="color: rgb(51, 51, 51);font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;THIS ARTICLE IS IN DEVELOPMENT &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Welcome to Facebook MVC!&lt;br /&gt;&lt;br /&gt;Obviously, if you were able to find this article you are interested in developing Facebook applications using the Model, View, Controller (MVC) design pattern!  If this is truly what you'd like to do then you've come to one of the right places!&lt;br /&gt;&lt;br /&gt;There are a few things that you'll need to have before you can get started.&lt;br /&gt;&lt;br /&gt;1. Visual Studio 2008&lt;br /&gt;2. &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=92F2A8F0-9243-4697-8F9A-FCF6BC9F66AB&amp;amp;displaylang=en"&gt;ASP.NET MVC Preview 3&lt;/a&gt;&lt;br /&gt;3. &lt;a href="http://www.codeplex.com/FacebookToolkit/Release/ProjectReleases.aspx?ReleaseId=9824"&gt;Facebook Developer Toolkit 1.6&lt;/a&gt;&lt;br /&gt;4. My &lt;a href="http://www.codeplex.com/FacebookMvcAddon/Release/ProjectReleases.aspx?ReleaseId=14711"&gt;Facebook Developer Toolkit MVC Addon&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The focus of this article is on how to setup a Facebook application using a MVC approach using ASP.NET.  The Facebook Developer Toolkit (FBDT) is a great resource for people that are interested in developing a Facebook .NET application.  FBDT is basically a .NET wrapper of the Facebook API.   Unfortunately, the current approach taken by the FBDT for building web applications is straight WebForms &amp;amp; as such they use a class inheritance model which does not support an ASP.NET MVC application easily.  The Facebook Developer Toolkit MVC Addon, makes supporting a Facebook ASP.NET MVC application a bit easier by adding support for web.config based configuration, &amp;amp; pre-controller-execution FacebookAPI setup via an Action Filter.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Please bear with me as I add more details to this article &amp;amp; to CodePlex&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2224487183720340652-2295257818743920720?l=corcoranpstech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corcoranpstech.blogspot.com/feeds/2295257818743920720/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2224487183720340652&amp;postID=2295257818743920720' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2224487183720340652/posts/default/2295257818743920720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2224487183720340652/posts/default/2295257818743920720'/><link rel='alternate' type='text/html' href='http://corcoranpstech.blogspot.com/2008/06/facebook-mvc.html' title='Facebook MVC'/><author><name>Peter Corcoran</name><uri>http://www.blogger.com/profile/04589167954416521145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_YeOS63C7yWQ/S3q_UUVBFiI/AAAAAAAAGdY/u89x5rB3tiw/S220/me.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2224487183720340652.post-9119777736401754094</id><published>2008-06-23T20:46:00.000-07:00</published><updated>2008-06-23T21:02:57.641-07:00</updated><title type='text'>I DID IT!</title><content type='html'>I've completed the code for my &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=CCD46762-45EC-4FBE-AD91-FC916671E734&amp;amp;displaylang=en"&gt;Facebook Developer Toolkit&lt;/a&gt; &amp;amp; &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=92F2A8F0-9243-4697-8F9A-FCF6BC9F66AB&amp;amp;displaylang=en"&gt;ASP.NET MVC Preview 3&lt;/a&gt; integration toolkit! &lt;br /&gt;&lt;br /&gt;I know that nobody in the world would even read this - yet - but I'm excited about it!&lt;br /&gt;&lt;br /&gt;I've made it RIDICULOUSLY easy! I've added support for iFrame &amp;amp; FBML applications and all you have to do is add an ActionFilterAttribute to your Controller Action!&lt;br /&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;The code looks something like this:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: left;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family: courier new;"&gt;[Facebook.Web.Mvc.InitializeIframeAction]&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: courier new;"&gt;        public ActionResult Index(Facebook.API.FacebookAPI facebookAPI)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: georgia;font-size:100%;" &gt;After that you have complete access to the FacebookAPI that is part of the Facebook Developer Toolkit (FBDT).&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.coderjournal.com/2008/06/mvc-facebook-wonderful-development-platform/"&gt;Nick Berardi&lt;/a&gt; started trying to do the same thing with the FBDT but realized that they had an inheritance model for getting ASPX pages to work correctly which doesn't work well with microsoft's MVC model .  He moved to the Facebook.NET framework because it was more object based.  I feel like I've created a better domain model for the FBDT!&lt;br /&gt;&lt;br /&gt;note: I was originally going to base my MVC implementation on Castle's Monorail since Microsoft's MVC teams is working with the folks at Castle.  I did have some issues with getting both MVC frameworks to work correctly in a shared-hosting environment but ultimately Microsoft's MVC architecture had an easier fix...I get into it more when I write my real article...this is just me being excited that I'm done with my first version and Xodel (my software development company) can release some real software for the first time since I created  it!&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2224487183720340652-9119777736401754094?l=corcoranpstech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corcoranpstech.blogspot.com/feeds/9119777736401754094/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2224487183720340652&amp;postID=9119777736401754094' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2224487183720340652/posts/default/9119777736401754094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2224487183720340652/posts/default/9119777736401754094'/><link rel='alternate' type='text/html' href='http://corcoranpstech.blogspot.com/2008/06/i-did-it.html' title='I DID IT!'/><author><name>Peter Corcoran</name><uri>http://www.blogger.com/profile/04589167954416521145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_YeOS63C7yWQ/S3q_UUVBFiI/AAAAAAAAGdY/u89x5rB3tiw/S220/me.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2224487183720340652.post-3376561037022148775</id><published>2008-06-18T15:48:00.000-07:00</published><updated>2008-06-18T15:49:22.176-07:00</updated><title type='text'>ASP.NET MVC &amp; Facebook</title><content type='html'>I'm working on an MVC Facebook Application. It's been an interesting journey so far.  I'll I be posting the details here.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2224487183720340652-3376561037022148775?l=corcoranpstech.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://corcoranpstech.blogspot.com/feeds/3376561037022148775/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=2224487183720340652&amp;postID=3376561037022148775' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2224487183720340652/posts/default/3376561037022148775'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2224487183720340652/posts/default/3376561037022148775'/><link rel='alternate' type='text/html' href='http://corcoranpstech.blogspot.com/2008/06/aspnet-mvc-facebook.html' title='ASP.NET MVC &amp; Facebook'/><author><name>Peter Corcoran</name><uri>http://www.blogger.com/profile/04589167954416521145</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='http://3.bp.blogspot.com/_YeOS63C7yWQ/S3q_UUVBFiI/AAAAAAAAGdY/u89x5rB3tiw/S220/me.jpg'/></author><thr:total>0</thr:total></entry></feed>
