Wednesday, 14 October 2009

Mrs Focker and internet damage

“The Net interprets censorship as damage and routes around it.” – John Gilmore

It’s been a pretty intense week so far in what Newsnight calls “cyberspace”.

From BBC News:

When is a secret not a secret? When it's on Twitter.

An injunction served on the Guardian and at least one other national newspaper, was meant to stop the papers reporting that the MP Paul Farrelly, had tabled a Parliamentary question about the oil traders Trafigura and its solicitors Carter-Ruck. And it succeeded - up to a point.

…

The social networking site Twitter, was soon awash with posts deploring a threat to media freedom and the reporting of Parliament.

What Trafigura and Carter-Ruck have been a victim of this week, is the combined effect of the internet interpreting censorship as damage (and routing around it), with the Streisand effect. 

Barbara Streisand is one of those people who are *supermegafamous* and you know what for, but sometimes it’s hard to recall anything they’ve actually done.  Her IMDB list is impressive but I try and remember seeing her in something and I mainly 404.  I only really know her as Mrs Focker in ‘Meet the Fockers’.

250px-Barbrahouse1I digress. The Streisand effect is the act of trying to suppress information but instead generates a meme.  A giant, unstoppable, self perpetuating, amplifying wave of attention. Precisely because you tried to engineer the exact opposite.  Babs tried to stop a photograph of her house being part of a coastal erosion study and as a result, we all know her house looks almost exactly like the one in this picture on the right. [source:wikipedia].

Oops.

There’s no doubting that it was Twitter and Wikileaks that facilitated this week’s events.

Some people say that Wikileaks could become as important a journalistic tool as the Freedom of Information Act.

I don’t doubt it for a moment.  I think the rules are changing.  I think they’re changing as significantly as they did when the web went mainstream in the late 90s.  I think some organisations are going to find out if sunshine is the best disinfectant.  I think it’s going to be interesting.

It’s also important to note that despite the media reporting this as a battle won, it isn’t over yet.

Monday, 5 October 2009

Brighton ALT.NET Beers - Tues 6th Oct 7pm at The Lord Nelson

Now the nights are drawing in, it's high time for another ALT.NET Beers. We're going to try another venue, because, as great as the Prince Albert has been, sometimes we clash with bands being on upstairs which can make it difficult to nerd out.

So the new venue is The Lord Nelson pub which is a couple of doors down from the Albert.
http://tinyurl.com/LordNelsonPub

Hope to see you there!

Sunday, 26 July 2009

Simple URL Rewriting with ASP.NET and Managed Fusion UrlRewriter

You can download the example discussed in this post here.

Why rewrite?

The default URLs from ASP.NET Webforms (and possibly even MVC) are not fantastic for SEO (Search Engine Optimisation).

You know the sort:

http://example.com/Questions/Question.aspx?ID=345

Google doesn’t really like URLs like this. It doesn’t say much about the page it represents. It might have an idea that it’s something to do with question 345 but that could mean anything. The file extension (.aspx) doesn’t help either.

What Google likes to see, is something a bit more like this:

http://example.com/questions/345/how-do-i-do-something

Well with Webforms you’re a little stuck, as the URL is dependent on the file structure of your solution and name of the files.

Unless..

..you perform some voodoo URL rewriting.

Example setup

We are going to map an incoming request to a URL like this..:

http://localhost:52468/questions/1337/how-do-i-do-something

..to the default page URL like this:

http://localhost:52468/Default.aspx?ID=1337

To achieve this I’m going run through a very simple rewriting setup.

Nick has a more detailed example here and you should also check out Scott Guthrie’s post here. (N.B. My example is based on Nick’s)

First, create a standard web application:

createwebapplication

Then download UrlRewriter from Managed Fusion. Unzip it, put the dll and pdb in a directory of your choosing and add a reference to the dll.

addreference

Next, create a new text file called ManagedFusion.Rewriter.txt and place the following in it:

createrewritertxtfile

