Archive for the 'patternalia' Category

Tuesday, September 28th, 2010

Geek Thoughts: accomplishment

Whenever I undertake something big and challenging enough to be worthwhile, whether editing a W3C specification, running a more demanding distance, a new software project, or something else, I notice a similar trajectory of progress:

Ready to start: Full of adrenaline and excitement. Audacious goals seem readily reachable.

5-10% through: Whoa, this is difficult! And I’m only 1/10 or 1/20 of the way through? What was I thinking? It is important to ignore these thoughts.

One third point: Things seem to even out by this point. The hard slog presses on.

Halfway point: Wow, that’s halfway? Feels more like 90%!

Two-thirds point: Things are getting difficult. Should have treated this more like a marathon, less like a sprint.

90% point: There are two distinct kinds of endeavors from here. In what I call ‘type 1’ projects, the goalposts are strictly fixed, in which case a fresh burst of energy propels me through the glorious finish. But in a more sinister ‘type 2’ project, the finish line keeps receding away, as fast as or faster than I can approach. Depending on my level of stubbornness and anger, I will often finish anyway, just to spite the universe and the project masters, but at significant personal cost.

For anyone out there that has influence over large, ambitious projects, one of the most pivotal things you can do is make sure it is a type 1, not a type 2 project, as seen from the 90% line.


More collected Geek Thoughts at

Thursday, September 2nd, 2010

Is XForms really MVC?

This epic posting on MVC helped me better understand the pattern, and all the variants that have flowed outward from the original design. One interesting observation is that the earlier designs used Views primarily as output-only, and Controllers primarily as input-only, and as a consequence the Controller was the one true path for getting data into the Model.

But with browser forms, input and output are tightly intermingled. The View takes care of input and output. Something else has primary responsibility for mediating the data flow to and from the model–and that something has been called a Presenter. This yields the MVP pattern.

The terminology gets confusing quickly, but roughly

XForms Instance == MVP Model

XForms Model == MVP Presenter

XForms User Interface == MVP View

It’s not wrong to associate XForms with MVC–the term has become so blurry that it’s easy to lump variants like MVP into the same bucket. But to the extent that it makes sense to talk about more specific patterns, maybe we should be calling the XForms design pattern MVP instead of MVC. Comments? Criticism? Fire away below. -m

Tuesday, December 9th, 2008

XML 2008 liveblog: Automating Content Analysis with Trang and Simple XSLT Scripts

Bob DuCharme, Innodata Isogen

Content analysis: why? You’ve “inherited” content. Need to save time or effort.

Handy tool 1: “sort”. As in the Unix command line tool. (Even Windows)

Handy tool 2: “uniq -c”  (flag -c means include counts)

Elsevier contest: interface for reading journals. Download a bunch of articles, and see what’s all in there.

Handy tool 3: Trang. Schema language converter. But can infer a schema from one or more input documents. Concat all sample documents under one root, and infer–this gives a list of all doctypes in use.

trang article.dtd article.rng
trang issueContents.xml issueContents.rng
saxon article.rng compareElsRNG.xsl | sort > compareElsRNG.out

compareElsRNG.xsl has text mode output, ignores input text nodes, and checks whether the RNG has references to each element, outputing “Yes: elementname” or “No: elemenname”. (which gets sorted in step 3)

Helps ferret out places where the schema says 40 different child elements are possible but in practice only 4 are used.

Handy tool 4: James Clark’s sx, converts SGML to XML.

Another stylesheet counts elements producing a histogram. [Ed. I would do this in XQuery in CQ.] Again, can help prioritize parts of the XML to use first. Similar logic for parent/child counts; where @id gets used; find all values for a particular attribute.

Another stylesheet goes through multiple converted-to-rng schemas, looking for common substructure. Lists generated this way can be pulled into a stylesheet.

Analyze a SGML DTD? dtd2html -> tidy -> XSLT. Clients like reports (especially spreadsheets). The is more like lego bricks.


Thursday, October 30th, 2008

XiX (XForms in XQuery)

I’m pondering implementing the computational parts of the XForms Model in XQuery. Doing so in a largely functional environment poses some challenges, though. Has anybody tackled this before? How about in any functional language, including ML, Haskell, Scheme, XSLT, or careful Python?

I borrowed the book Purely Functional Data Structures from a friend–this looks to be a good start. What else is out there? Comment below. -m

Sunday, September 21st, 2008

My economic plan

Levy a $24,000, one-time tax, payable in installments over 10 years, against anyone who took out an interest-only mortgage (or various other high-risk instruments) during the previous 10 years, using the full nasty power of the IRS to collect (garnishing wages, etc.)

Take the proceeds and give it to homeowners who did NOT engage in high-risk activities as a tax refund.

Since taxpayers will be bailing out wall street anyway, why not move the blame closer to where it belongs? -m

