Archive for the ‘OSS’ Category

MR 3 update / Castle Blade

July 18th, 2011

Fun times! Since I’ve left MS I’ve been working on a real web site/backend/frontend – you know, doing actual work instead of long meaningless meetings, doc writing and one-on-ones with managers setting you up for failure (I wonder if I should make one of my ‘reviews’ public, so you’ll see the amount of BS I had to put up with).


Anyway, the first work was to create a websockets server. That was fun especially since F# offers its async workflow support and MailboxProcessor. It’s fun to think about it. While at MS, one of my friends there wouldn’t stop bitching about how F# is incredibly superior to C#. Gosh, he was right..

The company I’m doing the work for and I are discussing whether we will make the websocket server available commercially. It’s a PITA to implement the protocols, to test them and keep up, since the spec is in progress. So, sorry, won’t be doing all this work for free.

Ideas playground

On the MonoRail end, we’ve been using it extensively and coding up functionality as needed – by we I mean Henry and I. It’s been quite a journey to reassess all the design decisions in MR1/2, and also evaluate what’s out there. I’m sure we learn more from our mistakes than anything else. Mauricio is pushing some interesting ideas on web frameworks that are making me reevaluate our proposed API over and over again. Now that I’m quite familiar with FParsec, the idea of using combinators to compose forms (formlets) is enticing. It’s just strike me as something hard to expose in C#, we would need a different API and I’m sure it would be awfully verbose.

Castle.Blade = ++Razor

I love Razor’s simplicity and tooling support. Achieving simplicity is a major accomplishment, and the guys at the ASP.NET team did it. I remember when Scott Hunter gave us a preview of what at the time was code named Plan9. Awesome work!

I’ve then decided to make Razor the main view engine for MR3. However, when I started to experiment with a better API for our helpers library I bumped into some not-so-nice limitations from Razor. For example, I wanted to be able to express something like:

 Rails |  copy code |? 
