Wednesday, 17 September 2008

The content of the presentation at VBUG Brighton tonight

As last time I got completely overloaded with work and forgot to post the content of the demo, this time I’m doing it the other way around. Code is available on my public mug (get it? caffeine-it, mug, public? Funny? No? Oh well). Point your favourite svn tool to

http://svn.caffeine-it.com/mug/bingo

From the command line

C:\> svn co http://svn.caffeine-it.com/mug/bingo bingo

Will add the updates I’ll tweak till then and the powerpoint slide sometimes tomorrow at the same place.

See you all tonight in Brighton, or over the next two days at Mix!

Monday, 15 September 2008

Alt.net London Beers #3 – 14th October 2008

Following on the success of the previous events,I am happy to announce the next alt.net London Beers event.

The format is going to be different from the previous event, as it will be a sort of mini openconf-style session. Here are the rules

  • Arrivals, discussion and socializing between 18:00 and 19:00, with one necessity: find the topic of the day and find the questions that we will try to answer. We may provide post-its, white boards or body painting equipment to help people focus.
  • At 19:00 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. The specifics of the format will probably change when we get there, but I’d like us to focus on up to 4 questions.
  • At 20:00 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 for each of those questions. 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.
  • One this is all written down, everybody will be able to continue the discussion in the pub or wherever they see fit.

Please leave comments here and everywhere you feel relevant, or hit me on twitter, to suggest topic ideas or to provide criticism of the whole concept. Without feedback one cannot separate success from failure, and recognizing those are necessary to progress and improve.

If your company wants to invest a bit of money behind the bar for food and drinks, don’t hesitate to let me know.

And of course, the location is the same as the previous event, and I have been told the kitchen staff will stay a bit longer for us this time.

The Blue Posts
18, Kingly Street
London W1B 5PX


View Larger Map

Wednesday, 10 September 2008

Developing .net code since 2000?

Over the years, I’ve had a couple of people in interviews being surprised at my assertion that I started development on .net in 2000. As I go through yet another cleanup of my email archives (I’m an archival freak) that are reaching around 15GB of data, I found this email.

From: DeveloperStoreAdministrator@developerstore.com [mailto:DeveloperStoreAdministrator@developerstore.com]
Sent: 14 November 2000 03:09
To: …
Subject: Thank you for your recent Microsoft purchase

Thank you for visiting our store, Sebastien P. Lambla.

Your order has been entered into our ordering system, and will be delivered to you soon. At that time, the charge of $15.99 will be charged to your credit card.

This is an unmonitored email alias. Please do not reply directly to this email alias as the messages will not be answered. If you have questions or would like to check on the status of your order, please email us at mstoolbox@interactservices.com.

Refer to order number MSDSTB129915 when contacting us.

Thank You,

Microsoft Developer Tools

This was the first beta of visual studio. 8 years of C#, how time flies!

Friday, 5 September 2008

Kaizenconf is open

For those that were waiting for the kaizenconf registration to be open, it now is. But it’s not really a registration, it’s a request for a registration. So if I understand that correctly, I still don’t know if I’ll be there or not.

If you come from good old Great Britain, I’d recommend booking anyway. With the sterling going down, cancellation fees will probably be cheaper than waiting and see your money be half what it was.

Tuesday, 2 September 2008

Work availability

If you’re looking for help with your project and need a consultant, I’m available for the first two weeks of October. And if you’re looking for a developer / lead developer, I’ll be available from mid-November!

So don’t hesitate to contact me at seb@serialseb.com and cut some of those agencies cost!

Monday, 1 September 2008

Vote now for DDD!

Quite many very interesting session proposed for the next DDD.

Go and vote now for your favorite sessions (and if you don’t like any, you can always vote for mine!)

Sunday, 31 August 2008

The case of global.asax not being executed in IIS7

Global.asax is used in both asp.net MVC and OpenRasta for implementing your configuration. In Rasta 1.x, the handling of request was done through a catchall http handler. This has a couple of adverse effects for the application: all requests went through rasta first, and got delegated to IIS when there was no match. This can cause a range of performance issues, from lack of caching to constant file access when the delegation ends up using DefaultHandler rather than StaticHandler, as in those instances the files will systematically be streamed from the disk.

Another struggle I had with this system was the various issues encountered when trying to host the system on IIS7, something I started doing a while ago. I remembered reading from a blog that asp.net MVC was using both a handler and an http module, and investigated using a similar configuration for OpenRasta. As I do not want to be influenced by other people’s coding abilities, I have stayed away from reading the asp.net MVC source-code and tried to come up with my own scheme.

