# Monday, 30 January 2012

The var keyword was introduced with C# 3.0 and the .NET Framework 3.5 to allow the declaration of implicitly typed variables.  The driving force behind the need for implicitly typed variables was the introduction of Anonymous Types

If you are using var outside of truly anonymous types you are doing so out of laziness.  I know this is a bold statement that a lot of developers are going to disagree with, so let me explain.

First off I totally agree that using var can speed up your lines per minute coded and I do use var in this manner.  But, I always replace var with the actual type after the fact.  You can do this with out requiring a large amount of time after the fact using a tool such as ReSharper and setting up you Clean Up Code” functionality to replace all usages of var with the actual type when possible.

Now for my supporting arguments:  *All of which only pertain to using var when the type is not truly anonymous.*

  • C# is not a Dynamic Language!  This may be bad or not ideal but it is fact.  The truth is not everyone is fluent in dynamic languages and they are not expecting to read code coded in a dynamic fashion when dealing with C#.
  • Code written in a dynamic fashion, i.e. implicitly typed , is harder to read, especially when you are not use to reading it.  I know what you are saying how is this hard to read?:
    1. var x = "This is not hard to read and understand what x is!";

    And you are correct, that example is not hard to read and figure what x is.  What about this?
    1. var x = from custs in dataContext.Customers
    2.         join orders in dataContext.Orders
    3.             on custs.CustomerId equals orders.CustomerId
    4.         join lines in dataContext.OrderLines
    5.             on orders.OrderId equals lines.OrderId
    6.         join products in dataContext.Products
    7.             on lines.ProductId equals products.ProductId
    8.             where products.Name.Contains("FooBar")
    9.         where custs.LastName.Contains("Smith")
    10.         select products

    I would much rather see and read;
    1. IQueryable<Product> x = from custs in dataContext.Customers
    2.                         join orders in dataContext.Orders
    3.                             on custs.CustomerId equals orders.CustomerId
    4.                         where custs.LastName.Contains("Foo")
    5.                         join lines in dataContext.OrderLines
    6.                             on orders.OrderId equals lines.OrderId
    7.                         where lines.Quantity > 10
    8.                         join products in dataContext.Products
    9.                             on lines.ProductId equals products.ProductId
    10.                         where products.Name.Equals("FooBar")
    11.                         where custs.LastName.Contains("Smith")
    12.                         select products;

              The truth is you know what your result is, at least you better or you have no business writing the code in the first place, so just declare it as such!

              One more thing,  var has no place in demo code, tutorials, and blog posts. The purpose of demo code, tutorials, and blog posts are to provide education and in doing so the code should be clean and concise and accessible to the masses.

              OK, let me have it.

              posted on Monday, 30 January 2012 10:00:02 (Central Standard Time, UTC-06:00)  #    Comments [12]
              # Monday, 16 January 2012

              I will be talking about ASP.NET MVC4 and jQuery Mobile at Visual Studio Live! Las Vegas in March.


              Reach the Mobile Masses With ASP.NET MVC 4 and jQuery Mobile

              Creating web applications that will target multiple devices and platforms has become the web developers Holy Grail. Simple HTML pages render without issue no matter what browser or device they are viewed on but who codes simple HTML pages? What happens when you have a business need to hit all mobile platforms?

              You don't have to writes hundreds of lines of code to make this happen! In this talk Keith will show how using the latest version of ASP.NET MVC, MVC4, and JQuery you can develop web applications that target iPhone, iPad, Android, Windows Phone 7, and even Blackberry and not have to code and style each platform separately.

              You will learn:

              • How to make your site "viewable" on most user platforms with minimal effort.
              • How to make your site as usable on all mobile platforms as it is on the desktop browser.
              • How to do all of this without writing code to target each mobile platform independently.


              If you register with my special speaker priority code: VLSPK6 you will save $500 off!


              Visual Studio Live Las Vegas

              Mirage Resort & Casino

              March 26-30, 2012

              Event web site: http://vslive.com/lasvegas

              Twitter: http://twitter.com/vslive - #vslive

              Facebook: http://www.facebook.com – Search “vslive”

              LinkedIn: http://www.linkedin.com - - JOIN “vslive” GROUP

              Visual Studio Live is five days of practical, Microsoft-supported training for developers to help solve your tough .NET development challenges. You'll find how-to advice and the tips and tricks that you'll be ready to implement as soon as you get back to the office. Our expert faculty - including many Microsoft instructors - makes each session interactive so you can discuss your particular development roadblocks and come away with actionable solutions.

              Visual Studio Live Las Vegas offers in-depth training in:

              • Cloud Computing
              • Cross Platform Mobile
              • Data Management
              • HTML5
              • Silverlight / WPF
              • Visual Studio 2010+/.NET 4+
              • Web
              • Windows 8/WinRT
              • Windows Phone 7

              Visual Studio Live Las Vegas – Expert Solutions for .NET Developers


              posted on Monday, 16 January 2012 14:35:00 (Central Standard Time, UTC-06:00)  #    Comments [3]
              # Sunday, 03 July 2011

              Earlier this year during Chicago Code Camp 3, I had the privilege of sitting down with Clark Sell and Marc Nichols and recording my first podcast.  Clark and Mark are the duo behind Developer Smackdown.  If you are not familiar with Developer Smackdown I suggest you take a listen.  In my musing, as Clark and Marc refer to the episodes, we discuss a topic very near and dear to my hear, Test-driven Development.  Take a listen and let me know what you think.

               TDD With Keith Burnell

              posted on Sunday, 03 July 2011 20:30:00 (Central Daylight Time, UTC-05:00)  #    Comments [2]
              # Thursday, 23 September 2010

              On this, my final day at my current employer, I have mixed emotions.

              1. Excitement – I am very excited to become a part of the Skyline Technologies family.  I feel that they certainly have the most to offer at this point in my career.
              2. Disappointment – I am disappointed that my vision of the future and my current employer’s vision could not align.
              3. Confusion – This is the emotion I am having the most difficulty with.  It all comes from when I asked myself “What did I gain from working for my current employer for the last 5 years?”  The first things that come to mind are experience and knowledge.  But does this have anything to do with my current employer?  As a consultant, to be completely honest, all my current employer did was arrange for the client and myself to speak.

               

              I am going to stop there.  I don’t want to dwell in the past.  All I can say is that in the last 5 years I have grown more than I had in the previous 5 years and what more can you ask for.

              Here is to the next 5 years….

              posted on Thursday, 23 September 2010 08:54:19 (Central Daylight Time, UTC-05:00)  #    Comments [0]
              # Friday, 17 September 2010

              Earlier this week I got into a bit of spat with a couple of Tweeps on Twitter.  It started with someone I follow and respect re-tweeting something someone tweeted about him which basically said the tools which he is associated with aid developers in creating bad design.  I responded to this tweet in support of this person whom I respect by saying…

              Tools don’t do bad design.  Bad developers do bad design.

              Immediately after tweeting this I got multiple reply’s stating that just because you do bad design or write bad code you are not necessarily a bad developer. 

              To be blunt…this confused the hell out of me.  If you knowingly create a bad design or write bad code how can you be a good developer?  I guess the key word in that previous statement is *knowingly*.  But if you don’t know what good design/code is in my book you can’t be a good developer.

              Don’t get me wrong.  We have all been in the position when due to forces outside of our control we have been forced to write imperfect code or create a less than perfect design.  To me this is one place where you can quantifiably determine the good developer from the bad developer.  A good developer, when writing imperfect code due to factors outside of there control, will do one or more of the following:

              1. Get upset because they know they are writing less than perfect code/design.
              2. Leave a comment stating why the code/design was done in this factor.
              3. Add a ToDo for refactoring later.
              4. Will do the imperfect code/design in such a way that the refactoring effort will require less effort.

              This argument of writing bad code does not a bad developer make really rattles me.  That is exactly what it does!

              OK…Let me have it!

              posted on Friday, 17 September 2010 08:58:51 (Central Daylight Time, UTC-05:00)  #    Comments [1]
              # Friday, 10 September 2010

              In the past 10 years I have gone from being an intern doing VBA in Access to architecting and coding enterprise level systems with some of the coolest technologies and methodologies.  I have learned so much, and have had a great time doing it.  Sounds perfect right…but not for me…I want more.  Up to this point, for the most part, I have done all this in a bubble.  Until recently I haven’t been overly involved in the development community and today I am officially declaring the end of that.

              I have recently accepted a position with Skyline Technologies.  I am very excited about the opportunity of bringing my knowledge and experience to the group at Skyline.  I am going to use this new start as a spring board to getting more involved in the development community locally and beyond.

              What really inspired me though was listing to John Sheehan on Rob Conery’s new podcast This Developer’s Life.  If you haven’t started listening to This Developer’s Life yet…do it…now!  In episode 1.0.2: Fame and Notoriety Rob talks to John Sheehan and Scott Hanselman about fame and how it relates to their careers.  Of course Scott was great, and hilarious, as usual but what I really enjoyed was John’s story.

              In one particular part of the interview John details a point in his life when he decided to “raise his profile” and details what his goals where and how he was going to do it.  To me this sounded like a great starting point and what better to add that extra motivation than making it public! :)

              Raising My Profile – a 12 month plan

              1. One substantial blog post per week.
              2. Speak at at least 6 user group meetings or conferences.
              3. Contribute to one or more open source projects.
              4. Raise my Twitter follower count to at least 250 legitimate followers.
              5. Become an MVP

              So that’s my plan…and we will see how it goes!

              posted on Friday, 10 September 2010 17:30:00 (Central Daylight Time, UTC-05:00)  #    Comments [0]
              # Saturday, 24 July 2010

              On the way home from a weekend in Chicago for Midwest Give Camp a fellow developer and I got on the subject of what I like to call the “9 – 5 Developer.”  If Wikipedia had an entry for “9 –5 Developer” it would read:

              • A 9 – 5 Developer is a developer, typically found in the corporate arena, that is content with doing his daily development responsibilities using the least amount of effort possible.  While away from work they do nothing to better themselves in the development arena.  They are often found using technologies and techniques 2 –5 years behind what is current, and are content in doing so.  They are usually opposed to new things in fear that they would be required to learn.  Phrases often spoken by them include;
                • “If they think I am staying a minute after 5…they are crazy!”
                • “Why would I need to learn that when what I am doing works?”
                • “I would attend [insert free developer event] if the company paid me for my time.”
                • “[Boss] has something against me!  I am always being passed up for promotions.”

              Don’t worry…if you are reading this…you are not a “9 – 5 Developer"! 

              Being that I am a consultant I have ran in to more than my share.  If I had to estimate I would say, from my experience, 85% of all developers fall in this group.  I find that very disturbing.  I just can’t imagine being content going through life this way.

              That’s my rant!  Thanks for stopping by!

              posted on Saturday, 24 July 2010 22:01:00 (Central Daylight Time, UTC-05:00)  #    Comments [5]
              # Wednesday, 26 May 2010

              There are so many things that I want to dive into and I was whining about it on Twitter and a friend of mine brought to my attention that I should blog about it. So here we go;

              • Ruby On Rails (Have a good start on this)
              • F#
              • Power Shell
              • iPhone Development (Started)
              • Android Development (Started)
              • nServiceBus
              • Advanced Silverlight/WPF

              posted on Wednesday, 26 May 2010 17:58:04 (Central Daylight Time, UTC-05:00)  #    Comments [12]
              # Monday, 23 March 2009

              The project I am currently working on I wasn’t brought in until near the end of the design process.  The negative of this is twofold.  First, I was not as comfortable with the requirements as I would have been had I been on the project since day one.  Secondly, and more importantly in the case of this entry, I wasn’t able to get down and dirty with the estimates.  I did have a chance to voice my opinion about the estimates a time or two prior to them being submitted to the PM but not having the intimate knowledge of the requirements needed to support any suggested deviance I kept quiet.  Of course in my head I was thinking the estimates where on the high side.  Let me clarify that these estimates where not just the number of hours before the system is ready for unit testing.  The data the system relies on is only available through web services…that do not exist yet…and must be written by a specific team that has a vast knowledge of the underlying data structure.  (If you can sense in my tone there will be a post on this matter…but not until I am at a different client.)  So the estimates included a design/code/unit test period that would take us up to the point where we could code no further without the web services in place.  The estimate for this “no work left” date was approximately 6 weeks.  We are now in week 3 and I can go no further without those web services in place and I have an impromptu meeting with the PM and the other developer’s tomorrow morning to see what my next steps are.

              Lesson:  If being brought in on a project in a lead developer role late…insist on getting the extra time needed to get familiar with the requirements and make any needed adjustments to the estimates.

               

              posted on Monday, 23 March 2009 18:55:23 (Central Standard Time, UTC-06:00)  #    Comments [2]
              # Friday, 20 March 2009
              Welcome to my first blog post!  I need to thank my idle Scott Hanselman for creating such an awesome blogging engine and my pal Michael Wheeler for helping me get it up and running!  Cheers!

              posted on Friday, 20 March 2009 14:33:18 (Central Standard Time, UTC-06:00)  #    Comments [5]