health care, road trips, tech talk, occasional rant

properties

When I was at Autodesk, there was a guy who was a property evangelist, I don’t know what else to call him. He was one of those quiet mad scientist types (except for the cool Dead Kennedys tee shirts :), and he had developed his own little Computer Aided Design system (sorry, can’t remember his name or the name of his system) that was built around it. “It” being a pretty radical implementation of data-driven procedural code and inheritance of the values of that data, to create a surprisingly elegant and transparent syetem, both in it’s user interface and its implementation.

I’m a believer that the more of your intention you can put in data rather than code, the better your life will be, so I was instantly intrigued, and it was sort of love at first site for me, so I volunteered to be on an exploratory committee looking into using it in the mothership product AutoCAD, or at least using it somewhere. Nothing came of that, but those principles thoroughly informed my life’s work for the next two years, “objectifying” the AutoCAD Dimensioning entity — taking the hairball of 1000’s of lines of 80’s vintage C code and forcing it into the ARX/COM/VBA model we were going to debut with Release 14 (historically odd-numbered releases always suck and even-numbered releases are awesome and save the company, so after the clusterf–k of Release 13, Release 14 had better be damned good!).

I decided to take the opportunity of starting a new project from scratch to incorporate this philosophy from the beginning and see what it would do for me.

Cascading Style Sheets follow this property model, at least for the properties for which it makes sense. For instance, color and font are inherited, but border, margin and padding are not. Which makes perfect sense and is just the way it ought to be, right?!?!!

Anyway, commiting to this property management paradigm has cleaned up my code in a lot of small ways.

Gets your data scope under control nicely.   Anything but a strictly local variable oughta be a property (i.e. be part of a Property object), so if you need that datum, you need the object.

Much (most? almost all?) of web work is repetitive tasks running off of key-value pairs – populating forms, handing POSTs, handling GETs, building parameter strings, handling pull-downs, getting form data to-from database records – I could go on and on.  So if you organize your Property objects and name your data thoughtfully, you can develop a nice little library of Property methods to hide a lot of grunt-work.

This is not news to any of you who are geeky enough to have read this far, but I an trying to take it to the point of religion in terms of my personal code development, and the more I stick to the religion, the more I like my code, especially when I come back a month later or need to re-factor something.  Of course in working for “the man”, you’re always too busy hacking s–t up to make a deadline to indulge such refined sensibilities, but that’s the advantage of under-employment, at least you can work on your own s–t!