One particular issue comes from the different framework versions supported by OpenRasta: I run on plain old asp.net 2, and this means that all the new APIs that let you change a handler on the fly during a request will not work, as they are added by .net 3.5 sp1. Instead I came up with a clever trick: Just before the handler is resolved, I rewrite the url to a fake url, properly called ignoreme.rastahook. The extension rastahook is always associated with a compatibility handler that then gets called by the asp.net infrastructure, at which point I rewrite the url to what it was before the change, and execute my own http handler from there. The solution is not entirely perfect yet, as there is no support for asynchronous handlers, but as with every other part of OpenRasta I’ll be able to change that without impacting any handler already in existence.

As soon as I implemented those changes, everything went much more smoothly on IIS6 and cassini (the visual studio web server), but broke completely on IIS7 integrated mode on my local box. After much debugging, I realized that my global.asax wasn’t being called. When I added back an http handler to my web.config, the global.asax code was called again.

The reason is a bit confusing to understand at first. In IIS7 integrated mode, http modules are treated as being part of IIS, be it that they are managed or not. This means that a module may or may not rely on asp.net. Your module will be executed but your web app won’t necessarily have been compiled. Handlers on the other hand, when they are managed, trigger the asp.net application, and your code will get executed.

So to conclude this issue that i’ve been chasing for two months now: if you don’t have a managed http handler for your request, your http module will be called but the asp.net part of your site will not have been compiled and / or won’t be called, including global.asax. The solution is to ensure you have a managed handler in place, or force a compilation of the root site using BuildManager.GetReferencedAssemblies.

P.S.: this is all based on empirical evidence, so I may be absolutely wrong, and would be glad for anyone to come up with an alternative explanation.

Wednesday, 27 August 2008

Microsoft, for Christmas I’d like…

  • A Visual Studio SP1 ++ that fixes all the bugs you’ve recently introduced
  • A web designer that passes the ACID2 test
  • A browser that implements the *freakin DOM*

I promise I won’t be a good boy, but then again, when I have to work with some of the tools you sell, I know who is to blame.

/me goes back to his office and wreck a few toys

Monday, 25 August 2008

The rubber duck in agile teams

Saw this from twitter and it made me smile: http://www.ademiller.com/blogs/tech/2008/08/scrum-bestiary-the-rubber-duck/

Have you had a rubber duck to deal with?

Saturday, 23 August 2008

Proposing a syntax to attach behaviors to html elements

ScriptSharp, like asp.net AJAX, has the notion of behaviors, javascript code that can attach itself to DOM elements and change their, well, behavior.

As part of my spike on ScriptSharp (and I’ll have to admit having spent way too much time on it to still be called a spike), I’ve built a simple container that automatically resolves and binds behaviors to DOM elements, to reduce to a maximum the amount of inline code required within my generated pages.

The one thing I went round and round about was how to declare in markup that binding. Here’s a few solutions I tried or seen proposed through various tools.

<div style="behavior: url('myBehavior.htc')" />

This is something introduced in ie4, but it breaks the CSS standard *and* htc are only recognized by Internet Explorer. No good to me.

The next contender is…

<input type="text" id="searchText" />
<input type="button" id="searchButton" />

<script type="text/xml-script">
  <page xmlns="http://schemas.microsoft.com/xml-script/2005">
    <references>
      <add src="ScriptLibrary/Atlas/AtlasUI.js" />
      <add src="ScriptLibrary/Atlas/AtlasControls.js" />
    </references>
    <components>
        <textbox id="searchText" /> […]

…xml-script, and was originally presented early in the life of asp.net AJAX (back when it was called ATLAS). This is awfully verbose, and worse than that it won’t ever validate in non-xml languages (aha HTML 4.01 or XHTML5). The same is true of the proposed changes in asp.net AJAX Futures, which uses namespaces everywhere even though they’re not allowed in non xml renderings.

[Update: As Simon Pieters correctly points out in the comments, this syntax would indeed be compatible with HTML5 (the non-xml serialization one), because the definition of CDATA sections has been modified to include anything not including the closing tag. Hence what is after <script> can be anything that is not </script>. This redefined definition of a CDATA element is not something the XML specification agrees with however, which means that in all languages, aka XHTML 5.0, XHTML 1.1, XHTML 1.0 and HTML 4.01, you need to enclose the content of the script tag in a CDATA section, aka <![CDATA[ … ]]>. This makes HTML5 the only rendering with which xml-script would work. I may have misread some of those specs however, so if I have please comment and I’ll update and buy you a beer.]

