Tuesday, 3 March 2009

Progressive.net workshops. Register now, save hundreds.

Just a quick reminder. My some mistake of history, I’ve been asked to deliver workshops alongside Ayende, Scott Bellware, Hammet, Mike Hadlow, Ian Cooper, David Laribee and Robert Pickering. I have to admit I’m very anxious to be surrounded by such people! Anyway, it’s going to be an absolute blast and extreme experience for anyone taking part.

I’ve just been reminded that if you register before the 4th of March, the 3 days of training will cost you £525, and before the end of may £700.

So if you care about all things progressive and the great speakers that will be presenting (and me), make your way to SkillsMatter and book now!

Monday, 2 March 2009

European VAN - OpenRasta

Last week, I got given the opportunity to present OpenRasta in the European Virtual Alt.Net meeting. It was a blast, thanks to Colin and Jan for organizing it!

And you can now have a look at the screencast on vimeo. OpenRasta’s code-freeze is happening this week, which means a week or two more to document, update the site and publish the first binaries. And this will include a retake of this screencast that *actually* works at each step :)

Speaking Agenda

It’s been an exciting weekend. Thanks to a few prople with webcams, those of us that weren’t in Seattle have been able to follow some of the discussions at the alt.net seattle conf and discuss about them. You can see the recordings yourself from Ben and from Scott. Makes not being in Seattle nearly bearable.

The great other news is that you have voted for my asp.net MVC best practices talk at both DDD Belfast on the 4th of April and DDD Scotland on the 2nd of May!

Here’s a recap of where I’ll be in the next few months:

  • 3rd April – Agile Belfast - When agile goes bad: how to stay calm and move forward
  • 4th April – DDD – Belfast – asp.net MVC best practices
  • 15th April – VistaSquad – London – asp.net MVC Introduction (although this may integrate parts of the best practices talk)
  • 18th April – WebDD 09 – Reading – asp.net MVC best practices
  • 22nd April – Gl-net – Gloucester - When agile goes bad: how to stay calm and move forward
  • 2nd May – DDD – Glasgow – asp.net MVC best practices
  • 5th May – VBUG – London – Discovering OpenRasta
  • 11th May – SkillsMatter’s Progressive .NET workshop – London – OpenRasta, an MVC Framework
    While MVC frameworks are gaining acceptance in the .net world, few leverage the full richness of web technologies. OpenRasta was designed from the ground-up to embrace them, while providing for a very large amount of extensibility. In this workshop, you'll learn what resources are, how to design your code around them and how to leverage REST.
  • 14th May – SkillsMatter’s WebTech Exchange – London – REST, an introduction, followed by REST ARCHITECTURES WITH OPENRASTA

There you go. June should hopefully see me going a bit more around the country. If you want me to speak at one of your user groups, hint at your UG leader ;-)

Friday, 13 February 2009

Alt.net London Beers #6

We’re going back to the original schedule of last Tuesday of the month. Here’s the excerpt from the ning site (on which you should go and register right now to let us know how many of you will be coming).

This month, TeQUILA\UK host us and ThoughtWorks will feed us! That means free pizza, thanks guys!

An hour-long timeboxed openconf-style session where the one subject being discussed will be chosen by the attendants. And of course all this in a pub environment, fueled with just enough beer to make everybody participate.

The event is from 6pm and we start at 7:30pm sharp (ish).

Hope to see you there.

Thursday, 12 February 2009

DDD voting is open!

There are now two DDD events you need to vote for.

I have submitted some session to the three events, so if you want to see me rant, vote for my sessions!

Monday, 9 February 2009

Update on the Two-Tier Service Application guidance

Following my recent analysis of the Two-Tier Service Application Guidance, the P&P group contacted me and others to ask if we’d be interested in giving a hand to fix the guidance. Contrary to what I wrote on the original analysis, it’s not a beta 2 (the AppArch guide is, but this is not part of it).

So far, it looks like three different options are going to be pursued:

  1. Fix the existing document and keep the proposed architecture
    I  am contributing what I can to get the specifics of REST fixed so the REST bits are accurate. I however disagree with the general architecture (this guidance is not a resource-oriented architecture but a service-oriented one on which a REST-friendly facade is added) and won’t recommend following that guidance.
  2. Create a new guidance that is compatible with best practices that alt.net promotes
    This part is about using a different solution, which I hope will have a strong resource-first vibe. I’ll probably provide a version using OpenRasta.
  3. Create a DDD-specific guidance for Domain-Driven-Design approaches
    This part I won’t take much part into.

That’s the current thinking. P&P has been fairly responsive and open to criticism on the document, which has been positive. There’s been a lot of discussions ar0und terminology, and I believe those discussions are important to have, because terminology is what we use to communicate with one another.

We’re working towards getting the main issues fixed, and I’m hopeful that, once this is all done, we’ll have made those documents useful and accurate. Hopefully, next time there will be an outreach before publishing a draft. I’d also rahter the word draft was used instead of beta, but that’s splitting hair so I’ll stop there :)

Saturday, 7 February 2009

Agile and Scrum failure stories

Dear fans and readers,

I’ve now started writing a talk entitled Top tips to ruin your agile process. It is my intent to run the audience through the worst things that could happen to a team when they implement agile.

I have a fair share of miserable failures at turning (or keeping) a team agile, but I am now asking you to help me. Everyone has failed once or  more in being agile, and I hereby plead for you to give me your horror story.

Feel free to do so below, the comments can be made anonymously :)

Thanks!

Saturday, 31 January 2009

Apparently Glenn Block distributes malware.

[Update: What I thought was an individual funny incident was in fact for the whole internet. See the The Register article about the snafu.]

We know that the MEF guys are a bit wicked, but that they would distribute malware is way over the top. If you don’t believe me, look what Google just showed me.

Glenn Block distributes malware

Monday, 26 January 2009

We did warn you…

Received in my inbox today from an ex-colleague. This made me smile.

Subject: ARGH THE FUCKIN ENTITY FRAMEWORK!
Received: 29 January 2009

What a load of s******t
Sorry had to get that off my chest...

 

Received: 26 January 2009 11:27

Lead Dev - "Oh it's really good you just drag and drop your tables on and it creates all your classes for you"
N - "F********* OFF"

 

Received: 26 January 2009 13:08

