Author Archive for ‘ Michael Herndon’

Ramping Up .Net For BDD and Unit Testing With Gallio, NBehave, and Moq

Posted Wednesday, March 19th, 2008 by Michael Herndon

Unit Testing is a word that has inspired some or has become a bane for others. TDD, test driven development, has changed the way many people write their code, and others… not so much. Then a new catch phrase appeared on the test scene, BDD, behavior driven development. So instead of tests, you’re writing specifications of expected behaviors and observations in code, that will also hopefully create your specifications documentation for you. Also there is this notion of doing story boards as well.

Ruby has Rspec built ontop of a well oiled web application framework known as Rails. So where does leave .Net developers, especially with the Asp.Net Mvc Option/framework on the horizon? I’ve been keeping an eye on .net tools that would allow or be the Rpec for .net. Things like NSpec and NBehave popped up on Google, but there was really no documentation, read me’s or even blog postings to demonstrate how to use these libraries. However a cool mock library named Rhino mock became the rage to heal the pain of NMock (but geeze man, all that "Replay" stuff is confusing, totally ignoring the KISS principle). And MbUnit, a unit testing on crack, which built on top of other Xunit frameworks, seemed to be stagnated.

Enter 2008, the year of open source and openness for developers of .Net. MbUnit has been hard at working on Gallio, the neutral test platform, NBehave has merged with Nspec and Behave# and have an April 4th release date, but you can still play with the bits. Even Microsoft is doing the release often and having open input on the Asp.Net Mvc framework. A new cooler mock framework has come out known as Moq that uses the c# 3.0 extensions and lambdas, which Scott Hanselman gave a great overview about.

(more…)

IE 8 Beta 1 Released at Mix Keynote

Posted Wednesday, March 5th, 2008 by Michael Herndon

IE 8 Beta 1 will be released after the keynote, which is still currently going on as I write this. IE has been play catching up of late, but it seems IE 8 has not only caught up, but is now pushing the envelope with user interaction with the browser, that just might make the browser loveable again.

IMG_0839

(more…)

Arriving At Mix 2008 (Las Vegas)

Posted Wednesday, March 5th, 2008 by Michael Herndon

Technically its 4am EST, but here it’s 1am (and I pretty much live on a west coast clock, even though I was born and raised in Va), which is prime nocturnal developer time to get something productive done without interruption. So I’m sitting at the Starbucks at the Egyptian style Luxor hotel here at the 24 hour Starbucks (take notes Charlottesville, we need more 24 hour places for geeky people like me. Even Richmond had a 24 hour gym that was like almost a quarter of the price of the local gyms that close at 9 PM in Charlottesville), hearing the rambling of someone to spout something that resembles a cheesy pick up line and echoing of random strangers walking by.

IMG_0827

Mix 2008

But lets face it, the real reason I’m here is to find out all about the new and upcoming technologies that will hopefully make life easier not just for the developer, but you; the reader, the end user, the client, the father, the single mother, the person in the daily trenches that keeps things running smooth.

Unfortunately, new technology does not always lead to make your life easier, in fact it often makes you dependent or duplicate processes that should other wise should be done once. Or maybe you are in that organization that hacks together things so you’re ending up duplicating data in multiples places, chained to your cell phone that was supposed to bring you freedom, and using the latest and greatest software that is seriously lacking in features.

However, the developers at osc (opensource connections)  strive to use technology for the benefit of our clients and end users, and find ways of using new technologies to fill in the gaps that old technologies or bad design often leaves behind.

Tomorrow Microsoft is supposed to unveil the uber secret workings of IE 8 (Internet Explorer 8), have a keynote that includes Ray Ozzie (the guy replacing bill gates at Microsoft), Scott Gutherie, and Dean Hachmovicth.

(more…)

Css Fury: Part 2 Adjacent Selectors, Transverse Dom With CSS

Posted Friday, February 22nd, 2008 by Michael Herndon

Read Css Fury: Part 1 the star/asterisk selector

One of the "wicked cool" but rarely used parts of CSS selectors is the Adjacent/Sibling Selector . IE 6 does not support this selector. However IE 7, Firefox, and Safari browsers do support this feature. So using this selector can be a good way of using CSS styles to enhance the visual experience while degrading gracefully in older browsers (which gives the user a good reason to update to one that does support CSS 2.1, without affecting the functionality of a site).

