Skip to content

WebPatterns discussion at the Web Standards Group

Recently, the excellent web standards group mailing list had a discussion on reusable HTML chunks, which also included a little discussion of webpatterns. I posted a shortish comparison of how patterns compare with reusable code snippets, which I’ll repost here, as I think the issue is important.

Probably the biggest problem with web patterns is the term “pattern”. Most of us think about persian carpets or something visual when we hear the term “pattern”. But it has a precise technical meaning in this context, so I decided to go with it, despite the potential for confusion.

Originally, when I was first thinking about this whole issue (years ago now), I was thinking in terms of “templates” or reusable chunks. This is something which Doug Bowman and I chatted about a lot in the aftermath of WE04, and more recently Russ Weakley and I spoke more about, which took me more in the direction of patterns over more simple “templates”.

The drawback with shared templates is while these are immediately useful, they are also trivial. In the sense that they can be unthinkingly used, and by using them, no one gets anything other than the short term benefit of a shortcut to a quicker page. In real world situations, while little reusable chunks are very useful, the whole idea does not scale up well. One you reach even major page fragments, they tend to become limiting, so people would start bending them to suit their needs, and all of a sudden you don’t actually get the benefits of reusable chunks anymore.

How do patterns differ? Well, a pattern (such as “login box”) certainly should include an example implementation, even a “canonical” one, but more importantly, would also outline the

  • typical use cases for the pattern

  • other patterns which work well with this pattern

  • patterns which this pattern plays a part in

  • when NOT to use the pattern (simple example, radio buttons and checkboxes are often used interchangeably – but they are separate patterns, radio buttons should not be used when you want to choose more than one option out of three)

  • Semantics – the pieces of the pattern all have usable semantic names – in the login example, the whole chunk itself would have a name, then each of the individual pieces may have names – so you get common semantics for “free” – that way you can all of a sudden reuse CSS as well as HTML. Cool eh?

So along with resuable code, you a whole wealth of knowledge which has been acquired by developers over time (an important thing about patterns is that they aren’t novel inventions, rather, they capture and formalize well established current practice – they “pave the cowpaths”)

Hope this helps make more sense of the aim of web patterns – at https://webpatterns.org and with the patternquiz there, I started in a top down way – but the bottom up way would work well too.

{ 2 } Comments

  1. patrick h. lauke | February 4, 2006 at 9:00 pm | Permalink

    one thing that i’ve been thinking about with this whole pattern discussion: once we have a sizeable amount of the patterns, categorised and aptly named, this could open up the possibility of a meta-markup language that lets one easily build (or at least prototype) pages in some XML style format (effectively defining what building blocks are in a page). this could then conceivably be transformed via XSLT (which would act as a library of patterns, matching meta-markup to actual complex constructs). you could even build a fast design tool that has drag’n’drop patterns in a bucket (they could even be treated as objects with their own “ins and outs” that would influence internal bits like “where is the login box submitted to”) that can be assembled like lego. hmm…maybe i’m getting a head of myself here…or maybe i’m onto something. i’ll have to play with some ideas (if nothing else, this sounds like an interesting concept for a simplified template engine in a cms, similar to phpnuke and co where modules can be added to pages)...

  2. john | February 4, 2006 at 9:16 pm | Permalink

    Patrick,

    very thoughtful observation. I’m not sure whether UML would be appropriate for that (always thinking about reusing existing technologies am I) but more likely, a language which captures the semantics of the patterns as developed.

    Look forward to discussing it more.

    john

{ 1 } Trackback

  1. one odd | February 27, 2008 at 3:03 am | Permalink

    one odd…

    calculi Selkirk beatable blindly!...

Post a Comment