June 2005 Archives

Following References

It's often good to be able to refer to primary sources. I came across one such reference this morning for the Law of Demeter

For all classes C, and for all methods M attached to C, all objects to which M sends a message must be

  • M's argument objects, including the self object or
  • The instance variable objects of C.

(Objects. created by M, or by functions or methods which M calls, and objects in global variables are considered as arguments of M.)

That's an OOPSLA paper from 1988, with references going back further, notably to work by Parnas on decomposition into modules.

The Law of Demeter, when used in coordination with three key constraints, enforces good programming style. These constraints require minimizing code duplication, minimizing the number of arguments passed to methods and minimizing the number of methods per class.

I Hate Internet Explorer

| No Comments

I have a web application that uses XML fairly heavily. One advantage: I can generate XHTML output and test it with an XML parser. All goes well, until it comes to trying out the application with Internet Explorer.

Forms are displayed with the dreaded ' and friends: XML entities.

The trouble is this: XHTML defines the textarea element as containing PCDATA, which means characters like ' and & must be escaped or an XML parser will choke. IE however will display the entities in all their glory, as if textarea contained unvarnished CDATA

So, I have two choices: I can either have well-formed XHTML or I can have the page display properly in IE. Which is to say I have no choice at all.