In choosing how to map behaviors, I had several goals:

  • declare the behaviors contextually within an element,
  • being able to use the exact same notation for both HTML 4.01 (the SGML language), XHtml 1.0 and 1.1 (the XML language) and Html 5 (both the whatever it is format that is not sgml anymore *and* the xml language, as both exist)
  • being able to pass additional customizations and parameters specific to an instance
  • Not look too out of place.

I initially settled on an extension to the way content type definitions are expressed:

<div class="behavior/graphicscroll;horizontal=true;vertical=true;">test</div>

This says, ask the behavior family to add a graphicscroll behavior and pass it values for horizontal and vertical. All was good and I was happy with myself. For a whole five minutes.

Then you realize that while that syntax works like a charm, it is invalid in Xhtml 1.1, because the class attribute was redefined to be of type NMTOKENS, where the previous version had a type of CDATA. This is a serious breakage for content out there, and I wonder what the reason for this is.

The other issue I had with this is the need to declare the full syntax for each element I wanted to use, and I really wanted to leverage CSS selectors. One solution I would have wanted to use was to simply extend the CSS stylesheets with custom css attributes. This would have then looked like the following.

    <style type="text/css">

        div {

          -rasta: "behavior/graphicscroll;horizontal=true;vertical=true";

        }

    </style>

The syntax just felt very unnatural. And worse than that, the CSS validator doesn’t validate CSS with vendor expansions, even though they are defined as such in the specification.

After twiddling around endlessly, I’ve settled on defining a css-like language, behavior stylesheets, without some of the restrictions of the existing CSS. I now have this code:

    <style type="text/vnd.rasta.bss">

        div

        {

          behavior: graphicscroll {

              horizontal: true;

              vertical: true;

            }

        }

    </style>

The  selector syntax is simply the CSS one, which means you can combine and match them in the same way you would define your stylesheets. The properties however are dynamic, with the first level name always matching a family of components (implemented as a loader) with a value matching the component, and a sub-group letting you define properties on that component.

You’ll notice I mentioned my first goal was for this to be contextual within the element. Because you’re still using selectors, nothing prevents you from declaring a value in your class attribute and do your selection on that. The same of course goes for ids.

Time will tell if this is as compatible with current UAs as it could be, and I have the feeling it will be ignored when necessary, but it’s extensible, simple enough, doesn’t require the script engine, leverages an existing html element and still passes in all versions of html that support the style element.

Wednesday, 20 August 2008

When a provider ditch its own product…

I’m currently researching Server 2008 VPS products available, and stumbled upon bytehouse’s offering:

Why use a Windows operating system?

Windows Hosting is only really needed if you require ASP (Active Server Pages), Access Databases or VBScript.

Why use a Linux operating system?

If you just need to host HTML (Hypertext Markup Language) or PHP Web Pages, then Linux Hosting would be the better and cheaper choice for you. Linux has a proven track record of performance, stability and security within the Web Hosting industry.

Oh, god, I have Linux envy now, thanks!

Tuesday, 19 August 2008

Come and listen (or talk) about asp.net MVC in Brighton!

VBug apparently didn’t learn their lessons from the last presentations and asked me to come back to deliver my Bingo asp.net MVC talk in Brighton, the day before ReMix! You can have a look at the event, and frighteningly it is already fully booked!

You can expect a run-down of the MVC pattern, plenty of code (but less than last time), and of course Bingo.net in its third version. I may have some surprises in stock so be prepared for anything.

For anyone down in Brighton on that day, I’ll be staying there so expect a full attendance at the pub. The only true way to start any conference is with a hangover.

Saturday, 16 August 2008

Using getElementsBySelector in ScriptSharp

I’m on my way to my second spike for one of my clients on playing with ScriptSharp to extend Rasta with Ajax functionality, and really wanted to be able to select elements as I would in CSS, using selectors (something I got quite used to with jQuery).

ScriptSharp comes with various assemblies you can link to. The one called sscorlib is a .net mapping over a javascript library that extends document to have a getElementsBySelector method. But for some reason, ScriptSharp doesn’t map that method.

So how do you call random code in ScriptSharp without resorting to evil eval code? You create a function of course! Here’s the snippet.

        public static DOMElement[] GetElementsBySelector(string selector, DOMElement root)

        {

            return new Function("return document.getElementsBySelector(selector, arg);", "selector", "arg")

                .Call(Document.DocumentElement, selector, root) as DOMElement[];

        }