Friday, July 25th, 2008

Complete this sequence…

In C, if you find yourself writing large switch statements (or rafts of if statements), you should consider using pointers to functions instead.

In C++, if you find yourself writing large switch statements (or rafts of if statements), you should consider using objects and polymorphism instead.

In XQuery, If you find yourself writing large typeswitch statements (or rafts of if statements), you should consider using _______________ instead.

Comment here. -m

Tuesday, April 29th, 2008

How to negotiate

Tips from Leo Reilly in How to Outnegotiate Anyone (Even a Car Dealer!).

  • Be patient. If you insist on having something today, know what you want and be prepared to pay for it.
  • Never disclose your deadline.
  • Cultivate a positive relationship with the other party.
  • Don’t make the other side look stupid (for a prolonged period of time).
  • The best negotiators talk only 40% of the time.
  • The most intimidating thing you can do to someone trying to intimidate you is to not be intimidated.
  • Never be the one to make the first offer.

The most critical aspect of negotiation is the opening offer. Four opening gambits are possible:

  1. Lowballing. Offering substantially less to create psychological downward pressure on the price.
  2. “Up against the wall.” Forcing the other side to make more concessions than you do.
  3. Anchoring. Having both sides make equal concessions.
  4. “The Kiss.” Like anchoring, except allowing the other side to take one final (often minor) concession.

If you want to find out what Leo says about how to buy a car, in 5 minutes, below dealer cost, you’ll have to pick up the book though. :-) -m

Tuesday, January 1st, 2008

My new year resolution

Holding steady at 1280 x 854 but due for an upgrade soon.

Seriously, if you find yourself setting various goals just because something on the calendar changed, you probably don’t have the long-term motivation needed to see it through, which is why so many new years’ resolutions lie in broken heaps by mid February. If you think something is worth doing (like this for example), then forget the calendar and do it.


Monday, December 31st, 2007

Should documents self-version?

This blog page at the W3C discusses the TAG finding that a data format specification SHOULD provide for version information, specifically reconsidering that suggestion. As a few data points, XML 1.1 (with explicit version identifiers) is something of a non-starter, while Atom (without explicit version identifiers) is doing OK so far–though a significant revision to the core hasn’t happened and perhaps never will.

In a chat with Dave Orchard at XML 2007, I suggested that the evolution of browser User-Agent strings might be a useful model, since it developed in response to the actual kinds of problems that versioning needs to solve.

Indeed, the idea seemed familiar in my mind. In fact, I posted it here, in Feb 2004. The remainder of this posting republishes it with minor edits for clarity:

‘Standard practice’ of x.y.z versioning, where x is major, y is minor, and z is sub-minor (often build number) is not best practice. If you look at how systems actually evolve over time, a more ‘organic’ approach is needed.

For example, look at how browser user agent strings have evolved. Take this, for example:

Mozilla/4.0 (compatible; MSIE 6.0; MSIE 5.5; Windows 98) Opera 7.02 [en]

Wow, if detection code is looking for a substring of “Mozilla” or “Mozilla/4” or “Mozilla/4.0”, or “MSIE” or “MSIE 6” or “MSIE 6.0” or “Opera” or “Opera 7” or “Opera 7.0” or “Opera 7.0.2” it will hit. If you look at the kind of code to determine what version of Windows is running, or the exact make and model of processor, you will see a similar pattern.

Since this is the way of nature, don’t fight it with artificial, fixed-length major.minor versioning. Embrace organically growing versions.

The first version of anything should be “1.” including the dot. (letters will work in practice too) All sample code, etc. that checks versions must stop at the first dot character; anything beyond that is on a ‘needs-to-know’ basis. A check-this-version API would be extremely useful, though a basic string compare SHOULD work.

Then, whenever revisions come out, the designers need to decide if the revision is compatible or not. A completely incompatible release would then be “2.”. However, a compatible release would be “1.1.”. All version checking code would continue to look only up to the first dot, unless it has a specific reason to need more details. Then it can go up to the 2nd dot, no more.

Now, even code that is expecting version “1.1.” will work fine with “1.1.1.” or 1.1.86.” or “”.

Every new release needs to decide (and explicitly encode in the version string) how compatible it is with the entire tree of earlier versions.

Now, as long as compatible revisions keep coming out, the version string gets longer and longer. This is the key benefit, and why fixed-field version numbers are so inflexible. (and why you get silly things like Samba reporting itself as “Windows 4.9”).

One possible enhancement, purely to make version numbers look more like what folks are used to, is to allow a superfluous zero at the end. This the first version is 1.0, followed by 1.1.0,, (this next one made an incompatible change) 1.2.0, and so on.

So if a document needs to self-version at all, perhaps a scheme like this should be used? -m

Monday, October 29th, 2007

Five percent rules

