Tuesday, January 31, 2012

NuGet Project Uncovered: Enum Metadata Library

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

EnumMetadata.Core provides some clean extensions over enums that give you access to metadata you place on enum values. This project’s approach is to use attributes on an Enum and some fancy extension methods to get at the data stored in attributes in a strongly typed way.

I couldn’t quickly get this project up and running on my x64 machine. I received the good ol BadImageFormat exception. I didn’t take enough interest to get it working at the time, and was able to get a pretty good picture of how to use it from the tests (if I had to). Just knowing this project is here is good enough for me at the moment.

Side Note: It’s a different approach to the problem. Another strongly typed approach I tend to prefer can be found at the following Gist here. Not exactly an “enum” but gives a similar feel with access to more metadata and gives the possibility of adding behavior to each item.

Monday, January 30, 2012

NuGet Project Uncovered: VerifyArgs

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

VerifyArgs is another approach to a guard helper that takes an interesting approach.

Verify.NotNullOrEmpty(new { first, second });
Verify.Positive(new { secondCount });



Many of you might look at the above and think “But what about performance?” If that’s you, I’d have to say go test it out for yourself. But for nearly all cases out there I don’t think this level of performance is anything to be concerned with. The project’s home site has a little blip that tries to address the performance concern.



image_thumb11_thumb



image_thumb13_thumb



This project is great because of the fluent nature of each Verify.***

Sunday, January 29, 2012

NuGet Project Uncovered: Guard

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

Guard is one of the MANY projects coming out of the netfx project. (HOLY NUGET there’s a ton of these).

If you’re not familiar with the netfx project, you should become acquainted with it. Daniel Cazzulino (of Moq fame) and others have created an awesome set of add-on functionality to the .Net framework through these NuGet packages

Back to the Guard package:

Many .Net developers tend to write their guard clauses as such…

image_thumb3_thumb

One problem with this is that if you were to rename the “value” parameter you have to make sure you rename the magic string “value” in the guard check.

The Guard package offers a solution that is a little more resilient to these types of rename issues as its usage will automatically either get renamed, or if you don’t you will get a compiler error.

The below test shows an example of its usage.

image_thumb1111_thumb

If you run that test, you’ll see a nice exception message.
image_thumb6_thumb[1]

Saturday, January 28, 2012

NuGet Project Uncovered: NSpec

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

NSpec is one of many flavors of BDD framework out there. I’ve never used it, but its website looks good and has some nice documentation and examples.

What is your favorite BDD framework?

Friday, January 27, 2012

NuGet Project Uncovered: Stimpack

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

Stimpack is another project leveraging ReactiveExtensions (RX). It’s based off of ReactiveUI and has some interesting concepts for consideration with a MVVM pattern.

This was probably originally added to my To-Research list mostly because of the RX factor.

I didn’t find an good sample project on how to use it, but if you read through the fairly clean test project you can probably figure out anything you need.

Thursday, January 26, 2012

NuGet Project Uncovered: Anna

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

Anna is an event-driven HTTP server library leveraging the ReactiveExtensions (RX).

The below sample copied / shortened from the GitHub site.

using (var server = new HttpServer("http://*:1234/"))
{
// simple basic usage, all subscriptions will run in a single event-loop
server.GET("/hello/{Name}")
.Subscribe(ctx => ctx.Respond("Hello, " + ctx.Request.UriArguments.Name + "!"));
}

Wednesday, January 25, 2012

NuGet Project Uncovered: NFeature

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

NFeature looks to be a pretty solid feature toggle implementation written in .Net C#.

This project peaked my interest because I’ve wanted to try the concept of feature toggles in a project for a while now. With all the hubub last year about feature toggles vs feature branches. I’ve wanted to experience feature toggles first hand.

Tuesday, January 24, 2012

NuGet Project Uncovered: xizzle

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

xizzle is a project that attempts to give you CSS-Like selector capability over arbitrary xml. This project first piqued my interest because I hoped it would be a light weight alternative to fizzler (Somebody should put fizzler on the NuGet feed. 1.2.3 not it). Unfortunately it isn’t quite there. Maybe someday xizzle will be strong enough to compete with fizzler but at the moment it doesn’t support nearly the amount of selector syntax that fizzler does and once I started playing with it I was mildly disappointed in its selector capabilities. Was probably written to get a certain class selector options accomplished and the writer just didn’t need all that much support yet. But I think there’s some real potential for a project like this to push forward. Lightweight, all included easy syntax.