We define a function that calls the correct javascript code, declare the argument names we will pass it, and finally call it by passing our selector and the root.

In one word, sweet.

Monday, 11 August 2008

Received this morning

Dear Sebastien

We are currently searching for a JOB TITLE to work in  CITY, COUNTRY  for DURATION plus extensions. This is a fantastic contract opportunity for a large multi-national client.

The ideal candidate must have the following skills: SHORT JOB DESCRIPTION.

A nice way to start the morning! Where do I sign?

Thursday, 7 August 2008

“It doesn’t work”

Something seriously cracks me up. I hear day after day people telling me one technology or another, one tool or another, fails in matching their expectation, and explain the situation by it doesn’t work.

As soon as those words are muttered by someone in a team with low knowledge of the toolkit they are dealing with, you see developers running around to work around the symptom, replace the technology, or completely screw up an architecture or a design just to make it work.

Just the same, while TDD and fast feedback cycles have brought to the development community an antidote to the press F5, it works, I’m l33t, you still find a large number of rogue developers that still manage to write no test, go head down in development, produce unmaintainable code and still manage to lift it off because the UI is shiny and the managers don’t have a clue about the importance of quality and maintainability, as they don’t have the responsibility of their v2 budget.

Whenever faced with an intellectual challenge, you have two categories of people: those who step up, learn and understand a problem before finding a solution, and the it doesn’t work and Oh I press F5 I’m good! developers. My word of advice to the latter, if you are given guidance and mentoring and refuse to step up, you will eventually be out of work. Embrace change, challenge yourself and don’t discard mentoring when it’s given to you.

Monday, 4 August 2008

Updating Hyper-V to RTM

As is usually the case when you’re under pressure to push a new release of an app for a client, something goes horribly wrong.

What went wrong tonight is simple: my Server Core install was never updated to hyper-v RTM, but windows update did its job fine on one of the client VMs that also runs Server 2008. Suddenly, the whole server is down.

Second install on the core install and still failing. I wonder how I’m going to apologize profusely to my client tomorrow. Oh the joy.

[Update 03:22: License wasnt activated properly, trying yet another install…]

[Update 04:05: Need my bed. Trying an uninstall of the role, followed by an update with the .msu. If that works I’ll reinstall the Hyper-V role tomorrow]

[Update 04:13: Apparently uninstalling the role rebooted the machine which then updated itself on its won with the RTM version. Don’t know if I should cry or laugh. Reinstalling the role now (seeing as there’s one less boot as previously expected, I have a boot to spare)]

[Update 04:27: All back in order, machines are up. Lost 6 hours of my life, less than impressed.]

Thursday, 17 July 2008

The testing anti-pattern

I've now finished my previous gig and the guys are busy chasing some recurring issues with the application. Because of its complex architecture, those issues are equally complex to understand and debug.

Most of the code in this application happens around things we cannot put under unit-tests, because they all rely on heavy integration: syncrhonization of data between tiers, integration with external RFID hardware and 3G modems, sqlce and its multiple connections issue, and other equally difficult things to debug without running the system with said external entities. As a result, our code coverage is very low, and while we do have fakes for most of those external entities, we have to think hard and strong about the value provided by tests relying on fakes, or we'd end up testing a fake implementation. Not very useful to say the least.

That made me think of some testing anti-patterns I see recurring a lot on various project, and I thought I'd highlight them. That will let me reevaluate my position in a year time, and I also know that some of the people still invovled in some of my projects are reading this blog, so it will serve as a constructive criticism for their next projects.

  1. I'll paraphrase Chad Myers, code coverage is the new LOC/day. Code coverage doesn't ensure quality, and the percentage is just that, a number. It needs to be put into context of the project: some areas do not need unit tests because they don't provide value. If you chase 100% code coverage, you're on a wild goat chase and you should reevaluate your understanding of the value of code-coverage (beyond the marketing bullsh*t).
  2. It is more important to have a code-base with low cyclomatic complexity and loose coupling than it is to have thousands of text. Evaluating code quality is not only about testing scenarios, it is also about maintainability, understandability, extensibility, etc. Use NDepend to understand where you need to refactor or rework part of the systems.
  3. Finally, and more importantly, I see no value in spending time after your code is released to write unit tests for the sake of it. Because the code has already shipped, you should not do any refactorings to it (or you'd end up with changes that you'd need to re-deploy and re-test, in which case you'll have to ship again, it all becomes a virtuous circle). So you end-up putting code under tests without bringing much value at all (again, except for increasing code coverage, see 1). Unit testing is a tool *during development* that helps you shape your objects and functionality and refactor your code until you get a satisfying result. Writing code aftewards doesn't serve much purpose.

There you are. With the advances like BDD, the focus on unit tests and code coverage by management should hopefully die a much to be celebrated death, as the focus shifts to the real issue: shared knowledge and process, arriving at a common definition of the what and why, and let developers handle the how.

Monday, 14 July 2008

asp.net MVC presentation - the results are in!

The nice people at VBUG just sent me the result of the evaluation forms, and I am very pleased with the result, as a vast majority seems to have enjoyed the talk.

A couple of points were raised by an apparently unimpressed attendee, and as those forms are anonymous I thought I would take the time to provide some feedback here.

The font size was too small to read from the back

The font had been set to quite a big font size, added with a very large DPI. I'm afraid the length of the room compared to the size of the projector made it very difficult to accommodate everyone. If anyone has suggestions to reach to more people while still managing to put 30 characters in the wideness of the screen, I'd be very interested. Any experience from using different fonts? Maybe high contrast with dark background? I'd be quite interested in learning a few new tricks to make it work better.

That said, there were spaces on the front row, and I did ask everyone to confirm my font size was alright with them. I should have indicated this was a strong hint for people to reshuffle based on their sight :)

