Friday, March 28, 2008

How can something so good be free?!?!

I have long been wanting to take a look at the Umbraco open source .NET CMS system, and now I finally have had the opportunity to do so in conjunction with the website I am creating for my new buddies at GamingSchool. I must say that what I see amazes me. I have had some experience with CMSes in the past. I used SiteCore contracting for AlphaSolutions. Currently I am using CompositeCMS for the Clubzone.es site that I took over from another company.

Umbraco blows them both out of the water - effortlessly. Moreover Umbraco is free while the others cost huge amounts of money!

So here is a little list of pros and cons of Umbraco that I have discovered so far.

Less is more.

Umbraco may not be as fully featured as the other CMS'es. Just my guess though, haven't studied it properly. But it is so smooth to use that anyone can figure it out. And it does pack a lot of punch under the hood for developers.

Seamless install

When I had to set up CompositeCMS for Clubzone, I had to install it on my machine to get it running. Furthermore it doesn't run on Vista. So I cannot run it on my dev machine making local development impossible and debugging a pain. Getting a test version of the site running on my test server took several days of tampering to get it somewhat aligned with my build cycle. This is just plain annoying.

When I ran SiteCore it took "only" a day to get it up and running on my dev machine, but this was with the help of a long time SiteCore developer by my side. Even he hated doing it because he knew it sucked.

Umbraco comes in two flavous - install and zipped. I like the latter. Unzip. Tell IIS where'z'at. Set permissions correctly (got me at least once). Go to /install and complete a wizard. Bang - good to go. Making a test version of the site is even easier as you just copy the files over and don't have to do the 2 minute "install" part.

Great .net integration

When you want to make the more complicated stuff you use Macros in Umbraco. These can be either XSLT scripts or .NET user controls. I have always loathed XSLT for being the over-complicated non-compiled write only language that it is. So I use .NET user controls, and making them for Umbraco is so very easy that it makes you want to jump up and down with joy.

ASP.NET AJAX IN THE BOX

Now this is both a pro and a con. I am very divided on ASP.NET AJAX. Having used it extensively for "StryBergs Blå Bog", I got a love/hate relationship with it (save that one for another post). I prefer some of the more lightweight JS libraries out there - MooTools and JQuery rank highly right now. Since ASP.NET AJAX and these libraries does not go together well - if at all - I am forced to use ASP.NET AJAX. I hate that. I want a choice. I thorughly understand why this might not be very easy to do - but thats what I would like.

The pro is that you can just go ahead and use it. Drop the AjaxControlToolkit in and you're all set.

documentation?

Now this is always the achilles heel of all open source projects. And it is no different with Umbraco. Niels Hartvig - Mr. Umbraco - has even gone to the lengths of adding an easy way of writing books on the web site for everybody. But still the documentation is a cluttered half assed mess in disarray. The main source of info is in the forums. A classic. The forums are reasonably good. But could somebody please explain to me why all links on Google searches for forum posts give a "page not found"? Seems like they have reorganized their forum breaking every link in the process. Meh...

Pure "luck" that Umbraco is easy to pick up on. But it takes a while to get into developing Macros and stuff.

Just in on their blog is that Niels and newcomer Per will be focusing on improving documentation. Wise decision.

concluding thoughts

So... I may have more to add. But time is running out on me. (It is a quarter past 1 and Halfdan wakes me up at around 6).

Anyways: Check up on Umbraco. You won't regret it. I am not getting kickbacks. It's really true! ;-)

Technorati Tags:

Friday, February 22, 2008

The three project solution

Ayende just brought up the issue of project structuring, and his experience was so similar to mine that it cannot be a coincidence.

In my old job I spent a lot of time trying to "do things properly". Splitting up into a lot of logical assemblies, promoting reuse by having special helper assemblies and so on. The result was a huge amount of lugggage that each application had to carry around. When we deployed a simple windows service or console program, it consisted of 9 or 10 assemblies. And don't get me started on versioning all of these, because we were very methodical there too. It sort of worked, but only because we had build a very rigid CI monster controlled by a horde of NAnt scripts that no one - even me who wrote most of them - could figure out after two months away from them.