In your Web.Config, add (or copy from the example) these following sections:

configuration -> configSections ->

image

configuration ->

image

configuration -> system.web -> httpModules ->

image

configuration -> system.webServer ->

On the opening modules tag, set runAllManagedModulesForAllRequests to true and add the RewriterModule so is becomes:

image

configuration -> system.webServer -> handlers ->

image

And that’s it!

Note that the application actually ignores the slugs at the end of the URL so your app can generate what it likes for them.

Also note that the rewrite rules can be far more complex than what is shown in the example. UrlRewriter’s rules are based on the Apache module, mod_rewrite.

Further reading:

Monday, 20 July 2009

Brighton ALT.NET Beers: Tuesday 4th August, 7pm at The Prince Albert


I know we talked about possibly of doing this one outside, but the weather has been too changable of late, so let's convene indoors.
At the pub.
Ace.
So I'm delighted to announce that the next Brighton ALT.NET beers will be:

Tuesday 4th August, 7pm at The Prince Albert.

If you're a .NET developer in the area and you haven't been yet, do come along. The group is super-welcoming. We want to hear your ideas about how you think software should be written.
Hope to see you there!
P.S. Hopefully we'll get a chance for the even-less-formal beers on the beach in Septemeber.

Tuesday, 26 May 2009

Brighton ALT.NET Beers: Tuesday 2nd June, 7pm at The Prince Albert

Once again, a big thank you to all of those who turned up to the Brighton ALT.NET beers on Tuesday 5th May.  Despite being the first day after a bank holiday, numbers were still good and many topics were discussed in an informal setting over a pint or two.

More drinking and thinking this coming Tuesday:

Brighton ALT.NET Beers, Tuesday 2nd June, 7pm at The Prince Albert.

The topics voted for discussion in the previous session were:
  1. Data Transfer Objects (DTOs)/View Presentation Models
  2. Do you Fitnesse?
  3. Why are Singletons considered harmful?
  4. Except for C#, what is another good language to know/learn now?
  5. Functional Programming.
  6. Which view engines are you using?
  7. Liskov substitution principle.
  8. Is the Entity Framework any good?
  9. How do you make youself a better developer?
  10. Favourite programming books.
  11. How can you make money from software?
A healthy list of topics! 

I'm not going to go over each one, but some lists came out of a couple of discussions.

They were:

4. Except for C#, what is another good language to know/learn now?
10. Favourite programming books.

Monday, 27 April 2009

Brighton ALT.NET Beers - Tuesday 5th May 2009 - 7pm @ The Prince Albert


The next Brighton ALT.NET beers will be this coming Tuesday 5th May 2009 - 7pm @ The Prince Albert public house in Brighton.

It's very easy to find as it's right next to the station:

http://tinyurl.com/PrinceAlbert-Brighton

The last one was a great success, with a range of interesting topics discussed in a very friendly open forum.

You can see previous posts on what the format will be and a review of the first meeting.

Hope to see you there!

Thursday, 2 April 2009

Brighton ALT.NET Beers - A Review


Huge thanks to everyone who turned up to the inaugural Brighton ALT.NET beers. There were 16 of us in total (a fittingly nice binary number) and we had a lively discussion on a wide range of topics. I definitely came away with my mind opened about a couple of things, which is certainly the whole point.

The topics voted for discussion were:

  1. What’s your favourite way of doing data access?
  2. Why do you do .NET?
  3. Joining a non-ALT.NET team.
  4. Do you DDD?
  5. Alternative frameworks such as S#arp Architecture.
  6. Avoiding generics hell.
  7. 'Walking skeleton' architectures.

What follows certainly isn’t an exhaustive dissection of the conversation but I hope a reasonably accurate reflection of the mood in the room. Please post amendments/corrections below if you feel it’s inaccurate or I missed an opinion.

1. What’s your favourite way of doing data access?