An Adjacent Selector basically allows you to select sibling nodes within a given node of the DOM. An example of what an adjacent selector looks like is below.


//css
p + p {
    background: #ccc;
}


// html
<p>I am paragraph one with a normal background. </p>
<p>I am paragraph two with a slightly smoke gray background. </p>

(more…)

Some OpenSource Ideas for .Net

Posted Thursday, February 21st, 2008 by Michael Herndon

Have you ever felt there is just simply not enough time in the day to get around to doing everything that needs to be done. It’s possible that you may be reading this blog posting totally clueless about what is going on .Net (Microsoft’s solution to "write it anything you want, c#, ruby, vb.net and it works on windows platform"). Well the big MS has dumped a ton of new technologies(while some are totally not new concepts) and Projects and there is more to come. From Linq (Language Integrated Queries) to WPF which all vector based graphics over the typical pixel based windows forms, to Asp.Net’s MVC add on project (which is very rails like, no surprise there) to SilverLight, and even supporting projects like Iron Ruby. And there is no slowing down in sight.

(more…)

Css Fury : Part 1, The * (star/asterisk) Selector

Posted Sunday, February 10th, 2008 by Michael Herndon

CSS 2.1 which is supported by Firefox, safari, and almost completely supported by IE 7, has what is known as the selector syntax. However IE 6 only supports a minimal amount of the CSS selectors, with that being said, you should use selectors wisely in such a way that degrades gracefully in older browsers.

Even though CSS have been around for a while, there are people are still using tables for layout design. However the ones forwarding the web, with use of a div layout, are finding new ways and combinations of CSS which results in very cool results. For instance, zeroing out every element on the page with a few lines of code. This does work in IE 6.


* {
padding: 0;
margin: 0;
}

(more…)

Ruby-like Hash in C# (sharp)

Posted Tuesday, February 5th, 2008 by Michael Herndon

One of the things I like about ruby is that you get more done with less typing, and though c# is a powerful language, I’ve been wishing for a ruby like hash and even array initializers. I’ve been spending some time doing an ruby on rail’s active record port to c#, and lately i’ve been porting over the rail’s migration ( I even have a prototype working with SQL 2005). However, one thing heavily missing from the c# recipe is the Ruby like Hash for doing migrations. So after some research on the web, I found Alex Henderdon & Andrey Shchekin’s ruby like hash function for c#. However this didn’t exactly take this concept all the way as it could have, so after some tweaks to a Dictionary>string, object< class, simple ruby like hash for C# now exists and works fairly nicely, as you can see from the code example below. (Taken from the tests project).


     Hash h = Hash.New(Name => "Michael Herndon", Age => 10, Url => "www.myspace.com");
     h["Name"].ShouldBe("Michael Herndon");
     h["Age"].ShouldBe(10);
     h["Url"].ShouldBe("www.myspace.com");

I’ve also packed up Andrew Peter’s Inflector.Net using C#’s mixins. Infector.Net is based off of the class rail uses to do things like camelize, pluralize etc. Also I’ve put together some other rails like mixins like .Gsup, .Merge, .Each. Collect, .Join, for people to enjoy. If you want to take a peak at code, its on the amplify-net googlecode project inside the folder Framework/Amplify.Linq folder.



     svn checkout https://amplify-net.googlecode.com/svn/trunk/ amplify-net

     url: http://code.google.com/p/amplify-net

In the Lab: Amplify.ActiveRecord (porting ruby to c#)

Posted Thursday, January 24th, 2008 by Michael Herndon

I’ve been secretly working on an active record type of port as a part of the Amplify Framework. The release of the ASP.Net MVC framework along with an MVC/MVP/Rails has really pushed me in that direction. So far there is both Subsonic and Castle’s MonoRail which ports a significant amount of code into .Net. However a lot of Rails like paradigms are somewhat lost as everything seems to be extremely object oriented versus using strings or even api calls. (Though MonoRail does have a very cool Inflector class which is a port of methods like pluralize & humanize, etc.

So basically I’m prototyping using Linq as the base for making queries at this point, and plan to then use the same API to do an adapter that uses ADO.Net, and hopefully this will go hand in hand with the new ASP.Net MVC framework. If you want to play with the alpha stage bits (with no warranties of code compiling at any given time as this is a prototype) then feel free to download from the projects new home.

svn checkout http://amplify-net.googlecode.com/svn/trunk/ amplify-net-read-only

(more…)