Today I consider that a learning experience, and I go for the "three project solution". Ayende says two, but I think having a third is worth the hassle. Especially when you create solutions that have different application components in a workflow.

The three projects goes a little something like this:

  • Application.Core : Holds all the logic and data for the solution. I split up classes in a logcal folder/namespace structure. As I favor using MVC pattern a lot, it usually holds Model, Controller, DataAccess and Helper folders.
  • Application.Core.Test: A test library for the core lib, same structure as the Core.
  • Application.<Type>: This is the application itself. The type can be Website, ConsoleApp, Service or whatever it is that I am creating. If there are more apps, there usually is, they get their own projects. All application projects have as shallow code as is can - usually only the View parts of the MVC structure.

I find that it reduces friction both when developing, but especially when deploying. Only two assemblies to deploy. No inter version dependency nightmares and so on. Simple and smooth.

Monday, February 04, 2008

Mass Salvation

Nordic Game Jam is over, and as last year, it was a hoot and a holler! Man, we had fun! I was lucky to get a great team. crew_highFour programmers, four game desginers/artists/sound engineers and a great idea. So we managed to get a full a full game up and running on the XBox using XNA in only one and a half day.

The game is called "Mass Salvation" and in accordance with the theme for the Jam, which was Taboo, is about religions. The "back story" is that it is the day before judgement day, actually 1 minute and 30 before, and humanity is a mess. Everybody is atheists and now reckognize their mistake. You take the role as a religious leader and have to convert as many followers to your cause and send them to the sweet afterlife in style.

It is played using a controller geometry wars style by up to four players. You are playing short rounds (1:30), and the pace is frantic. You can pick up and play the game right away, but as you play more, you will learn how to use the rally point to your advantage as well as different strategies for grabbing followers. So the gameplay has several levels of skill.

Below is a video of the mayhem. I will post a link to a downloadable version of the game soon. Just have to repackage it and make a ccgame version as well. So stay tuned!

Tuesday, January 29, 2008

OMG! It Rocks!

Not that I had any doubts about it. But I just tried Rock Band today, playing the guitar and drums. Man, it is fun. Why, didn't I sing? Dunno. Next time. Playing the drums was just as muc fun as I had imagined. The guitar takes a bit getting used to. It is much more sturdy and heavier than the GH guitars and has a much different feel. But it actualy feels more like playing a real guitar than GH does, much more than I had thought. Is there a flipside?! Yes, the version I have access to here two months prior to launch is a PS3 version - so no achs for me for the time being. Darn it.

Sunday, January 06, 2008

XNA Tweener library

My second open source project is live now at Codeplex - and it has a release and everything! Check it out here.

The project is a Tweener library for XNA making it easy to create animations for your games. I was inspired by the Tween class in ActionScript although it is not a direct port. All the cool easing functions from Robert Penner that you know and love are of course there, ported from the js code. So the release is functional.xnatweener

I am actually quite pleased with myself for doing this, because it has been short and focused work. The first code was created this Thursday - this was the basic Tweener class and the first ported equation as well as a very basic demo. Today (technically yesterday) i squeezed in the rest of the work, adding stuff to the Tweener class and the last equations. Then I spend some time polishing up the demo so it would look cool - getting to know my own library in the progress.

Best of all: I didn't create the library alongside a specific other project. This made it easy to focus on not making all kind of proprietary stuff and KISS. I am pleased with the result, and will use it in my games. But i find that I lack some of the fancy dynamic features from JS lacking in C# which could have made the class so much cooler - but I have some slick ideas for making it rock even more.

The project is made on Codeplex, and having tried both Codeplex and SourceForge now - I will say that Codeplex really whips the llamas a**. Or at least SF's. When I made the d20Sharp project on SF it took me ages to get up and running properly. With Codeplex it literaly took 5 minutes. And the interface on Codeplex is much better and more intuitive than the one at SF, and I won't even begin on the features... I would like the Codeplex interface for my own projects - I know it is somehow based on TFS but I haven't checked out the product as I know it is way out of my league at Gosuman pricewise. If there were a hosted licensed version out there I would probably consider it.

Anyway - download the library and take it for a cruise. Then tell me what you think. Then I will improve it.