Monday, January 23, 2012

NuGet Project Uncovered: PineCone

If you are coming to this series of posts for the first time you might check out my introductory post for a little context.

I found a description from a blog post for this project:

PineCone lets you take a C# class and then builds a schema for this class. This schema contains cached members that via IL Emit extracts all simple values from the object graph. All values are turned into a StructureIndex, which is contained by a Structure. Each StructureIndex holds a Guid pointing back to the structure so that you easily can navigate to the structure again.

It’s described as a component used in http://sisodb.com/ (which itself looked interesting) and he may use it on other projects.

Sunday, January 22, 2012

NuGet Project Uncovered: An Introduction to the Series

A while back I posted about following the NuGet feed via an RSS reader. For some strange reason I’ve been reviewing this feed since then on an almost daily basis in my RSS reader. Throughout that time I’ve kept a small list of what I think are interesting projects that have put out a release since that time. Today we’re going to start a journey through projects that I’ve found during my review of the feed. Some projects are interesting because I could find a use for them, some are interesting because they are unique, and others solve an interesting problem.

Why were these packages chosen to post about over others?

There wasn’t any scientific process in place to decide what projects made this list or not but as I think back over my time reviewing the feed, below are some items that came to mind.

Some reasons I may have chosen a project:
  • I could potentially see myself investigating its usage someday.
  • It solved a problem in an interesting way.
  • Preferred small, focused, unique packages.
  • Preferred projects that were Open Source as in FREE.
    • Although I didn’t bother to look at any of the licenses so be sure to read into those before you use any yourself.
  • Preferred projects that have a “Project Site” where I could browse the source code see examples or even documentation.
    image
  • For some reason if I saw it was hosted on GitHub I preferred those to sites that had their own dedicated location (Can’t explain why – just did…)
Some reasons I may have NOT have chosen a project:
  • Tended to avoid projects that posted large numbers of packages even though many of them are still very good projects.
    EX:
    • NServiceBus
    • FubuMvc
  • For some reason I tended to stay away from anything MVC related. There are probably very interesting projects for MVC on there, but I probably avoided them because I’m not doing anything MVC related at the moment.
  • Avoided packages that had “utilities” or “common” or “helpers” in the package name.
    • But it might still be worthwhile checking out some of those open source “utility” projects. Just to get an idea of what others consider “needed on every project” and different approaches to the problems.

Some items to consider with these little NuGet gems.

  • Make sure you read and understand any license the project has before including or using them in your own work.
  • These posts won’t be full project analysis, but a generally a first impression.
  • Be sure to research any project before using. I’m only mentioning them because they piqued my interest. Not because I have extensive knowledge of the projects or know their stability.

Friday, January 6, 2012

You are responsible for making that feature work. Write a test. Just do it…

Today the PM of a project I am working on sent an email with a small list of issues that we needed to get resolved before shipping an early build to the customer for a weekly review. In his list of issues MY NAME was tagged next to a feature that I KNOW was working. I dev’d it, tested, saw it work.

Now the project I’m working on encourages unit tested code, which is a fantastic project to be on since I am a big proponent of Unit/Integration/Automated tests. Heck I wrote a tool to help run them easier (StatLight).

What I did.

The problem was this. I dev’d a feature out in like 5 minutes, took about 2 seconds to decide if I should write a unit test to prove my feature worked and this is where I failed. Manually verified my change checked in the production code without its test and I was hurriedly moved on to the next task.

About 20 min later I get a quick I.M. from a co-worker saying he had a small merge conflict in the file I just checked-in. Quickly told him how to get around his merge issue (not realizing after he checked in) that my “quick 5min dev task” was accidently removed in the merge.

What I SHOULD have done!

What I should have done was write the 2 lines of test code first. (you can argue test after/test first, I prefer test-first). Proven my code wasn’t working, by running the test, and then implement the 5 min feature making the test pass. Then when my co-worker ran into his merge issue.

Test would have failed telling him his merge didn’t go as planned.

This would have also avoided

  • PM wouldn’t have had to discover the issue, Screenshot and write up an email.
  • I wouldn’t have had to peruse source control history to understand why my “working” feature wasn’t working.
  • I wouldn’t have had to willingly confess my sins in this post.

If your feature doesn’t have a coinciding automated test. How do you know it’s still working?

Happy Testing!

 

Copyright 2008 All Rights Reserved - Revolution Theme - by Brian Gardner. Converted into Blogger Template by Bloganol dot com