Just spent the last 2.5 hours hand editing some XML.  Probably due to a bug in the "designer" but who knows.
Bring back NHibernate :-(

No comment.

Sunday, 25 January 2009

How to fix Microsoft’s Two-Tier Service Application Scenario (REST)

Microsoft has released a beta version of a guidance talking about REST in 2-tier applications. I’ve had many rants about Microsoft’s attitude towards REST and the marketing branding they put on (some teams being much worse than others by arrogantly or unknowingly putting the word REST on the name of their framework).

This entry is no such rant, but an effort to outreach to the authors. The document has issues, but it is my belief that with the right corrections, it could be made accurate.

Of the importance of patterns

First thing come first, let’s talk about patterns. Here’s the definition for design pattern from Wikipedia.

A design pattern [..] is a formal way of documenting a solution to a design problem in a particular field of expertise.

From this, we would expect a pattern that is referenced or talked about to have been documented, contextual to a field of expertise and used to solve a design problem.

Let’s review what patterns are referenced from the document, as it will help us later to analyze the proposed guidance. Whenever a pattern is provided without references, I either assume the first documentation of a pattern as applying, or try, as a reader would, to google it and find what it could mean.

The router pattern

I assume this mean the pattern by which a URI is mapped to a component processing the request. My searching has returned an IBM article defining the router pattern as “[…] routing requests to specific pieces of business logic based on some defined criteria”. Anyone trying to search for the router pattern will be inundated with various definitions and hundreds of sub-patterns (content-based router pattern, dynamic router pattern, etc). By failing to reference which variant of a pattern is being included, and where the documentation for such pattern is located, a reader will be none the wiser. And they are, after all, looking for guidance.

The proposed fix: either reference which pattern is being talked about, or document what use you refer to.

The REST Entity pattern

A quick google search for “REST Entity pattern” will return only two results, the first one being the proposed guidance, and the second one being a presentation by Ganes Gunasegaran on a site called sagework, available as a pdf. That presentation does provide one slide defining the pattern as follows.

  • Resource can be read with a GET operation
  • Resource can be changed only by PUT and DELETE operations

Now further detective work returns a MindTouch page defining the Entity pattern. Reading the rest of Ganes’ presentation, it becomes very obvious that the rest of the patterns he presents are just pulled out of the MindTouch REST patterns page. And reading the description of the patterns in the Microsoft document, you will also notice the exact same definitions.

We now have a documented pattern, within the correct field of expertise, aka MindTouch. However, a quick search for the use of this pattern being referenced outside of MindTouch’s web presence returns very little. Furthermore, it doesn’t define the problem it is designed to solve. I would question the validity of such a pattern.

The proposed fix: again, reference the correct pattern you intended to include to start with, and keep it’s original name. In this specific instance, also make sure that this pattern matches the definition of what a pattern is, or redefine and document such a pattern yourself (or get the original authors to do it).

The entity translator pattern

This one is defined by Microsoft themselves, in the context of web services:

Implement an entity translator that transforms message data types to business types for requests and reverses the transformation for responses.

The Facade pattern

See http://en.wikipedia.org/wiki/Facade_pattern, “A facade is an object that provides a simplified interface to a larger body of code, such as a class library.” or P&P Pattlets “Provides a unified interface to a set of interfaces in a subsystem. Facade defines a higher-level interface that makes the subsystem easier to use.”

The Repository pattern

Fowler:  “A Repository mediates between the domain and data mapping layers, acting like an in-memory domain object collection.”

Domain Entity pattern

A google search on Domain Entity Pattern triggers an interesting result, from the same authors as the proposed guidance: Three-Tier Web Application Scenario. If you have a look at both, you will see that a lot of recycling between the two guidance documents has happened. Now of course, neither documents match our definition of a design pattern. An obscure page on wikipedia says that domain entities “are a super-set of Data Layer Entities or Data Transfer Objects, and may aggregate zero or more DLEs/DTOs” which I’ll consider compatible with the P&P definition. The naming is however confusing, and not widely in use.

Quick fix: If you want to use the same definition, aka “A set of objects modeled after a domain that represents the relationship between entities in the domain but do not contain behavior or rules related to the entities”, call it what the rest of the world calls them: an Anemic Data Model. If you are happy with the anti-pattern but are worried that it may reflect badly on the practices you suggest, call it a Data Model. If what you really mean is that it’s a DTO with the same definition as wikipedia, call it a DTO and change your definition to match what a DTO is.

Lets review the guidance

Now that we’ve cleared out the confusion introduced by the guidance document’s use of patterns, let’s review the various layers and how they relate to REST.

The lack of context

The first thing that strikes me is the complete lack of any references to recognized litterature introducing REST. If you’re going to talk about an architecture, just like with a pattern, you *have* to provide the references.

Fix: Introduce REST and Roy Fielding’s PhD thesis. Provide links to well-known restafarian web-sites, such as the excellent http://restpatterns.org that provides guidance in implementing rest architectures.

The routing

In a RESTful architecture, everything is mapped as a Resource. This is the thing you want to operate upon. Anything can be a resource. For the sake of this entry, let’s imagine that I define a resource as being my computer’s hard drive, the physical hardware equipment that sits inside my laptop’s case.

To be able to operate on a resource, I need to be able to address it. And in REST, I can do so by giving it an identifier. In the case of HTTP, this is a URI. Let’s give a URI to my hard-drive: http://www.serialseb.com/harddrive/fujitsu.

If I type the Uri in my browser, said browser will send an http request to my server. The server is now responsible for knowing what the heck it is that I want. This process is called URI dereferencing. It’s a big word, but it is what it is and what the common definition is. It’s the process by which a URI is matched to a Resource.

It is assumed that a handler will be responsible for doing this dereferencing process. Once the resource has been dereferenced, it is time to do something with it, and this is what an http method such as GET or POST does. It defines the operation that is to be done against the Resource.

We now have the elements to understand what Microsoft talks about when they mention the Router idea. In their scenario, the router uses both the Identifier and the Operation to call some bit of code, commonly referred to as a handler. It is a sad fact that Microsoft chooses, in a REST document, to disregard completely the existing and meaningful descriptions of a web operation.

Resources, representations and the “REST entity”

Let’s say that I want to add a song I just heard on the radio to my hard-drive. As you probably know, music is heard because the air between the singer’s vocal chords and my tympanic membrane vibrates. This vibration gets turned into an electrical signal and gets processed by my brain to let me make sense of the words that were transported as a vibration. When talking with a human, I would identify the song I just head as “If you seek Amy from Britney Spears”. If I talk with a computer,  I may need to assign it a name too, so let’s do that. http://www.britneyspears.com/songs/ifyouseekamy.

As far as I know, my hard-drive cannot persist air vibrations to disk. We need a binary stream, because that’s what hard-drives can persist. That binary stream would probably be an mp3 downloaded from a music service. This byte stream is not the song itself (as in the air vibrating), it’s a file in binary format that my computer can process. If the song is a resource, the mp3 file is a Representation of that resource.

What this means for my adding that file to my hard drive is that to download the song, I would need an mp3 file. If I dereference the URI for the song, I may get a representation of this song as an mp3 file. I never transmit the resource itself.

This is why REST is called Representational State Transfer. Now that I have my file, when I want to add it to my hard drive, I could do a POST to http://www.serialseb.com/harddrive/fujitsu and include the Representation of the song. I have effectively changed the state of my resource (my hard drive, the physical thing) by sending it a representation (the mp3 file).

Microsoft says “In REST a resource is an object that represents a specific state”. As you can probably tell by now, my hard-drive doesn’t represent a state, it has a state because it is a resource. I changed it’s state by sending it a Representation. I didn’t sing to my hard-drive to make it persist an mp3.

Quick fix: clear-up the definition to “In REST a resource is a thing that can have state. You can change that state by performing operations on the resources through transferring representations.” You can probably make it more obvious by stipulating that you recommend your business entities to be your resources, acted upon by a representation (your DataContract).

Furthermore, remember that MindTouch’s definition of a REST entity that Microsoft has included is defined A Resource that gets modified only through PUT and DELETE.

We’ve seen that a representation has by definition no behavior, as it is only a byte stream, and cannot be operated upon. Because Microsoft has specified that their use of the word REST Entity is a representation of a resource, it becomes obvious that they have wrongly applied the pattern proposed by MindTouch, which applies to resources.

Confusing resources and representations is a common problem for people new to REST, and one Microsoft has fallen into.

Fix: Drop the Entity (REST) naming. You have misunderstood the original meaning of the pattern. What you are talking about is a Representation that you would probably advise to be a DataContract.

Finally, we reach the Entity Translator. Microsoft proposes that such a component “translate[s] between business entities and REST entities exposed by the service”. We’ve now seen that REST entities are in fact representations. What is proposed here is a component that can turn a resource (aka the business entity) into a representation (aka your DataContract).

It is not surprising then that the definition “Resources exposed by the service represent an external contract while business entities are internal to the service” is inaccurate.

Fix: “Resources exposed by the service can only be retrieved and modified through Representations, which represent an external contract”.

And indeed, translators are required to move data from one format (your representation) to another (your business entity as an object living in memory).

The business layer

I won’t comment much on the architectural choices of Transaction Scripts and Facades, I have little interest in entering this debate. I will however take note of the definition of the service implementation (which, as we’ve seen, is usually called a handler):

“The service implementation is responsible for translating between external contracts and internal entities and then passing the request on to the business layer façade.”

This seems to indicate that the facade deals with external contracts, but the Entity Translator has already been introduced to deal with such a translation. This seems redundant and is probably a mistake.

Furthermore, if a business facade implements the logic of acting upon a business entity, and the translator maps between datacontracts and business entities, it would seem to me that you’d end up with an anemic service implementation. The only reason I can think of is to map Resource operations to business processes.

While I think such an infrastructure is redundant, here’s a proposed fix: “The service implementation is responsible for mapping operations on resources to business processes in your layer facade.”

Do we really need Messages?

I’m very confused by the proposed implementation of the business layer.

REST over http is often considered to be a Resource-Oriented architecture. The first, if not the most fundamental, design issue you will face is modeling your resources well. Like any domain modeling activity, this is not an easy process to get done right.

Provided you have thought of your architecture in terms of exposed resources, you then spend some time defining your representations, aka what goes on the wire. As we’ve seen, that will end up being your DataContract design.

There is a lot of inherent knowledge in resource instances: they have al the information you need to process your request. When I send a POST to http://www.serialseb.com/harddrives/fujitsu, the request contains the representation of the file I want to persist, the location in which to persist it. Nothing outside of that operation is required for the processing of the operation to happen.

Why then would one wrap the notion of adding a file onto a hard-drive into a message, pass it to a facade that dispatches the message, to finally get processed by an operation that reads the message to act upon data structures?

Any time you convert between various data structures, you introduce more complexity. Anytime you de-normalize and renormalize, you introduce potential bugs. The proposed solution does the following:

  1. Get the request, and transform the datacontract into an instance of the business entity
  2. Encapsulate the business entity into an untyped Message and pass it to a Facade
  3. The facade reads the message to dispatch it to a process
  4. The process opens-up the message to get back to the business entity in the operation and call the entity framework.

You have achieved absolutely nothing by having a facade. All the data that was required to dispatch the request to a business process was already in the service! You end up with an anemic service that does little if nothing, a business facade that’s not really a facade but a broker, and a business process that has to open-up the encapsulation format for no valid reason at all.

As this document is supposed to be a guidance as to best architect a solution, the proposed solution is just not acceptable. Proposing an anemic service is a symptom of a bigger problem: the guidance doesn’t talk at all about resource modeling, and assume that there will be redundant services mapping to the same business process, aka two services doing the same thing.

It looks to me as trying to slap a message oriented architecture in which the endpoint receives a message to be processed, on a resource-oriented architecture in which the endpoint is the resource on which to apply an operation. The semantics of a resource-oriented architecture eliminate the need for message dispatching.

Proposed fix: Get rid of the business facade as is, and let the service call the business process itself. The message is redundant.

Bad practice: Promote(object[] data) is just bad practice as you’ve now removed any single bit of semantics that were associated with the process.

Alternative fix

There is a simple alternative fix that can be applied to the document, by removing the REST references and describing it as a POX architecture.

Conclusion

I do not know if this guidance is the result of an incomplete understanding of REST architectures (which is quite widespread in Microsoft’s literature) or an attempt at over-simplification.

What I do know is that much needs to be modified before this document can be proposed as a best practice for delivering a RESTful solution. It lacks the proper and accepted terminology, completely bypasses architectural concerns around resource modeling, misrepresent what a REST architecture would look like. It also ignores caching (one of the REST constraints) and proposes an architecture that would make leveraging such caching difficult.

I also call for P&P to involve the communities that have formed around topics such as DDD and REST when they deliver beta versions of their guidance documents. Those errors I’ve highlighted could have been taken care of much earlier in the process, and save me the 5 hours I spent this afternoon writing this blog entry. That this is considered a beta 2 is however completely unacceptable.

Hopefully we will see an updated version of this guidance. If not, hopefully my blog entry will have enough google juice to start fixing the inaccuracies that Microsoft seems to spread about REST way too often.

Tuesday, 20 January 2009

Does history repeats itself?

I’ve been following Opera’s reactions to the EU antitrust regulations against Microsoft’s bundling IE in windows, which they have been calling for…

Anyone remembers what happened last time a browser vendor tried to leverage antitrust laws to explain their sinking (or in the case of Opera, their fairly constant and unimpressive) market share? No?

Bah.

Monday, 19 January 2009

User Experience is not only about the nice logo…

image

Enough said me thinks.

Wednesday, 7 January 2009

Alt.net Beers #5 – 12th of January (yes, I know it’s next Monday…)

With all the festive excitements, I really thought I had announced this when I put the date down on http://ukdotnet.ning.com but I obviously didn’t.

So as (nearly) every months, we’ll be holding our monthly alt.net meeting in Soho next Monday, with tester extraordinaire and dynamic language addict Ben Hall. Please register on http://ukdotnet.ning.com/events/altnet-london-beers-5 so I know how many of you to expect. We also usually wait for everyone to have arrived before starting, and if you’re not on the list we can’t start!

The format is a mini openconf-style session. Here are the rules, slightly changed to learn from the previous event.

  • Arrivals, discussion and socializing between 18:00 and 19:15, with one necessity: find the topic of the day and find the questions that we will try to answer.
  • Between 19:15 and 19:30 we will vote on the subject we want to talk about, in two rounds, by raising hands.
  • At 19:30 the big clock will start ticking for a time-boxed 60 minutes workshop on the subject. The goal is simple: can we as a group get insight and progress our understanding of the problem
  • If the subject stales, the subject can switch to a new one, the second down in the list of votes.
  • At 20:30 the clock will ring and that will be it of the conversation. We’ll do a roundtable of each person where I’ll be asking you to decide of an action you’re going to take based on the discussion (something new we didn’t do until now).
  • Then everyone will write it down for wiki publication, everybody will be able to continue the discussion in the pub or wherever they see fit.

The location

We should be able to hold our reunion at the Tequilla lounge bar, like last time. I’ll have confirmation tomorrow, and if not I’ll announce here a new location.

Tuesday, 6 January 2009

Fluent-nhibernate and nvarchar(max)

As you may know, text and ntext types are being depreciated in sql server 2005+, and replaced by varchar(max) and nvarchar(max).

If like me you rely on nhibernate to generate your database, the trick for getting nvarchar(max) is to set the length of the field to 10000. I wrote a small extension method to do this.

    public static class PropertyMapExtensions

    {

        public static PropertyMap WithMaxSize(this PropertyMap map)

        {

            return map.WithLengthOf(10000);

        }

    }

I use the automapping functionality, so this is what it then looks like.

            AutoPersistenceModel.MapEntitiesFromAssemblyOf<Movie>()

                .Where(t => t.Namespace == (typeof(Entity).Namespace) && !t.IsAbstract && t.IsPublic)

 

                .ForTypesThatDeriveFrom<Movie>(x =>

                {

                    x.Map(m => m.LongSynopsis).WithMaxSize();

                    x.Map(m => m.Notes).WithMaxSize();

                })

                .Configure(configuration);

And if you’re interested in all things fluent-nhibernate, why not come and listen to my talk about it on the 22nd of January at SkillsMatter?

Sunday, 4 January 2009

Using extension methods on null objects

One feature that is often disregarded in extension methods is that they get called for null objects. While instrumenting parts of OpenRasta, I faced the problem of having some classes not always created through the container. As such, sometimes their Log property would be null, and each call to a logging method would have to check for that condition. After doing a few back-and-forth, I settled on using an extension method, coupled with a null object.

Take a simple class, and add a Log property.

public class LoggingClass

{

    public ILogger Log { get; set; }

}

Then, create a simple extension method on the ILogger, and return a null object

        public static ILogger Safe(this ILogger logger)

        {

            if (logger == null)

                return NullLogger.Instance;

            else

                return logger;

        }

Now all the logging code can simply call the Safe() method to ensure that, in the absence of a logger, a null object will be used instead. The code using it looks like the following.

        public void DoSomething()

        {

            Log.Safe().WriteDebug("I did something!");

        }

Voila!

Friday, 2 January 2009

OpenRasta status update

This entry may be outdated. For the latest updates on openrasta, see www.openrasta.com.

Already a month since the last updates, and I’ve been churning quite a bit of code. Most of it has been to finish extending the support for multipart types, which was blocking a couple of scenarios (html file upload and silverlight bidirectional http being the two main ones).

Infrastructure

  • OpenRastaHandler is now a handler factory.
  • Added a logging infrastructure and some initial instrumentation of the code.
  • All the ambient data is now cleanly separated and requires an IContextStore (Think HttpContext.Current.Items)

IO

  • I thought I’d push the sub-stream implementation to later, but it is now done. Only one stream of a request exists, and when using a multipart encoding, a sub-stream will be created that lets you read within a multipart boundary transparently. This enables quite amazing scenarios.
  • StreamWriter is a bad boy, it closes a stream automatically when disposed. Added a DeterministicStreamWriter that lets you control the behavior of the stream on close.

Dependency Injection

  • Not much there, code has been expanded a bit to resolve properties too.

Html Forms

  • Support is now complete and stable.

Multipart support

  • This baby took much longer than I thought, but it has incredible powers. Multiparts as used in html forms are now fully supported, including files etc.
  • Codecs are recursive. That means each part in a multipart can itself be parsed by another codec. Think passing around form data, xml and binary all in one go, without coding involved.
  • Quoted-printable and base64 encodings in form names are also supported.

Complex-type construction

  • The default type construction algorithm used for both mutlipart/form-data and aplication/x-www-url-formencoded now supports both type strings and variable names. That means that for OperationResult Post(Customer c), you can now use c.FirstName or Customer.FirstName as the field-name, as well as using only the property name (aka firstname).
  • TODO: Sadly some of the code is still not shared between those two codecs, this is the next refactoring. Need to find a clean model to extract all this stuff into. Expect to see a lot of this code extracted in parameter binders, and an extension for codecs providing key/value pairs.  [Update: Done]

Markup

  • There’s new code for markup generation. The infrastructure is all based on chained extension methods for configuration, giving a nice fluent-like taste (except for the form tag, but can’t do anything about that).

Misc

  • Code coverage is slowly reaching 80%, but there’s still a lot of tests to write around error conditions.
  • There are some namespaces at 100%, which helped fix a bunch of errors in the internal dependency resolver.
  • More renames (MediaType has taken over from Content-Type nearly everywhere) and namespace reshuffling.

The code is getting more and more stable. Now I just need more testers and more people using OpenRasta. That, and a logo. And tutorials. And screencasts. Etc.

Thursday, 18 December 2008

Visual Studio 2008 has buggy windowing code introduced in SP1… And no hotfix planned!

Update: Microsoft has released a hotfix. Thanks!

This issue keeps on coming up in my day to day work, and it takes me an hour or so everytime to fix… Whenever you have to deal with docked windows and visual studio changes the mode it is in, you end up with a fatal crash. It can happen when you start debugging, when you stop debugging, when you open a project or when you close the app.

This issue was, of course, not in the original vs2008…

These are the bugs I collected on Connect explaining the problem in more details. Microsoft has said they won’t fix because the code has been rewritten in vs10… But considering the stability of it at the moment, I want a hotfix now!

Anyway, here are the links. Don’t hesitate to nag everyone you know in DevDiv until someone takes responsibility to release a hotfix.

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=345345
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=355130
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=362433
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=363412
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=362508
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=369540
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=377247
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=376251
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=378065
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=377549
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=364335

VS Shell team, do your homework and fix your regressions!

Tuesday, 9 December 2008

From talking to doing – Open Space Coding Day

We are having very interesting debates and conversations at every single alt.net event that has been organized. Talking with others is a great way to reach a common understanding and evolve as a community.

There has however not been that much coding involved, something that many people have found was missing. That’s why I’m very glad Alan Dean has announced the first iteration of a project he mentioned at our last alt.net Beers: the Open Space Coding Day. Go and give feedback now!

Saturday, 6 December 2008

OpenRasta is available

This entry may be outdated. For the latest updates on openrasta, see www.openrasta.com.

Don’t get too excited, I’m still quite far from beta 1… But here goes.

As you can see, the documentation is still very much a work in progress and I’ll add several tutorials over the next few days. Expect some code churning as I increase the code coverage and continue delivering some functionality.

Didn’t think I’d get to the point of releasing that baby, but it’s finally there. Woo!

Thursday, 4 December 2008

Blog design updated

For those of you only reading from an RSS reader, have a look at the website when you got time. I’ve updated the logo. Gives some well-deserved character to this blog.

Wednesday, 3 December 2008

OpenRasta status update

This entry may be outdated. For the latest updates on openrasta, see www.openrasta.com.

I’ll be adding the proper headers tomorrow and release this version. It’s getting to a point where it can start marching to beta status openly. Here’s the change log since the last status update.

IO

  • new stream chain infrastructure for accurate content length discovery
    Codecs don’t have to deal with knowing the content-length anymore, it’s all done by wrapping the stream with one that tracks the Content-Length accurately.
  • Multipart support
    Support is in, and for the most part there is no more issues with asp.net taking over. The next step is to completely bypass asp.net and use the IHttpWorkerRequest directly. There’s preliminary support for that, but I want to have a clean-cut separation between streamed and buffered modes, which means implementing bulk transfer. Support is only buffered at the moment.
    At the IO level, you’ll find the goods in BoundaryStreamReader and BoundaryStreamWriter, as well as the new HistoryStream class. The problem with potentially non-seekable streams when reading boundaries is that you may read past the end of the boundary and need to go back… But It’s not seekable! HistoryStream keeps a fixed buffer of the last couple of reads and let you seek within that.
    One level up, the MultipartReader and MultipartWriter classes are the ones able to give you IHttpEntity objects from / to your streams.

Configuration

  • new configuration syntax
    Everything is now on ResourceSpace. I didn’t like the focus on URIs the previous versions had. Furthermore, they’re all attached to an IHas singleton, so you can add your own configuration language from the top-level ResourceSpace.Has.new demo site
    This should hopefully be used in the future to run some Watin automated tests.
  • Configuration auto-wireup
    You can either do the configuration in your global.asax or use a class at the root of your app. You used to need IRastaConfiguration (how confusing), it’s now called IConfigurationSource

Infrastructure

  • new dependency resolver flow
    No more direct access to the IDependencyResolver. The framework treats the internal one and any external one you may want to use (aka your favourite container) equally. Fixed a bunch of bugs when registering singleton instances in the internal container.
  • Error infrastructure
    The pipeline has been modified to be able to go back and restart the processing. That means that your error page will be subject to content-type negotiation.
  • Resource matching
    By default, resource instances you return from your handlers are seeked as an exact match you registered. There’s an opt-out by registering a resource as AnyChildOf<Customer>, which will then match Customer and any class inheriting from it. Feedback welcome.

Refactoring

  • Heavy renaming
    Folders now have the proper names, there should not be anything left with the Rasta moniker. Lot of interfaces and classes have been updated to reflect the http spec a bit better (IHttpEntity, IHttpMessage…) or to be more meaningful (ICommunicationContext replaces IRastaContext, IRequest and IResponse are shorter than the previous interface names). All the asp.net specific implementations have been renamed to AspNetXxx.
  • Http handlers and modules
    The http handler is now OpenRastaHandler. It may be changed to optimize the code path for IIS7 integrated mode when available. The module is now OpenRastaModule.

Bug fixes

  • Integration tests
    Just fixed the infrastrucutre to copy web.config automatically to the correct folder. The default destination is now in a separate folder. Other projects will follow soon.
  • Removing god objects
    RastaConfiguration used to be a big mammoth with way too much happening on it. It’s been split between DependencyManager (a service locator for the few repositories being used) and OpenRastaConfiguration (that exposes only the Manual property).
    All the same, IRequest and IResponse are much leaner than they used to be, with all the implementation details moved to the PipelineData object. TODO: Auto-register IRequest and IResponse in the container so you don’t need the dependency on ICommunicationContext.

Codecs

  • Content negotiation and media types
    I thought I had this one fairly nailed-out, turned-out I was wrong. The mime types are now prioritized on the server, so that when the client asks for */* (<cough>IE<cough>), the mime type with the highest quality is selected. Reprioritized both the webforms codec and the html error page codec to prefer text/html over application/xhtml+xml.
    HttpContentType is now called MediaType, which should solve the confusion between the ContentType header and what a media type is.
    TODO: Write the tests to ensure the Vary header is appended correctly.
    TODO: Have a way for the codec to get involved during the selection of the correct mime type. This would let the webforms engine detect the doctype and set the content-type appropriately.
  • Error codes
    There’s some new properties on OperationResult to detect client and server errors. This is used to automatically pad the returned representation, as IE (again) hides anything returned with a size less than 512 bytes.

Webforms engine

  • Webforms url rewriting
    I’ve now re-enabled the capability to register a webforms page at a fixed Uri with new extension methods, associated with a behind-the-scene handler and some changes to the codec.
  • Markup
    I’ve started refactoring the extension methods used for generating html content, which you’ll find in OpenRasta.Markup. There should be much more tomorrow.
  • Uri creation
    IUriResolver has been simplified, and a lot of noise implementation is now done with extension methods. Also a work in progress so expect more unit tests in the next few days. And you can now automatically generate URIs from any object by using myCustomer.CreateUri(); Sweet.
  • Plain text codec
    I thought it was more than time to bring plain-text back on the scene. So now you have a text/plain codec out of the box.
  • Silverlight
    Work on this is suspended for now until we reach beta 1.

What’s missing

  • For both the MultipartFormDataCodec and the ApplicationXWwwUrlFormEncodedCodec, we still haven’t gained back the support for complex types. This is coming back tomorrow, with a common code-base. That should be the end of ReflectionHelper, as the code gets migrated (and unit-tested).
  • The license header files, which will also be there tomorrow. Once it’s done I’ll give the svn and trac addresses, and open the mailing list to the public :)

There you go, there’s probably a lot missing as I didn’t log everything in svn, but we’re approaching the end of the tunnel. Aim is to be feature-complete for beta 1 in a month time. Patches are welcome :)

Tuesday, 2 December 2008

And you wonder why I haven’t got my next contract yet…

Received yesterday.

A key aspect of the job would be your ability with using multiple SQL server data-sources within one application, calling from one or more data-sources, manipulating the data and inserting into another.

So apparently people still do horrible things like that. Makes me break in cold sweat.

Alt.net London Beers Proceedings available

http://www.altnetpedia.com/AltNetBeers.ashx

OpenRasta finally gets its yellow screen of death.

image

The infrastructure to generate the page presented when an error occurs has been in place for a while, but lack of time and a bunch of bugs were preventing it from happening. It’s now resolved!

Anyone has any preference for the color of the future error message page? I’m thinking red or green.

Friday, 21 November 2008

Blend 3 will use the Visual Studio 2010 C# editor

I could be wrong. But I could be right. Announced at the next Mix?

Wednesday, 19 November 2008

A birthday and looking back on my digital life

So it’s my birthday today. Every year until this now, my birthday has be the time for doing absolutely nothing. As I geared-up my community involvement this year, I find myself with so much to do and so little time that my birthday will be an after-thought this evening. Editing of alt.net content (7 hours of raw HD material to cut, compress, publish, of which I have only started), preparation of a talk next week, publication of a detailed guide for OpenRasta’s official launch (including delivering on my plan to port the Suteki project), a backburner project for Paris… And so far no contract in London, with agents driving the prices down and a global recession that is starting to ripple its effects through non-financial companies.

So I thought I’d celebrate the year by looking through my blog entries and twitters to provide for myself a roadmap of what I’ve done right and wrong.

2007

Had issues with a company and a manager with which I didn’t manage to work. Lesson learnt from it, there is a right time to move on and a right place to be efficient. Started a long rant on mocks and their uses, trying (poorly) to debunk the ideas that mocks were always better than fakes, and that there was a life outside of mocking frameworks. However, with the latest mocking framework syntaxes and new defaults, the problem will slowly go away.

2008

Spent a lot of time comparing and pondering how to provide data for the very poor http client called flash. Attended the first UK alt.net conference and felt so much more energized than I have been in years. Started giving presentations in user groups. Started working on the first version of Rasta that would lead me to write OpenRasta. Predicted that skydrive and foldershare (now WL Sync) would interop through the Sync framework (but Live Mesh doesn’t use skydrive yet, so this is not realized just yet). Organized the first alt.net beers event. Changed my relationship to code by switching my desktop to 30”. Started using twitter (and it’s all @CAMURPHY’s fault).Went to NxtgenUG Fest08. Made a point of supporting Linq2Sql and ignore Linq2Entities. Gave more talks. Went to Mix:UK, PDC, VBUG, TechEd…

 

And I’m  not including all the stuff I didn’t blog about. Very busy year indeed. And yet I feel I’ve pretty much under-achieved. So I take the public vow here to try harder. 5 year plan etc etc.

Friday, 14 November 2008

One more day at a conference…

And one more night of discussion, passion and learning. I get so much from meeting the people that attend conferences that I really think that not attending the sessions and only meeting people at dinner is where the value really is. I may just do that next year and skip the conf itself, and reserve myself for dinners, drinks and beer chatting.

Monday, 10 November 2008

Beginning of #TechEd – Early Bird WTF.

Thought I’d moan a bit more about the organization… By registering early, you get given, I quote the guide, ”a reserved seat” at the keynote.

When you check in, you get given a nice wristband supposedly giving you access to those seats. Comes in a nice plastic bag, together with a cap.  But no explanation notice explaining that, in fact, you need to come 30 minutes early to have your seat. So the wristband gives you the right to arrive early when no one else is there to choose a good spot. But it’s not reserved.

Of course, the very heavy booklet provided with the conference bag doesn’t mention those 30 minutes. Neither is any sign in the conference centre. Nor do the ladies giving you the goods in the morning.

So no “reserved” seat for me, because the reserved seat wasn’t really reserved at all. Fair enough.

But then one of the attendants that was managing the event replied, after my questioning:

“- you’re 15 minutes late, it was at half past for early birds
- but no one bothered telling me this
- well it must have been indicated, you should’ve been on time
- but there’s no sign, no documentation, no nothing about being there at half past?
- well we had those three rows over there. Don’t be late next time”

So it’s my fault no one mentioned we had to be there half an hour before? Or that you didn’t print it? Or that the documentation doesn’t show it anywhere?

Add to that there’s no Wifi in the room and not a single twitter mention anywhere, or facebook group, and I have to wonder what happened between last year and this year.

At least we get a nice conference bag, of about the same quality as the one from last year. As that one is nearing the end of its useful life, the new one arrives just on time.

#TechEd – Keynote

[Update: Indeed, the unannounced stuff was the sharepoint visual studio integration. Paul Andrew just blogged about it.

Introduction from the business guy. I assume the black blocks in front of the stage the presenter keeps looking at is some sort of teleprompter. It’s always very annoying to see any speaker fixed on his slides / script.

Talking about how great it is to do business in Europe. Slides showing partners. Still don’t understand why a developer conference ends up with marketing and business cases. Could they do TechEd decision makers and stop boring me with all this amazing stuff people do with Microsoft software? Or at the very least try and hit my geek soft spot?

Zander is now on stage. No powerpoint, just Visual Studio demos. Thanks god a geek is finally presenting. Will be releasing stuff not talked about at PDC. Good! Wonder if that’s in the bits we got at PDC, need to rerun the VM tonight.

Showing the reflector equivalent that’s built in vs10, which we’ve seen at PDC. Showing assembly dependency analysis, delving into class dependencies. Sequence diagrams (see pdc bits). Gets me worried to see all this UML stuff creeping back in.

Showing off the blackbox replay for testers. Sweet if it comes for free, other tools have provided this for quite a few years now.

So the machine they’re demoing is actually being RDP’d into. Wow. Showing off vista’s graphics capabilities!

More WPF editor goodness. Still no sign of the new windowing promised for vs10. Lot of code visualization stuff. Mentions of MEF (@gblock is gonna be happy :) ).

Trying to debug a session, find the bug… But changes live code without writing a single unit test to confirm the problem. There really is a need for Microsoft to start a cultural change.

In no particular order, saw snippets for xml and javascript, jquery, web deployment and a test-first demo of MVC. There’s still a lack of understanding of the difference between test-driven and test-first, shame the two words are still used interchangeably. Some VB10 goodness.

Xml transformations for config files. So you mean I can solve my config problems with some config solutions? Wow.

Some sharepoint stuff I have no interest in, dozing off.

C++ parallel_for keyword to use 8 cores to do ray rendering of pong in 3d. Some touch support to move the pong cursor (what, you mean with a touch screen i can move stuff around? Wow.)

That part of the keynote has been delivered perfectly, but what was shown was mostly PDC stuff. Not seen that many non-PDC news, but maybe I missed a bit (or was that the Sharepoint thingy?)

Sunday, 9 November 2008

On my way to Barcelona….

[pre-nagging: this post contains jokes about Italians, British, Spanish and French people. If you’re offended by generalization about nationalities on holidays, please skip this post altogether.]

What a joy to travel. Only a few hours after I left home, I am already feeling incontrollable urges to hate 4hundred of people that have been encumbering my travel plans. Let’s review what happened for me to manage to board the plane.

  1. International
    I was ready to leave the house on time, until I realized that for some Murphy’s law reason, my travel pass *and* my Gatwick express pass didn’t actually print, and Vista just silently failed on me. 5 minutes delay.
  2. British
    The cab then shows up 5 minutes late, getting me to the Gatwick express at 15:03. And *then* do I realize that, for maintenance work, said service leaves every 30 minutes instead of every 15. 35 minutes delay.
  3. More British!
    Well, you didn’t really expect the Gatwick express to arrive on time did you? 50 minutes delay.
  4. Italian
    As it happens, a big Italian contingency was sharing the same train as I. Having been raised with Italians, I’m fairly used to them being slow and unorganized (and nearly as rude as the French). But when there’s only one elevator for the already overcrowded train, things just add-up. Wait for 15 minutes to get an elevator, 65 minutes delay.
  5. British more and more, and some Italians
    Thanks to BAA, once I finally arrived at the airport level, and only one floor from checking in, a BAA representative barks at me that my luggage is too big to take the escalator. Bless the spotty face and the arrogance of the yellow-wearing Gatwick idiots.  At that point, I’m lower on the food chain and have to accommodate with the 2 out of 4 functioning elevators to get to departure. Wait for another 10 minutes, 75 minutes delay.
  6. British Airways
    Well, by that point, even though I was checked-in, the whole masquerade of pretending to call the controller about late-checking of luggage is unfolding, me knowing that under no circumstance do you try to get in touch with the guys handling the luggage by phone. Ever. You need a radio. But the masquerade to protect the attendants from telling me to fuck off unfolds, adding another 10 minutes. At that point we reach 85 minutes of delay.
  7. British Airways again
    Wait to get ticket changed at Customer Service. 15 minutes wait. Get told that I should queue (again) in the ticket buying queue. another 15 minutes. The fact that I have a business ticket seems to have no importance on how fast you get treated when you have a problem. People may wear smile well, but the customer service still painfully sucks. I stop counting.
  8. Easyjet
    Last flight to leave for Barcelona is Easyjet, from which I buy a cattle-class ticket for £139. I never travelled with them until now, and I know why. Gate checking an hour late, hundred of people just trying to walk on each-others and a waiting room that is probably not dissimilar to the corridor leading you to the fatal injection room in some Texas prisons. None of the staff has shown a single smile by now.
  9. Spanish
    Well, considering the destination, I have to moan about those a bit. While the lady next to me has been very polite and adorable, the (overweight) guy in front of me has insisted on reclining on his seat. Either that or said seat is reclining under the weight. In either case, the 17” laptop keeps on pressing uncomfortably against my stomach, making me regret the minute I thought getting the laptop out would be a good idea.
  10. Spanish on the other side…
    So of course, with the lack of space and strong sense of agoraphobia growing on me, not tamed in the slightest by the double bloody-Mary I inflicted upon myself, I politely ask the Andalusian woman behind me if she wouldn't mind too much if I reclined my seat. Of course, I did check that the only thing on her table was one of those miniature overly-salted overly-aromatized overly-fat overly-disgusting and overly-non-bio  Pringle pack. If you’ve never had the delicious pleasure of enduring airline snacks, the cylinder measures roughly 3 inches. But of course, said brunette, either not understanding my desperate attempts at sign language, or just being an annoying bitch (my preferred explanation so far), refuses with an arrogant no. Not the polite one you would expect, being apologetic for denying your freedom to ensure theirs. No no no. The aggressive “are you kidding me” refusal. Thought about slapping her face, or worse, just reclining the seat anyway. Give up, tuck in and put the laptop in my belly.
  11. German
    At last a smile from one of the flight attendants. I wondered for a long time why traditional airlines attendants always looked middle-aged, and where the young ones were. Now I know, they’re all trying to make a living working for easyjet.
  12. British
    Uh. Yeah, you guessed it. The plane is *very* late.
  13. American
    My iphone battery dies before I manage to connect to any network.
  14. Spanish
    Finally make my way out of the plane and try to accommodate my smell to the lack of locker-room scent that I had to suffer for the last two hours. Of course, TechEd buses are not running anymore, and the (4) guys waiting with a TechEd sign have no will to help you get to your hotel, pointing you to a cab. Sweet.
  15. Spanish
    Get in cab that has a big logo specifying they accept credit cards. Of course the guy refuses to take my card at all, so it’s off to the cash point, at a total interest of nearly 7% + £2 of transaction fee. Silly me I leave him a tip. Should’ve let him rot in hell. His teeth seem to enjoy the place.
  16. Hilton Diagonal Mar
    So you’d think with such an insane trip, with a booking made in June, Hilton would at the very least solve my problems. Nope, non-smoking room and no way to get a smoking room. At that point I’m exhausted and will just flaunt the non-smoking status until I get a room of equivalent size or more in *smoking* environment. Otherwise they’ll have to rebrand my room. Or charge me. But as there’s no mention of such a charge anywhere…
    Speaking of which, don’t even get me started with the quality of the internet, that I have the privilege of paying a freakin 100€ per 7 days for. Or the fact that their book where you supposed to have all the information for your stay, including the room service, is still unordered and missing entries. Second year in a row.

Oh, and in the process I just realized I forgot my TechEd card at home!

Follow Sebastien’s adventures tomorrow as he tries to get the room he booked and get registered at the convention center. *orders another beer and pops a prozac*.

[Update: after feeling bad and going down to smoke outside the hotel, I managed to get my room changed tomorrow. There’s some light at the end of the tunnel.]

[Update 2: On the up, hotel room changed. On the down, breakfast eggs made me sick this morning. At the conf center, hopefully everything will be a smooth ride from now.]

Apologies for the silence… Out of work and conferences

Sorry to all people reading (and not taken over by tweeter fever). Between PDC and KaizenConf, I took a couple of days off and am now getting ready to meet even more great people in TechEd.

I’m doing the initial edit for some of the videos I took at KaizenConf / PDC (mainly recording of sessions, the interviews will take a bit longer). I hope to manage to get a few more at TechEd. Bittorrent of the raw material to follow.

Oh, and I still don’t have a contract, so any work you feel I may be able to help out with, please shoot me an email at seb@serialseb.com. Thanks!

Saturday, 1 November 2008

KaizenConf , so far, has been about…

  • Self-improvement
  • Corporate adoption of lean
  • Talking about how learning how to be a good developer and a good chefs are one and the same thing
  • Talking about the American economy
  • Talking about the meaning of feature
  • Talking about the interaction between France and Quebec from the 1960s
  • Talking about the cost of adopting technology and its value depending on the project / team size
  • Talking about the waste of adopting lean in the silo of IT
  • Talking about recognizing failure and success

I probably forget many, but my brain is obscured by the level of discussion and contribution that happens here. None of the PDC / TechEd events compare to the thrill you get when surrounded by extremely opinionated and excited people. I’m in geek heaven.

Tuesday, 28 October 2008

I am a ToolWindow

For anyone that attended Glenn’s talk.

black_tshirt_girls_FF

Monday, 27 October 2008

Alt.net OpenConf session at PDC!

For all of you alt.netters and interested parties, I just came back from the OpenConf style area next to the exhibit floor, and there’s an alt.net track being proposed.

It’s at 15:30 on Tuesday. Be there or be square! (how tacky…)

Alt.net London Beers #4 – 25th of November

If you plan to attend, please leave a comment on this entry.

I should have the time in the next few days to publish the result of the third edition of the alt.net beers. Thanks for everyone who came and made it a very successful event.

So let’s plan the date for the next one. From now on, I’ll organize the event on the last Tuesday of each month. To make sure we don’t step on each others toes, most of the UK community events now share their dates in a central location, so hopefully you won’t ever have to make a choice between all the amazing events that happen in the UK.

Following on the success of the previous events,I am happy to announce the next alt.net London Beers event. Tequilla\ has been nice enough to let us use their downstairs lounge bar, to continue with the tradition of beer-oriented conferencing.

The format is a mini openconf-style session. Here are the rules, slightly changed to learn from the previous event.

  • Arrivals, discussion and socializing between 18:00 and 19:15, with one necessity: find the topic of the day and find the questions that we will try to answer.
  • Between 19:15 and 19:30 we will vote on the subject we want to talk about, in two rounds, by raising hands.
  • At 19:30 the big clock will start ticking for a time-boxed 60 minutes workshop on the subject. The goal is simple: can we as a group get insight and progress our understanding of the problem.
  • At 20:30 the clock will ring and that will be it of the conversation. Everyone will be invited to fill-in a wiki with a one or two line answer to two questions: what did you want to get out of the session, what did you get. The goal is to capture a snapshot of the state of mind at the event, and to be able to compare those with the result of our reflections that, I’m sure, will be extensively shared on blogs, mailing lists, twitter, etc.
  • Once this is all written down, everybody will be able to continue the discussion in the pub or wherever they see fit.

The location:

TEQUILA\ London Limited
82 Dean Street
London, UK
W1D 3HA


View Larger Map

We’re always looking for new locations and one or several sponsors. If you or your company is interested, pop me an email seb@serialseb.com.

Sunday, 26 October 2008

PDC tomorrow, WeHo tonight

Anyone wanting to come for dinner / drinks in WeHo (gaying PDC up a bit), or meet from tomorrow, phone number is +44 7789 00 8282 :)

Friday, 10 October 2008

Being in a printed program again

I just got confirmation that you voted for one of my sessions for DDD. I’m thrilled! It’s going to be an absolute pain to write the material needed to get what I want out of it, but the community and the people attending will choose the content, which I am very excited about.

And on the same level of excitement, the VBUG annual conference will be receiving yet another game of Bingo with me delivering a more polished version of the MVC talk I gave in London and Brighton.

The interesting bit about the VBUG conference is the printed agenda. I need to get a proper speaker picture, because the one I gave looks dreadful. Actually, the picture is alright, but I look dreadful :)

Seeing my face on that leaflet reminded me of the leaflets I received for various conferences I attended and spoke to, on peer-to-peer networks, back in 2000.

Interesting how life can seem like a rollercoaster sometimes, but is all but cyclic. You raise, you fall, you learn. I’ve been truly blessed in 2008 to meet fantastic people and go back in the speaking circuit, meeting countless amazing people and working on exciting things.

All this just to thank the people that listen to my rants when I give talks, the London .net User Group for getting me back in the speaking mood and giving everyone the opportunity to do it, the absolutely brilliant community we have in the UK, to the alt.net crowd, to the non alt.net crowd, and even to the Entity Frameworks proponents :)

Monday, 6 October 2008

While I’m in a ranting mood…

Seen in the wild.

        /// <summary>

        /// This is only for Unit Test Use

        /// </summary>

Code is not shown to protect the guilty, but it’s a method to set a property on an entity class.

Multiplying project files…

I was going to have yet another rant on separating everything in a ridiculous amount of project files, to ensure separation, and started venting to one of my colleague, at which point he mentioned Jeremy just posted on the issue: Separate Assemblies != Loose Coupling. Amen.

Thanks Jeremy, that saves me a post.

Sunday, 5 October 2008

HttpResponse.Flush forces Chunked transfer…

That one took me quite a while to understand. I’ve been building the integration tests for OpenRasta, a bunch of classes that configure a full web-server and run a real request-response scenario. This should hopefully help in limiting regressions, and may also be used in the future to ensure continuous compatibility with IIS6 on plain .net 2.0.

I’m leveraging the kernel http support present since Windows XP SP2 to create an http listener dynamically and initializing the asp.net runtime inside it, though the very useful HttpListener class.

After a lot of debugging, I discovered that my test was failing because of an encoding issue. Instead of returning the content that was sent to it by OpenRasta, an 18 bytes string, I ended up with much more than that, with line breaks in the middle. A quick look at the returned headers and it became very obvious that the system was sending me back chunked-encoding, a process by which the data is sent in blocks, each prefixed with the size, and suffixed with entity headers. The thing is, there is no support at all yet in OpenRasta for chunked encoding.

Here is the block of code causing all thesetroubles.

        public void ProcessRequest(HttpContext context)

        {

            IRastaContext rastaContext = RastaConfiguration.GetService<IRastaContext>();

            rastaContext.SetContext(context);

 

            _pipeline.Run(rastaContext);

 

            context.Response.Flush(); // <!-- see that one?

        }

As you can see, I was calling Flush on the HttpResponse object in the IHttpHandler that runs the OpenRasta pipeline. I quite understand the reasoning behind switching transparently to chunked encoding when requesting a data flush, you want to clear the data queue by sending it to the client, but you do not know yet how much data you will send later. At that point, using Content-Length is not possible, and chunked encoding is the only way to achieve the desired result.

Looking at the msdn documentation for HttpResponse.Flush you will notice there is no mention of that behavior. But not to worry, other developers thought it may come handy to document, and you will find the following on the mono documentation.

HttpResponse by default will buffer all of the output before it is sent to the client. To control the delivery of the data developers can use this method (or alternatively set the HttpResponse.Buffer property to false).

If chunked transfers are enabled for this response, this will try to use the chunked transfer.

Elementary, my dear Watson.

Once upon a time, code I wrote…

  After installing Windows Live Photo Gallery Beta, I noticed that it automatically indexed files shared on my big tera-server. And below is a nugget from code I’ve lost a long time ago, back when I was helping write a failed emulator for Dark Age of Camelot. A C# OpenGL reader that could render models of the game.

CamelotSharp Nif Viewer

Saturday, 4 October 2008

Track me down!

Added to the site, the calendar of which events I’m attending. That way, anyone wanting to give me a million pound, or punch me in the face, and everything in-between, will know where to find me :)

Thursday, 2 October 2008

OpenRasta status update

This entry may be outdated. For the latest updates on openrasta, see www.openrasta.com.

A couple of people have access to the code and have been kind enough to give reviews. I’m always open to more people helping out in the very early design phase before I go all public with the framework I’ve been nagging everybody about for months and months, so pop me an email to seb@serialseb.com and I’ll give you access. OpenRasta will be under an MIT license and I’ll publish it all to the world. I need to ensure what needs refactoring before release is refactored and that it is a fully functional beta first.

So here is what can be done with OpenRasta now and what I’m currently working on. See it as both an announcement and my task-list to the runner-up to the official release. You can refer back to the previous version of OpenRasta I already introduced. For various reasons the original Rasta never made it to open-source and its code has now died, and as far as I know no one will maintain it. OpenRasta is a fresh take on it, but keeps the same configuration API and the same concepts in a fresh new format with fresh new codes (and fresh juicy unit tests).

So by now you know there are essential components in OpenRasta: URIs, Resources, Handlers, Codecs and the pipeline.

The framework

  • OpenRasta.dll contains the bulk of the implementation, and compiles successfully on the .net framework 2.0 and on Silverlight. Great for embedding OpenRasta in your traditional asp.net application and start migrating your code over. And why not provide a REST-friendly server from the .net Compact Framework? (starting to sound like a marketing drone there)
  • The silverlight support will eventually provide for duplex http so you can architect your RAI test-first and REST-friendly, reduce coupling, and enjoy your life more. IN PROGRESS.
  • Most of the features are implemented straight into OpenRasta, such as dealing with form content-types browser send you. That means no reliance on some of the asp.net limitations on file uploads.
  • OpenRasta.Server.dll is your asp.net integration point, with support for traditional IIS6 and Integrated IIS7 modes.
  • Did I mention OpenRasta runs on asp.net 2.0? Alongside your webforms?

The pipeline

  • The pipeline is a series of pipeline contributors. They all act upon a small area of functionality, change a couple of things and give control back. The good news is that you have full power to change any of the existing contributors, add your own, etc. The default pipeline has 17 components which support the execution of the whole system.
  • Each contributor registers when it wants to be executed, and it is always relative to another contributor. The pipeline, once initialized, builds a chain of calls and execute them sequentially. And there is a small type that will let you register for multiple steps in the pipeline and be called only when you are ready.
  • You can add and remove contributors at configuration time to replace or modify existing behavior. IN PROGRESS.

URIs and URI decorators

  • You define your resource Uris using the common http template syntax. It’s a clean-room implementation of the .net 3.0 UriTemplate and UriTemplateTable classes to run on 2.0. It will support both the 3.5 modifications and some extra features sometime in the future. May donate the code to mono if their implementation hasn’t progressed much.
  • Several Uris can identify the same resource, but in different languages. /home and /accueil will automatically set-up everything you need to override the default client’s language.
  • Of course, in any real-world scenarios, your URI doesn’t only describe an abstract resource that is easy to name. There are plenty of little tidbits of things you may want to include, such as the document type (.html anyone?), the language (/en/mydocument), maybe even the version (/en/mydocument(v1)). Most frameworks would have you declare all the combinations of those urls to design your resources. In OpenRasta you simply define a Uri decorator that will change the way the request is processed and clean-up the Uri before passing it on for processing. Out of the box, you’ll have document types, language, http method overrides (for those nasty PUT you want to do from your html forms) and view selection (for when one resource have several views applied to it).

Handlers

  • Once your Uri is matched to a resource, a handler is going to be selected and one of its methods called.
  • You don’t have to inherit from anything, or implement any interface.
  • You name your method using the name of the http method the client sent you. Want to send data? Implement a Get(). Want to append data? Implement a Post().
  • Sometimes you want more meaningful names. Just declare a small attribute to map the correct http method to the correct clr method.
  • Parameters are declared naturally, without multitudes of hacks, strings or attributes. The codec will be responsible for mapping whatever the client sent to whatever CLR types you are expecting. The framework will map your url templates to your parameters too.
  • Want optional parameters? Add an [Optional] attribute. Want a default value? Enter [DefaultValue]. And any CLR language implementing default values will support those too. I think that includes the VB guys :)
  • You can even have parameters that map to http headers.
  • Your handler method returns what makes sense to you. Don’t want to return any resource to your client? Discover the joy of the void return type! Always return a type? Just declare that type as the return type. And when you want to return RESTful information, simply return an OperationResult.
  • Your handler only select objects, not views or other things that doesn’t concern it. You return an object and a Codec will render it to the client.
  • And of course, you can add plenty of filters that execute before and after the method calls. A logging filter (IN PROGRESS) and a Principal security filter come out of the box, so you can get people to authenticate.

Codecs

  • A resource can be read and written from and to an http connection using Codecs. Some are provided in Rasta (json, xml, html, html form data), and writing one is brain-dead easy.
  • You can let the client decide which content-type it will receive by using well-established content-type negotiation semantics. It’s all done for you. And it even serves application/xhtml+xml to firefox without you having to touch a line of code.
  • When sending data from html forms, <input name=”customerName” value=”value” /> will call Post(string customerName);
  • Ok, everybody does that. When using <input name=”Customer.Name” value=”value” /> this will call Post(Customer customer) with the correct property done for you.
  • Ok, most MVC frameworks do that. When using <input name=”AddressOf(Customer).PostCode” value=”value” /> this will call Post(AddressOf<Customer> customer) with the postcode property set.
  • Ok, some MVC frameworks do that. When using immutable types, <input name=”Customer.DateOfBirth.Date” value=”12” /> the method Post(Customer c) will be called with the date set on a new date of birth. And you can set property chains as far as you want, and write to read-only properties. Convinced yet?
  • Ok, maybe some MVC frameworks may be able to do that. When using <input name=”Customer.DateOfBirth.Date” value=”12” /> the method Post(ChangeSet<Customer> c); will be called, and you can update your objects with whatever changes are being sent through.
  • Oh, and the same stuff can work with other content-types too. Implementing http patch has never been that easy.
  • Codecs also can use different views. Want to have one page to view and one page to edit your customers? Just declare a view using TranscodedBy<WebFormsCodec>(new { index = “~/CustomerView.aspx”, edit = “~/CustomerEdit.aspx” });
  • The return data depends on what the client requested. And that includes error pages, 404s, 401s, etc. IN PROGRESS.
  • You can stream data from the client rather than have asp.net download everything for you, for any multipart type. IN PROGRESS.

And the rest

  • Http Digest Authentication out of the box. IMPLEMENTED. With time-sliding security window and logoff functionality! IN PROGRESS
  • An error mechanism for your webforms to manage validation errors while still returning RESTful status codes, that still renders correctly when dealing with json, xml, etc. IN PROGRESS.
  • Everything, and I do mean everything, goes through an IoC container. If you don’t use one, OpenRasta use its internal one. If you use one, OpenRasta automatically registers all its dependencies in it. Comes with a Windsor Castle implementation.
  • All the configuration can be done without a single attribute anywhere, either by leveraging conventions or using the fluent configuration API.
  • Automatic cache management based on your resources (including Last-Modified and ETags). IN PROGRESS.

What to look forward to in beta 2

  • VB9 XML literals, NHAML and NVelocity view engines. NOT STARTED.
  • Full AtomPub support. NOT STARTED.
  • StructureMap support. NOT STARTED.
  • An additional configuration mode for the attribute junkies that will scan your assemblies and configure OpenRasta automatically. NOT STARTED.
  • Support for asynchronous operations (need to define the exact use-cases for this first). NOT STARTED.
  • An optional reverse cache for your handlers. NOT STARTED.

Way past my bed-time. That should give you a good idea of where I am at with OpenRasta and what kind of things it will enable you to do. Email me to peek at the code before anyone else!