My experience with FubuMVC so far

I’ve been checking out FubuMVC with a little hobby project. Why? Honestly, just curiosity. I don’t have much problem getting stuff done in Asp.NET MVC, but I love StructureMap, so was just curious how the creator of that would envision a MVC framework. Here are my thoughts so far. This is not me trying to post a end-all / be-all post about FubuMVC, just detailing a little of my experiences so far.

 

The good

There’s lots to love about FubuMVC. Lets start with organization. I absolutely hate the “Controllers / Models / Views” folder layout that the Asp.NET MVC project template uses. That’d be like designing a library by making the folders “Classes / Interfaces / Enums”. So out of the gate FubuMVC is directing you to something better, I feel. I opted for Namespace-per-feature. Granted, I should be able to put controllers and models wherever in a Asp.NET MVC project (not sure on Views, but probably), but with the template doing that, it’s going to be hard to do that outside of greenfield development.

I also really enjoy the behavior chains pattern. They work well and are easy to implement. I don’t know how much they differ from similar features in Asp.NET MVC like Handlers (and to an extent, ActionResults), but they’re still nice.

It took me a while to fully grok it, and while I’m not 100% there, I really dig the way routes are handled. In Asp.NET MVC, you define a pattern, which then tries to match controller actions. In FubuMVC, that’s turned around – you define your actions, then your convention for how actions are discovered, and those are converted to routes. It feels much more intentional and direct, and after using it some, it makes Asp.NET MVC’s way feel bass ackwards.

Everything, and I mean everything, is extensible. You can define your own conventions for pretty much everything. It has some great, sensible conventions baked in that will probably suit like 90% of people, and if nothing else, get you going out of the door. But when you’re ready for something different, you got the hooks to do it, typically by implementing a simple interface then telling StructureMap to pick it up.

One of the best features thought, is their diagnostics. Your site will have a “/_fubu” path. Opening it up will show you all your routes and the behavior chains wrapped around them. A great way to see why your routes aren’t working, what chains are getting applied, and a good early warning system for issues. There’s a lot more there, but I haven’t had a chance to dig into it all yet. But I love what I see. So few tools put support to the forefront like this.

 

The bad

FubuMVC bills itself as “The MVC framework that gets out of your way”. Well, and this isn’t really a fair statement but I’ll say it anyways – often times it feels like it’s out of my way because there’s nothing there. It still has some areas that left me very frustrated and annoyed.

The documentation is just sad. Their own docs are woefully incomplete with many sections left empty. And some of their examples do not seem to work as advertised. One that sticks out was their “asset pipeline”. It’s what you use to include CSS and Javascript files. There’s the very nice Bundles features of Asp.NET MVC, so I was looking for the FubuMVC alternative, and this was it. However, I cannot find a way to get it work. If I just want it to spit out the per-file link and script tags, it’s fine. But when I tried to use a combination, following what’s on their documentation, it would not work. I did not get an error (even with the option to show a YSOD turned on), and nothing gets emitted. It felt very black-box. I found a post on the FubuMVC google groups page with the same issue, with no response.

The Razor story in FubuMVC is miserable. I feel it should just be pulled. From the docs, you’ll think you can have a rewarding experience with it, but you just can’t. I followed the instructions, then had to tweak things to work with the latest release of Razor. I could not get intellisense working, which makes developing Views extremely cumbersome and “guess-and-test”. On top of that, a lot of Razor is built on the Html helpers, which will not work in FubuMVC. I assume full Razor support is possible, but it’s probably not worth it, due to how Razor was unfortunately designed (lots of static helpers, dependencies on HttpContext, etc). I think the better path is to ditch Razor altogether, and have them fully embrace and support a view engine. Perhaps Spark is that view engine? I understand FubuMVC is trying to stay open and allow people to pick their own, but seeing Razor is tempting, and while it’s not directly FubuMVC’s fault, it leaves with an altogether underwhelming experience that made me want to go back to Asp.NET MVC. Do not use Razor if you’re going to use FubuMVC. The FubuMVC examples though show returning strings of HTML, and that’s not really going to work. So I feel lost – unless the answer from the team is indeed “use Spark”.

I still have no idea how to render a partial view (or an action) with Razor, passing down a submodel. I probably shouldn’t be doing that anyways, as I thought of a better design for what I wanted using knockout templates, but it was still very frustrating. I can’t find anything in the documentation about how to do that. Probably because it all hinges on what view engine you use, and how much support it has.

 

Caveats

I don’t really like saying negative things, especially without giving the full context. So here’s some caveats I want to add in addition to the troubles I faced.

For one, I didn’t ask for help. There’s the aforementioned FubuMVC google group, that the FubuMVC developers seem to be responsive on. I was able to usually find a post there about my issue, but there was no good resolution. Still, I could’ve reached out more to make sure I’m not making newbie mistakes with easy answers.

Also, FubuMVC goes to version 1.0 in January (or that’s at least the plan). This is still a product in Alpha/Beta stage or some such. One of the things I know is coming with 1.0 is real documentation. Jeremy Miller has kinda a reputation for releasing a great product with poor docs (StructureMap), but with StructureMap I never ran into an issue I couldn’t solve with a little GoogleFu. Hopefully with 1.0 some of my issues get resolved.

Then the last caveat, that I’ve already mentioned – this is just a post of my experiences so far. I’m not saying there’s no good and easy way to do bundling and minification of CSS files in FubuMVC, for example. Just that I couldn’t get it to work after banging away for a few hours (or completely rolling my own solution). That goes for most of my “bad” notes.

 

Final thoughts

FubuMVC has a lot of promise. What’s there is mostly great, it’s what’s not there that hurts it the most (especially when compared to Asp.NET MVC). If you’re looking to start a new project for your business – I hate to say it, but my opinion is to stick with Asp.NET MVC. You’ll get things done faster, and have more resources available to you. If you’re doing a hobby project and want to learn something new…I’d probably recommend to wait until FubuMVC 1.0 comes, and see what it holds at that time. It has a lot of promise, and I think it’s headed in a great direction. Just didn’t feel it was ready for “primetime” yet. Even then though, just stay away from Razor – from what I’ve read on their group, unless someone champions it on themselves, the Razor story in FubuMVC will always be lackluster. Which is a shame, because I really like that syntax.

Designed by Posicionamiento Web | Bloggerized by GosuBlogger