Ang3lFir3 – Life as a Code Poet

February 3, 2012

Chewie article in Visual Studio Magazine

My friend and Chewie contributor Ian Davis does more than just help out his fellow OSS project owners. He also writes some of the best articles in Visual Studio Magazine. It just so happens that today he wrote an article on using Chewie to clean up Nuget dependancies.

BTW Ian is also the guy behind Toji which makes it even more awesome to use Psake.

Advertisements

February 23, 2011

Harmony Hackathon: the beginning of something big?

This story starts somewhere between 7 and 10 mnths ago, when I was talking to my friend @cbilson during a break in a pairing session. We had previously talked about give camps and coding for causes events. This led us to the fact that we both liked the idea but felt it could be more targeted. We had also talked about renting some space from the facility my wife works at for the South Sound .Net Users Group to hold a workshop.

The idea stuck with me, my wife works for a non-profit after all and I had worked for one recently. I talked to my wife about an idea I had brewing. The place she works for just so happens to be one of the premiere Cancer Retreat facilities in the Northwest (if not the world[but don’t tell them]). Where is it that she works you ask, Harmony Hill …. just about the most centering place on earth (ok yeah I know I’m REALLY biased).  Anyway back to the story. I bounced the idea of my cohorts including @NotMyself . Every person I brought the idea to thought it would be amazing. So I decided to move forward with what would become Harmony Hackathon.

Harmony Hill agreed to support the group by providing hospitality services and lodging for the entire group while they were on the hill. I can not even begin to tell you how amazing this staff is, for 48 hrs 12 of the finest developers in the northwest didn’t want for anything!

The setup on my part was pretty easy, invite some of the best programmers in the northwest and ask them to do the one thing they love, code!, for charity…. plus I promised them beer! It worked… attendance was limited by the number of beds we had available for people to sleep in. It was only seconds after sending out the first request did I have people signed up to the eventbrite site.

Finally the day arrived to begin the Hackathon and you could say the excitement in the room was palpable. We started with introductions to the projects (we had initially intended to run to two projects) and to the facilities. We then headed down to the first of several amazing meals on The Hill. After dinner is when the real excitement began. We had decided on building the needed registration/waitlist management tool which is centered around available beds at the retreat center. @darkxanthos took the reigns as PM/customer liaison person and began gathering requirements for the developers to start working with. There was a lot of desire to start coding but also a deep understanding amongst the group that we must first understand the problem before we can solve it. A lot of effort went into making sure we focused on breadth and not rabbit holing ourselves on a single problem. Once again Justin did a great job and with the help of Rodica and Aeden a group of requirements was beginning to emerge as a set of mockups.

We began building out the plumbing and infrastructure of the project and decided on a couple of technology choices… MVC 3 and the default Razor view engine that comes with it.

The next 40 some hours of the weekend were a frenzy of coding…. pulling changes and merging changes…. I swear if nothing else our git skills improved. There were times that a person might have to pull again after merging changes from the last commit only to find out that they were still behind master. It was crazy, as a matter of fact you can see for yourself, thanks to a video from @NotMyself showing the gource animation of what happened.

We didn’t exactly finish, but we did cover some really awesome ground and learn a lot about how to manage such a gathering. A couple of the things we learned are kind of obvious but extremely powerful.

1. While it is exciting to see what can be started from nothing, it is a really good idea to be aware of the problem space to get the best results out of the group. Have a small group meet with the product owner at least once before the event date to flush out stories to keep the team working and not waiting. You can do more the day of the event but you need a foundation to work against.

2. Smaller teams truly do work best. Even a team of 12 is too large optimal is about 5-6. We learned that with all the commits and furious amounts of work we couldn’t help but all get in each others way no matter how much we tried not to.

3. You need a dictator. Sometimes the group can not come to a decision about technology (who’da thought a bunch of Alpha geeks couldn’t agree ) so someone has to be able to make a decision and cast that extra vote. I wouldn’t personally say you need to use this power often, only when the group seems to be wasting time arguing over some tech that doesn’t directly solve the problem. I say this because it is extremely important that the group be open to exploring lots of new spaces so that the benefit is not only to the PO but also to the developers.

4. Infrastructure is important. You really need to have the core infrastructure laid out and decided on before you get started. We chose to use ASP.Net MVC because we are mostly all web developers and are familiar with the technology. We also chose NHibernate and StructureMap as we were all familiar with them as well (well maybe not StructureMap but its concepts are universal … see we learned stuff). This meant there was some setup that was needed to get all the plumbing in place. Had this been ready at a cursory level earlier we would have spent less time shaving that particular Yak.