kick it on DotNetKicks.com

Thursday, December 13, 2007

More Mocking of HttpContext for MVC

I was actually preparing this for a comment to my last post in answer to chris7's comment. But it got long. You know!

Chris7 asked if it was possible to abstract out the Record/Playback syntax in the example to make the code clearer. And you can of course do that and put the Replay call into the MockContextFactory like this:

protected IHttpContext MockContextFactory(string url)
{
IHttpContext httpContext = mockery.Stub<IHttpContext>();
IHttpRequest httpRequest = mockery.Stub<IHttpRequest>();
SetupResult.For(httpRequest.AppRelativeCurrentExecutionFilePath).Return("~" + url);
SetupResult.For(httpContext.Request).Return(httpRequest);
mockery.Replay(httpRequest);
mockery.Replay(httpContext);
return httpContext;
}


The code in the test method would then look this way:



[Test]
public void WorldDetailsRouteExists1()
{
IHttpContext httpContext = MockContextFactory("/World/Details/9/3");
RouteData routeData = routes.GetRouteData(httpContext);
Assert.IsNotNull(routeData, "There is a route to the URL");
Assert.AreEqual("World", routeData.Values["controller"], "We are using the world controller");
Assert.AreEqual("Details", routeData.Values["action"], "With the details action");
Assert.AreEqual("9", routeData.Values["x"], "And the correct x");
Assert.AreEqual("3", routeData.Values["y"], "And the correct y");
mockery.VerifyAll();
}


I actually chose the Record/Playback model as I find it nicer to look at than the other syntax. But I guess it is a matter of taste. In this example it is probably not obvious why I prefer that syntax, but for more involved mocking scenarios it makes it easier to see what is record and what is playback.



Phil Haacked also commented with a post of his own describing how to the same thing using extension methods instead. I encourage you to look at that as well to see yet another way of doing it.



kick it on DotNetKicks.com

Tuesday, December 11, 2007

Mocking HttpContext for MVC route testing

First I have to say thx a bunch to MS for releasing the CTP of the MCV framework. This really is Da Bomb. I think they are doing a great job here.

So I am setting up my first MVC.NET based site, while digging through all the relevant posts on how to use the framework. So while setting up my routes, doing the proper TDD, I stumble upon the MockHttpContext for testing routes in ScottGu's part 2. This bugger is not explained anywhere nor part of the framework. So you have to whip up your own. Googling it - lazy as I am turned up nothing. DIY time. But being the friendly coder, I will share what I made.

So without further ado - here is how you could create a MockHttpContext for testing your routes using Rhino.Mocks. Note, I have used the same way of setting up the routes as Scott is showing in his post.

[TestFixture]
public class RoutesTest
{
protected RouteCollection routes;
protected MockRepository mockery;

[SetUp]
public void SetUp()
{
routes = new RouteCollection();
Global application = new Global();
application.RegisterRoutes(routes);
mockery = new MockRepository();
}

protected IHttpContext MockContextFactory(string url)
{
IHttpContext httpContext = mockery.Stub<IHttpContext>();
IHttpRequest httpRequest = mockery.Stub<IHttpRequest>();
SetupResult.For(httpRequest.AppRelativeCurrentExecutionFilePath).Return("~" + url);
SetupResult.For(httpContext.Request).Return(httpRequest);
return httpContext;
}

[Test]
public void TestRouteRegistration()
{
Assert.IsNotEmpty(routes, "We have filled the routes list");
}

[Test]
public void SearchRouteExists()
{
IHttpContext httpContext;
using (mockery.Record())
{
httpContext = MockContextFactory("/Search/Beverages/2");
}
using (mockery.Playback())
{
RouteData routeData = routes.GetRouteData(httpContext);
Assert.IsNotNull(routeData, "There is a route to the URL");
Assert.AreEqual("Search", routeData.Values["controller"], "We are using the search controller");
Assert.AreEqual("Results", routeData.Values["action"], "With the details action");
Assert.AreEqual("Beverages", routeData.Values["query"], "And the correct query");
Assert.AreEqual("2", routeData.Values["page"], "And the correct page index");
}
}
}
kick it on DotNetKicks.com