The general consensus was that using an O/RM was the best method of database access. The main reason cited was the massive reduction in effort in writing/generating stored procs etc and then having to maintain them. Linq-to-SQL and SubSonic were discussed but the overriding choice was NHibernate.

It was clear that pretty much everyone had done the stored-procedure maintenance or DAL generation gubbins before (many, many times over) and if you’re not using NHibernate or something almost as good, you’re probably doing far more work on your data access than is necessary.

(There has been criticism in that the ALT.NET movement can be a little dogmatic when it comes to NHibernate. However you can’t escape the fact that the experience that most of the 16 people in the room have had so far, has been overwhelmingly positive. I think that everyone who had used it in anger agreed that it is currently by far the quickest/most mature/easiest/cleanest way currently of doing data access.)

2. Why do you do .NET?

As this was the first meeting it was nice to go around all 16 participants and ask what attracted them to .NET development. Generally people discovered it via VB, classic ASP and C++. First impressions of the .NET framework were pretty positive and it compelled people to find out more. I think I’m right in saying that everyone in the room including all the ex-VB developers now use C# as their primary language for .NET.

3. Joining a non-ALT.NET team

This discussion was centred on what happens when you join a team with little or no awareness (for whatever reason) outside the Microsoft eco-system. Do you try and convert people with death-by-PowerPoint? Probably not the most effective stratagem. Is it better to start with small bits of projects at first and ALT.NETify them to show people very plainly that it will make their lives easier? What’s the first thing that should be introduced? Unit testing? TDD? Continuous integration? IoC? The was a feeling that a lot of the ALT.NET stuff doesn’t really work to its full potential in isolation, but it’s probably best to start small, with things that show immediate value and build up from there. One suggestion was have a CI build server first, then write some breaking tests when fixing defects.

4. Do you DDD?

It was acknowledged that a secular tome of significance on Domain Driven Design (DDD) is Eric Evans’ ‘Blue Book’. (See Mike Hadlow's blog post here).

There were some great points made about how to identify an object, does using the ID generated by the database break the goal of persistence ignorance? Is using the ID a sensible pragmatic solution to the common problem of establishing identity/equality? Can using the ID in URLs help when it comes to REST and SEO? If an entity is incomplete in some way, does that signify that another intermediate entity with a different business meaning is required?

5. Alternative frameworks such as S#arp Architecture

Just over half the room was aware of Billy McCafferty’s excellent S#arp architecture framework. There was a brief discussion on why SharpArch is currently easiest way to rapidly build a ALT.NET type ASP.NET MVC system with NHibernate, NUnit, Castle Windsor and Rhino mocks.

If you haven’t tried Sharp Architecture yet and you do ASP.NET MVC, do check it out because it is fabo:

http://www.sharparchitecture.net/

6. Avoiding generics hell

Dare Obasanjo has a nice summary of what this can mean here. There doesn't seem to be a clear answer to the problem at this time. Covariance/contravariance coming with C# 4.0 will help.

7. 'Walking skeleton' architecture

This topic was about merits of whether or not is was worthwhile to have a separate framework you use for smaller/simpler projects. What happens when the requirements expand and the simpler framework gets in the way because it’s so brittle? Is using IoC total overkill on a brochure site? Where does one draw the line? Does it take more effort to maintain a separate framework than bend the framework you use for complex projects to simpler ends? Is everything else outweighed by the comfort and predictability of a smoother complexity gradient?

Conclusion.

This was an excellent meeting. It showed the massive enthusiasm in the Brighton development community for wanting to seek out the best way of creating excellent software.

Let's do it again.

So as not to clash with the London ALT.NET beers (last Tuesday of the month), we will hold our beers on the first Tuesday of the month so I'm delighted to announce that our difficult second meeting will be at the same time at the same place on Tuesday 5th May 2009, 7pm at The Prince Albert, Brighton. I will mention it again nearer the time, but you can pencil it in your PDAs right now. If you're following me (@iainholder) or Mike Hadlow (@mikehadlow)on twitter you deffo won't miss it.

Hope to see you there.