Discover powerpoint, where are the diagrams?

This one is quite accurate, I do not have powerpoint slides as a rule: unless I have something very compelling to show in a diagram I don't see a point in showing one. I had a slide introduction for the previous version of the asp.net MVC talk I did at DNUG, but I find them distracting and get the audience passive. Especially as for MVC I would end up showing either a product roadmap (I don't think it's my job) or a diagram of MVC, which in itself seems of poor value.

While pictures do speak a thousand words, I think code does speak more efficiently to most developers. So I'd be interested in knowing what people think. Do you prefer a screencast approach of demoing step by step what is going on, or have an introduction to the concept of MVC with nice diagrams, arrows, blocks and what not? I tried both and felt the tutorial approach worked better, but from the presenter side of things it's always difficult to make those judgement calls.

Lots of mistakes in the demo

Yeap, some glitches here and there happened. Some, like the exception thrown when a view is not found, were on purpose to demo a feature, some others were due to my poor typing. On an interesting note, when presenting just like when working, apologizing for something no one has complained about usually seems to trigger complains that otherwise would have been silent. From now on I think I'll stop apologizing for my typing errors and rely on my audience to correct me (which I really like because it means they're reading and understanding the code as I type it. Spot on!)

The examples were poor

Oh, I did like my Bingo game. I'm just sick and tired of the same stuff everyone does with Northwind / NotNorthwind / Southwind. Storefront is there to provide you with an end-to-end real demo and does it so well. I'll stick to my guns on that one, boring things are one of the reasons I don't work in the city anymore :)

Conclusion

What worries me slightly more is the discrepancy between speaker rates and overall session rates, which leads me to think the presentation itself was less than excellent. I think it really comes down to two issues: expectations should be managed to reflect the code-intensive nature of the presentation, and the content is probably slightly too complex, with too many points being presented, including containers, dependency injection, inversion of control, testability, c#, javascript, html, etc.

On the bright side, only one of you has not been satisfied by the content or the presenter, with 67% rating the session as Very Good or Excellent, and 72% rating me as Very Good or Excellent (see my head growing out of proportion!), so a massive thanks to all of you for making this the presentation I've enjoyed the most so far.

P.S. I seem to remember two people chatting and laughing away during parts of the presentation at the back of the room. A good thing I had my back to the audience the whole time or I would have given the eye. Presenters do put a lot of effort in preparing those sessions, if the content or the presenter doesn't interest you, I apologize for failing to make the subject interesting to you, but I'd rather you stayed quiet or left. The law of two feet should apply, even during a presentation.

Sunday, 13 July 2008

asp.net MVC presentation

What an absolutely crazy week! I've been working flat-out all week and still have a mountain of TODO: all over my screen.

Thanks to everyone that came to the asp.net MVC presentation. It's a presentation I really enjoy and look forward to give it again to other user groups. I have the feeling that I'll finally be happy with the content the third time I deliver it. And suffice it to say that I'm working very hard to actually make the bingo.net game playable.

Apologies are in order as I'm late delivering the code (will get around to do it, probably around Tuesday) and the slides (slide.txt) and answering some of your emails. Please bare with me while I work through the backlog.

Friday, 11 July 2008

Alt.net UK Conference

Register now! http://altdotnet.org/events/5