So the ultimate question remains. Will we do it again? The answer is quite simple, OF COURSE !!! The group learned a lot from the experience and the project continues to move forward. As a matter of fact last night while talking with my wife she informed me that they had already started to talk about how the product could help with other programs at Harmony Hill. We have already started to think about how to plan for the next one and how to get the most out of the event.

The ultimate goal…. start something amazing to help out not only this one organization but potentially help out many others. Start a tradition of greatness and see the program grow. Which is good because we might just need that waitlist manager to help out with the future waitlist for Harmony Hackathon 2012.

January 26, 2011

Introducing Chewie for nuget

Filed under: .NET, C#, Microsoft, technology, Uncategorized, web development — Tags: , , , , , , , , — ang3lfir3 @ 4:45 pm

So anyone following my friends and co-workers Jeff Schumacher (@codereflection), Adron Hall (@adronbh) and Bobby Johnson (@NotMyself) is aware that today we [ok really just them, I was busy on a diff less awesome project] started giving nuget a serious trial run to manage our extensive list of dependencies. A lot of which are not available on nuget at the moment.

This prompted a few blog posts from the guys here and here.

We kinda came up with the idea that we really needed something along the lines of bundler for ruby gems. So I started with the most simple version possible and Chewie was born. (All credit for the name goes to @NotMyself). At the moment its a basic file and a single line of powershell goodness.

check it out and contribute @ github

January 24, 2011

Refactoring MVP to MVC the slow way : pt1 Extracting Services

Filed under: .NET, ASP.Net MVC, C#, Patterns, technology, Uncategorized, web development — Tags: , , , , , , , , , — ang3lfir3 @ 9:58 pm

In this series I would like to examine the process my team and I have been undertaking on our current project. One of the aspects of working on legacy applications is that when you dive in you often see patterns that are not easily testable. The current application my team is working on was built many years ago and implements MVP (model view presenter) ,which at the time was a useful pattern for developing testable ASP.Net webforms applications. In the years since then many new patterns and frameworks have emerged and it is our desire to move the application from MVP to MVC (model view controller).

This series assumes that you are familiar with a few patterns and concepts namely the following:

  • Dependancy Injection
  • Inversion of Control
  • SOLID principals
  • MVP
  • MVC
  • TDD
  • Mocks/Stubs

(more…)

October 19, 2010

I can haz tests?

Filed under: .NET, BDD, C#, Patterns, TDD, Uncategorized, web development — Tags: , , , , , , , , , , — ang3lfir3 @ 8:47 pm

So our friend David Burela is back at it again with Developer Blog Banter #2: How do you test your applications?

Asking:

How do you organize your tests. Do you separate your unit tests, integration tests and UI tests into separate projects? Do you do anything specific to keep track of your tests? What naming conventions do you use? Do you run them before a check in or is that what the build server is for?
If you are not testing, then how would you like to test your apps if given the opportunity?

This post is my response to the above question.

I tend to have a Specs assembly for each major component of a project, these usually include some form of integration tests using in memory SQLite databases. The first thing most people will think is that I am probably mixing integration tests with my specs/unit tests and getting everything all mishmashed together. That is probably a good observation. As I find myself almost exclusively using MSpec for testing I see no real reason to separate the tests into any other grouping other than by their system components.

An example set of Test assemblies would be :

Monkeys.Core.Specs
Monkeys.Web.Specs

I did learn a few tricks from my friend @cbilson that I really liked and continue to use. That is naming the actual files in the test assemblies about the feature or part of the system we are testing. So for a group of specs that test the calculation of a bunch of distribution dates for a retirement fund based on some frequency (monthly, quarterly, annually etc) the name of the file would be “creating_distribution_dates_for_funds.cs”. This name is also used for the namespace that all the tests live in since MSpec tests are each a separate class. Groups of related tests can be found quickly and helps others that may come on to the project find the tests that describe how something works.

Okay so about those in-memory database integration tests. Well this is another thing that @cbilson and I worked on together (ok mostly him but I helped). Its certainly not a new idea , I got it from some blog post of ayende’s that I read, but it was a major breakthrough in helping us move quickly with testing and be extremely accurate. We were able to not only have nice _FAST_ tests for mappings in nHibernate but also were able to test queries quickly and accurately. Having this ability helps a lot when you want to be able to test with not only the database for your application but also for test versions of other databases you may need to access (most of our apps use at least 3-4 databases). This can make repository testing a no brainer and helps eliminate the kludgy methods people have had to use in the past. @NotMyself, @codereflection and I have even gone so far as to integrate NBuilder into the process for some scenarios making tests clean, expressive and to the point. I’m getting sidetracked I think…. testing is exciting stuff damnit!

