[Reality] Wearable computing

Jp Calderone reality@twistedmatrix.com
Tue, 17 Sep 2002 15:35:23 -0400


--cNdxnHkX5QqsyA0e
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

  I'm trying to wrap my head around the pragmatic differences between
inheritance and adapters, and not getting very far.  Wearable computing
seems like a good example to play with so below I'm going to try to outline
what is necessary for it, and then someone can tell me what's up.

  A wearable computer must able to be treated as an article of clothing.=3D=
20
Wear/Unwear, track its own state (who is wearing it, where it is legal for
it to be worn, etc).

  It must also be able to be treated as a computer.  Turned on/off,
"interfaced" with (typed on, spoken to, etc) and track its own state (what
does it know, how much power does it have left, who can use it, etc).

  As it stands, Clothing is a subclass of thing.Thing, which means it can do
all its own state tracking, and __implements__ the appropriate interfaces to
be interacted with.  If the 'computer' half of things, let's call it
"Electronic" for now, is also a subclass of thing.Thing, we have the usually
MI problems (hard to do initialisation properly, etc), but it can keep track
of its own state.  If, on the other hand, Electronic is an Adapter, it can
be registered for whatever Clothing subclass you want and things will
probably work ok (if I understand correctly).

  With cooperative method invocation (super(), requiring 2.2), the
initialisation problems can probably be worked around.  But if this is
indesirable (Inheritance is bad, right? :P), then clearly there's an
asymmetry here.  Why does Clothing get to be a thing.Thing subclass and
everything else that wants to play with it have to be an adapter?  Worse,
what if two other things that want to play with it then also want to play
with each other, in its absense?  Then there's no thing.Thing subclass, so
something new must be created.  The way I see it, I think Clothing should
become an adapter, along with pretty much everything else that subclasses
thing.Thing that's now in the Reality "stdlib".

  Sound reasonable, or have I just missed something complete? :)  I'll hold
off on any more mods to Reality until I grok this point, because I'm pretty
sure I'll be writing broken code until then.

  Ineffectively-thrashing'ly, Jp

--=20
   Know what I pray for? The strength to change what I can, the inability to
accept what I can't and the incapacity to tell the difference.    -- Calvin
--
 3:00pm up 119 days, 15:53, 5 users, load average: 0.11, 0.05, 0.01

--cNdxnHkX5QqsyA0e
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9h4P6edcO2BJA+4YRArVnAJ4r9AkXQkodaSv6ylfVbQqzKU+loACfVVAq
dZM+a3tY7JGszmeOHGIqDvY=
=8DWw
-----END PGP SIGNATURE-----

--cNdxnHkX5QqsyA0e--