Many things in life are simpler when you only need to be within 5%:

  • Pi is pretty much 3
  • Water weighs pretty much 8 pounds a gallon
  • A quart is pretty much a liter (and a gallon, 4 liters)
  • A year has pretty much 360 days, and pretty much 31 million seconds
  • The speed of light is pretty much 300,000 km/s, which is pretty much one foot/nanosecond

Of course, there’s even more things that get more convenient when you have 10% or 20% to work with… -m

Sunday, September 16th, 2007

Evaluating fiction vs. evaluating libation

My Copious Free Time(tm) has been filled lately by two different evaluation projects. One is the 2nd Annual Writing Show Best First Chapter of a Novel Contest, for which the first round of judging is just winding up. The main benefit for contest entrants is that every submission gets a professional critique of at least 750 words. But additionally, each submisison gets a score on a 50-point scale, based on:

  • 10 points for Story. Is it a compelling read with a great hook? Are we engaged?
  • 10 points for Style. Is the writing smooth and tight, without awkward constructions, extraneous verbiage, and redundancies?
  • 10 points for Dialog. Is the dialog natural and does it move the story along?
  • 10 points for Character. Are the characters interesting? Do we care about them?
  • 10 points for Mechanics. Are grammar, spelling, and punctuation correct?

I’m also attending some classes aiming toward becoming a Certified Beer Judge (details on Meadblog). This isn’t as fun as it sounds. (Well, OK, maybe it is…). The idea is to build up better sensory perception so that my personal brewing and cooking projects can benefit. But the upcoming test is 70% written essay questions like “Identify three distinctly different top-fermenting beer styles with a starting gravity of 1.070 or higher, and describe the similarities and differences between the styles”. 30% of the test is based on actual tasting and filling out a tasting sheet. Of interest, the scoring here is also based on a 50-point scale:

  • 12 points for Aroma.
  • 3 points for Appearance.
  • 20 points for Taste.
  • 5 points for Mouthfeel.
  • 10 points for Overall Impression.

The interesting part is that there’s similarities between the two tasks. For both, I need to work off of physical paper, not in my head on on a computer screen. For both, I first “skim”, building an overall impression, then dig down into individual categories to assign a score for each one. Then I step back and look at my numbers, and check whether everything makes sense and accurately records my impressions. When I’m satisfied, I add everything up and am done.

Most day-to-day problems aren’t so well structured or normalized, but nonetheless, I find myself tackling all kinds of problems with a similar approach. There you have it. Writing and drinking beer make you a better person. :) -m

Monday, July 16th, 2007

Beautiful Code

If it’s been quiet on this front it’s because I’ve been engrossed in my continuing education. Andy Oram sent me a copy of Beautiful Code, a thoroughly enjoyable work from O’Reilly. If you like stretching your brain by reading code-intense essays from top-tier coders, I recommend this volume. In particular, I’m been digging into Douglas Crockford’s Top Down Operator Precedence chapter.

Other than that, some interesting BJCP classes, but I’m keeping that non-tech stuff over on meadblog. -m

Friday, January 26th, 2007

Bill de hÓra: REST API pattern

my new publishing technique is unstoppable – but why limit to blog posts?

GET Introspection URI
   scan the list of workspaces for the collection you want to post to
GET to Collection URI
   read the nice [atom] feed 
POST to the collection URI
   push an item formatted as [a nice atom entry]
GET or HEAD to item URI
   grab the item
PUT or DELETE to item URI
   change or delete the  item


Monday, July 10th, 2006

Billable Events

A little bit back, Cringely had a brilliant column about billable events and the last mile. Everything the telcos (and others) do these days is primarily aimed at creating billable events. This includes the net neutrality debates.
In fact, at&t is so skilled at revenuing, they can generate billable events out of nothing at all. Here’s a short quote from a recent phone bill:

The FUSF pass through fee charged to some customers has been reduced and credit may be due. Due to the large volume, any applicable credits generated in 2005 or 2006 may appear on a future bill. The average one-time credit will be less than $1.50.

No problem manufacturing extra charges in “large volume” since at least last year, but when it comes to refunds (and very partial refunds from the look of it), it sure takes a long time.

Speaking of long times, another thing the telcos aren’t very quick about is transferring service. Took them 11 days to establish service at my new address, with a $37 billable event to boot. But I’m back online now. If you’ve sent email in the last 2 weeks and haven’t seen a response, it might be a good idea to resend. -m

Monday, June 12th, 2006

Reviving Patternalia

About a year ago, on this blog I started a series called “Patternalia”, examining various patterns in technology and life in the style of a popular Christopher Alexander series. Over the coming weeks and months, I’m going to revive the series, first of all by getting the old entries into WordPress. Everything will be under the patternalia tag for safe keeping.

Now a cynic might think this is a cheap way to keep my blog rolling during a particularly busy point in my career. But even cynics follow patterns. :) -m