Of course all our tests are run on the CI server and we “always” run them all before committing…. right? 😉

I would like to one day soon find a really elegant way to add some more integration testing, maybe even at the UI level, into the process. As this is very painful and hard to maintain today we do our best to test as much as we can. There is no substitution for great comprehensive QA we just hope we make their jobs a lot easier by building well designed rock solid software… that works.

Hope this covers the question and hope someone finds some value in it.

See also my response to the first Developer Blog Banter : My Technology Stack

August 2, 2010

Upgrading web projects from VS2008 to VS2010

So while upgrading a project from VS2008 to VS2010 at work I was under the impression that pretty much everything went pretty easy. That was of course until I tried running the psake build and hit the publish task.

My publish task looks as such:

   1:  task publish -depends set_prod_configs {
   2:      & $msbuild $web_proj_file /p:WebProjectOutputDir="$publish_dir\" `
   3:                  /p:OutputPath="$publish_dir\bin" `
   4:                  /p:Configuration=$configuration `
   5:                  /p:Debug=false `
   6:                  /t:"ResolveReferences;Compile;_CopyWebApplication"
   7:  }


pretty tame… but after converting this was failing with:

error MSB4064: The “Retries” parameter is not supported by the “Copy” task. Verify the parameter exists on the task, and it is a settable public instance property.
error MSB4063: The “Copy” task could not be initialized with its input parameters.

The solution while obvious took a little while to emerge. This problem seems to occur when continuing to use the .Net 3.5 version of MsBuild. However the proj files are updated to use the .Net 4.0 WebApplication targets.

  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

So the simple solution to the whole obvious problem… was… use the .Net 4.0 version of MSBuild (Duh!). I had found lots of posts saying to remove some sections of the targets files and other such suggestions. This however seemed fishy to me (plus not feasible on my CI server) which is why I continued looking for a better answer. Once I realized that the targets file had been updated then it became obvious that I was trying to use .net 4.0 build targets with .net 3.5 MsBuild.

Hope this helps someone… and so I don’t make the same mistake twice.

July 30, 2010

My technology stack

So following in the footsteps of my friend Liam I decided to respond to David Burela’s ‘What is your preferred technology stack?’ question.

By day I am lucky enough to work with the likes of @NotMyself @codingreflection and other great developers as an Enterprise Developer. Our customers are internal and the corporate preference is for .Net solutions. Our organization and management sees the value in letting developers be productive by allowing them to use the tools that best fit the job. I am proud to work with a team of developers that pushes me to improve myself each and every day.

In my day to day life I am just me, a geek with a passion for learning and all things… well… geeky.

quoting Liam I also favor tools that are :

  • are open source. Open source libraries are often designed to facilitate quality practices, not to sell tools. Also, access to the source and the price are bonuses.
  • support the software craftsmanship ideology. Small, sharp tools that stay out of the way and don’t force any design decisions.

My work stack:

web framework => MonoRail, ASP.Net MVC 2+
ui => JQuery w/ plugins, Ext JS
viewEngine => Brail, Spark, ASPX
Testing => MbUnit for unit testing, MSpec for BDD … I tend to do mostly just BDD now
TestRunner => TD.Net
Mocking => RhinoMocks. I’ve tried Moq and really don’t like it compared to Rhino
IoC => Windsor
exceptions => Log4net, we are increasing moving towards including Elmah as well
data access => NHibernate + Fluent NHibernate, SqlServer 2000
build => powershell + psake (make in powershell)
CI => TeamCity
version control =>  Git w/ git-svn
misc => NBuilder, SQLite for inmemory testing of repositories and mappings, FluentMigrator, WIX, FileHelpers, A Common lib of tools and useful bits our team has collected over time

My Personal dream stack:

web framework => ASP.Net MVC2+, RoR, Sinatra
ui => JQuery w/ plugins, Ext Js, Coffee Script
viewEngine => spark, haml
testing => MSpec, RSpec , Cucumber
mocking => RhinoMocks, some ruby mocking framework (lol)
version control => Git
build => rake + albacore where needed
IoC => Ninject
exceptions => Elmah, NLog
datastorage => MongoDb ….. pure awesome… on a stick

July 28, 2008

Specification Pattern and Lambdas

While working on my current project I decided that I had a need to use the Specification Pattern . After finding a clean implementation by Jeff Perrin I set to work creating the specifications that I needed. I quickly realized that we were going to end up having a ton of specifications and sometimes they would only apply to very special cases. Other times they would be very broad cases and they needed to be even more composable than even the fluid interface implemented in Jeff’s implementation wasn’t going to be enough. It after all still required me to create a concrete implementation for each specification, no matter how minuscule it might be.

This is the part where I thought to my self that since i was really only creating implementations for a single method that I could just write a LambdaSpecification and be able to use this for all the special cases I had.

Below is the LambdaSpecification Code:


using System;
using System.Linq.Expressions;

namespace Specification
{
    public class LambdaSpecification<T> : Specification<T>
    {
        private Func<T,bool> _expression;

        public LambdaSpecification(Func<T,bool> expression)
        {
             if(expression ==null) throw new ArgumentNullException(“expression”);
              _expression = expression;
        }

        public override bool IsSatisfiedBy(T obj)
        {
            return _expression(obj);
        }
    }
}

And the Tests:


[Test]
public void LambdaSpecification_CanExecuteSimpleLambda()
{
    var p = new Person() {Name = "Eric"};
    var spec = new LambdaSpecification<Person>(x => x.Name == "Eric");

        Assert.IsTrue(spec.IsSatisfiedBy(p));
}

[Test]
public void LambdaSpecification_CanExecuteComplexLambda()
{
    var p = new Person() {Name = “Eric”, Age = 28};
    var spec = new LambdaSpecification<Person>(x => x.Name == “Eric” &&
                                                                        new IsLegalDrinkingAgeSpecification().IsSatisfiedBy(x));

    Assert.IsTrue(spec.IsSatisfiedBy(p));
}

//Might Not be needed but I wanted to be sure
[Test]
public void LambdaSpecification_CanExecuteLambda_AndUseAndSpecification()
{
    var p = new Person() {Name = “Eric”, Age = 28};
    var spec = new LambdaSpecification<Person>(x => x.Name == “Eric” );

    Assert.IsTrue(spec.And(new IsLegalDrinkingAgeSpecification()).IsSatisfiedBy(p));
}

Comments are welcome and encouraged, especially if you see a reason why I shouldn’t be doing this. Or, if you have any ways to make this better, I would love to hear them. This is the first time I have ever used a lambda as a parameter in my own code and so far i am liking it.

Thanks to Jeff Perrin again for his post on creating a clean implementation of the specification pattern.

**EDIT: Thanks to Greg Beech for his input. I’ve updated the code to reflect his suggestions.

kick it on DotNetKicks.com

May 30, 2008

ASP.Net MVC , Visual Web Developer 2008 Express SP1 Beta

After reading ScotGu’s Blog post in regards to the recent drop of ASP.Net MVC Preview 3 I discovered that the express Edition of VWD (Visual Web Developer) 2008 should now have support for MVC projects with the improvements tht came from VSD SP1 Beta. Exciting I know! Actual support in Express editions of VS products.

I really want to give a big thank you to Phil Haack, Scott Hanselman, Scott Guthrie and the rest of the ASP.Net MVC team. The bit of screen shot below really shows the level of improvement coming from MSFT development teams. Additions like this were things we couldn’t have dreamed of before in Express additions and now… they are available to everyone to share in the MVC goodness. This particular team are definitely raising the bar on excellence and creating a new standard I hope other teams follow.

 

May 20, 2008

Dear Twitter, Scale or Die

Filed under: Argh, twitter, Uncategorized, web development — ang3lfir3 @ 5:27 pm

As many of you may know twitter is a microblogging service (wow i hate that term) that enables users to have an interactive delayed conversation in 140 char increments. Each day the issue of scalability becomes increasingly worse. This pain stems from the rise in users and traffic from a number of applications using it’s API. From desktop apps to analytical web apps twitter is finding it ever harder to keep up.

The result of the current increase in twittages (twitter outages.. and yes i made that word up) is that users are begining to look for alternatives. Scott Koon aka LazyCoder wrote about it earlier today sighting FriendFeed as a possible alternative. And I can’t remember who it was who mentioned Pownce as another alternative (ironically via twitter)[Edit : I now know it was KeithElder ]. Other options like Jaiku exist and may take over the space.

Twitter is becoming old news. Their scaling issues are like cancer, spreading fast and consuming them entirely. This much is true…. Twitter MUST scale … or DIE…

 

Older Posts »

Create a free website or blog at WordPress.com.