@Form.For(..., {
	// this is a block
        @builder.EditorFor(m => m.Name)

Well, Razor does support translating a mix of content and code block into a delegate – which is neat. The limitation is that they cannot be nested, and the parameter name is restricted to “item”

 Rails |  copy code |? 
@Form.For(..., @{
        @item.EditorFor(m => m.Name)

The issue is that “item” is not very expression. I’ve spent many hours digging into Razor’s code trying for find a way to work-around this limitation (by using its extension points, not changing their code). At some point it was clear that coding up my own parser and translator would be easier. Castle Blade then came to fruition.

Blade intends to be 100% backward compatible with Razor, and introduces a few (one?) different transition marks to overcome Razor’s limitations. For the example above, we would use:

 Rails |  copy code |? 
@Form.For(..., @=> builder {
        @builder.EditorFor(m => m.Name)

The @=> transition signals that a delegate will be created for the block, and the parameter name is the one that follows. In theory more than a single parameter is supported.

We also support nested blocks, which allows for the something like the following:

 Rails |  copy code |? 
@Form.For(..., @=> builder {
        builder.FormTemplate(@=> t {
                    @t.Label(): @t.Field()
        <fieldset id="contactForm">    
        @builder.TemplateFor( m => m.Name )
        @builder.TemplateFor( m => m.Email )

Feel free to give it a try.


MonoRail’s 3 goal is based on our my experience and perception of the “state of the union” and trends. If I could put them in three simple statements:

I’m mentally tired of crafting web sites despite huge functionality overlaps (combine/compose). I’m tired of REST being an afterthought to existing websites (rest support from the beginning). I’m tired of frameworks created by people without *actual* website building experience (frictionless).

The goals/roadmap/value-proposition were discussed in the past in our development list.

  • Since our underlying runtime (CLR) is keen on static typing then fully embrace it
  • Move forward: embrace HTML 5
  • Simplify special render for different form factors
  • Strive for simplicity, but no simpler

I’ll dive into what’s been done in practice to address each of the above bullets in upcoming blog posts.

Common Service Locator library clarifications

October 2nd, 2008

The goal of the CSL is not to be used in your app directly. I think we – the need came from the community and was backup by Glenn, Chris and BradA – all understand IoC quite well to come up with something that misses the point :-)

However, sometimes you’re working on an IoC unfriendly ground. WebForms, for instance. You need to access an IoC container directly from a page or web control, you cannot get it “injected” somehow. Another example is pure NHibernate. Ayende’s gave me this example a few weeks ago: he needs to access the IoC container from a custom user type. Those are the scenarios that you might leverage the CSL. Period.

Categories: MS, OSS | Top Of Page | 8 Comments » |

What are the most relevant OSS projects for .net?

October 2nd, 2008

Not a popularity contest, but if you were to elect some in some categories, what would be the names?
Here are a few categories I come up with (off the top of my head)

The only criteria I’d like to insist is: needs to be fully OSS, not a one-man show, have some people involved, have source available and with a well-know open source license (hopefully with no distinction between commercial and other uses)

Blog engines


Web frameworks

WPF frameworks

Silverlight frameworks

Unit test frameworks (including spec?)

ASP.Net tools and more specialized frameworks

Update: Scott moved this to stackoverflow. But you can still post your suggestions here :-)

Categories: OSS | Top Of Page | 12 Comments » |

Credits: be nice MVCContrib people

September 5th, 2008

I’m working on a prototype using ASP.Net MVC to build something that, well, will talk about some other day. Decided to use the MVCContrib to speed up some things (multiple view engines, ioc container integration). That’s cool. As always, the first thing I do is go through the code, testing the ground I’m stepping in, quality, design…

To my surprise I bump into things like IViewSourceLoader, IViewSource and FileSystemViewSourceLoader (namespace MvcContrib.ViewFactories). The same code (but with the license!) can be found here and here.

First this is a violation of ASL. Secondly, disregarding the legal blabber, have some common sense, kids. Give credits where it’s due!

Categories: Castle, OSS | Top Of Page | 11 Comments » |

Seducted by the evil empire?

August 29th, 2008

So kevin states – leaving out the names – that a bunch of core .net talent is being hired by MS so the projects will eventually die, and that was the main MS goal. Ludicrous. The conspiracy theory keeps on and on.

I’d like to offer another perspective, from someone deeply involved with OSS since 2002. It’s not easy to have a regular job and dedicate a chunk of spare time to create code and have absolutely no financial compensation. Ok, it’s your decision, you’re passionate about it. I know I am. I had a java full time job and spent evenings and weekends creating and trashing IoC container code in .net in my quest for an extensible design. Eventually that lead to Windsor and the MicroKernel.

In October 2006 I dared to start a company completely related to Castle, offering training, consultancy and development. Do you think I got rich? Do you think I made enough money to keep me going? Think twice.

The company is well now, but that’s more due to a shift to the financial market and products than anything else. We were getting gigs due to our speed and quality, and our clients didn’t give a s… what we were using to get it done. Castle, and any other OSS involvement, would only lead me to the path of starvation. That’s why I completely sympathize with Zed Shaw’s Rails is a Ghetto rant. People want too much: they want bugless code, they want perfect documentation, and yet they don’t want to pay a penny for any of that, nor contribute.

That’s not only on .net by the way, that’s a general developer’s position on libraries/frameworks. There are two possible escapes: if you focus on the mid tier and talk directly to CTOs (like JBoss and MySql do), or you focus on productivity tools (like JetBrain does). Otherwise, you’re doomed.

Lutz decided to sell Reflector. Man, I couldn’t be happier for him. Imagine the countless nights and weekends he had spent on that. After eight years he got some compensation. And that’s unfair? If you think so, try to live from OSS and let me know in an year or two if you have the same opinion.

Categories: Castle, OSS | Top Of Page | 6 Comments » |

Top 4 reasons to not install Firefox 3

June 19th, 2008

1 – It is buggy.

Several improvements, yeah, sure, performance is awesome, the zoom is great, but also several problems. As they – the devs – had a fixed deadline, some things slipped. I got lots of behavior problems with elements with events that are contained in a div style=”display”: none” and shown later. The app became unusable.

2 – No firebug

Enough said.

3 – No JS debugging

I rarely need to use it, but the times that I do need to track a misbehavior, it would be just impossible to do it without a proper debug.

4 – You can’t have FF2 and FF3 on the same machine.

I couldn’t find a way to have both installed, which would be acceptable. I’m sure there’s a way. I just uninstalled FF3, and were able to get FF2 working fine. Any pointers?

Categories: OSS | Top Of Page | 20 Comments » |

Migrations patch

May 28th, 2008

As promised, here it is. Some comments about the changes

- Had to change the way tables names were used on the CREATE/DROP/ALTER statements, removed quotes to allow you to define the schemas. I use Core.Comment, Tracker.Team as lot.
- Made Connection available to the migration class, as you would need it to perform sql operations using same transaction
- Introduced the SchemaBuilder
- Added support for unique keys (still need to support Defaults, though)

For donjon, I’ve also created a Castle ActiveRecord integration, so the migration reuse the connection/transaction support. It’s not nice as I would like it to be as it involves creating a SessionScope for the migration run, but works well. I’ll try to make that available in a near future.

Categories: General, OSS | Top Of Page | 3 Comments » |

Stay away from open source!

March 10th, 2008

Quoting this

Although there are many containers(, PICO , Castle Project), as always Microsoft PNP( Patterns and Practices team) has done a good job in incorporating this component in there Application blocks that way you don’t have to run for another open source component.

Huh? What’s the harm I’m missing?

Categories: Castle, OSS | Top Of Page | 14 Comments » |

GWT on Leopard

December 5th, 2007

I really couldn’t anticipated that a bug could have sparked such a long thread on an issue tracker. Seems that the problems lies on Apple’s Java UI libraries (Carbon?).

Not long after bumping on this bug I gave up on GWT. I guess it wasn’t a good first impression, albeit now I realize it wasn’t their fault. I bought the book, though, and read half of it. It’s interesting, but somehow extremist. I think the perfect solution is in something between GWT and Script#… wish I had the time :-)

Categories: Apple, GWT, Mac OS, OSS | Top Of Page | No Comments » |

NHibernate error messages

November 30th, 2007

Those are just from today:

1. Can't write to a readonly object

No meaningful information on the call stack, not a single clue. Would it hurt to tell which object is marked as ReadOnly?

2. Could not instantiate cache implementation
Inner exception: Second-level cache is not enabled for usage [hibernate.cache.use_second_level_cache | hibernate.cache.use_query_cache]


3. StaleObjectException

Note that I'm not using version/timestamp. Turns out that there was a call to update when it should be a call for Create.

Ayende recently blogged about Castle style errors. At least the more important ones try to tell you what happened, why and how to fix it. I decided upon this path due to two things

1 - When I used to work with Visual C++, most error messages included a clue "did you forget to turn option foobar?". Those were very helpful.

2 - In the early days of Castle I was setting up a project for a new client and everything collapsed. I had only an odd exception that didn't tell much. From that day on I vowed to never let that happen again. Can you imagine looking clueless in front of a client dealing with a project that you're supposed to know everything about?

NHibernate goes in other direction. Maybe they want that every user digs on the code base, become NHibernate hackers, or they just want to challenge you to make your life more interesting. I guess next version will include riddles with every error message: "Stale object exception: what gets wet as it dries?"