Accessor vs. Transreptor

Poster Content
nk4um Administrator
Posts: 607
November 3, 2007 14:45From the ROC viewpoint
The way I look at it is that if you SOURCE a resource then it is an accessor that is providing the mechanism to reify a representation for that resource. Likewise if you sink a representation to resource an accessor provides the mechanism.

If a client of a resource wants a different representation from the one that an accessor has been implemented to give then a transreptor, short for TRANS-REPresentation-adapTOR, can provide a service to convert from one representation to another. NetKernel will automatically mediate representations between resources and their clients by seeking transreptors and sequencing their invocation.

Tony
Like · Post Reply
nk4um Administrator
Posts: 158
November 2, 2007 22:37
The short answer is to use a transreptor for isomorphic lossless conversions and an accessor otherwise.

If you look at the Image resource model (in NetKernel 3.3) you''ll find that it supports a single resource type (an image) and services (implemented as accessors) for crop, rotate, dither, etc. On the edges of the resource model are accessors to convert to/from other resource models (e.g. the text to image accessor that converts information from a  textual form into an image resource type).

Then there is the conversion of the image resource type to/from JPEG, GIF and PNG. Those are transreptors.

Does this help?

Randy
Like · Post Reply
nk4um User
Posts: 47
November 2, 2007 22:22Accessor vs. Transreptor
What are the rules (or principles) for deciding whether to create an accessor or a transreptor component to get some piece of information?
As with any powerful system, there are alternate ways of achieving the same thing. I''m looking for guidelines here.

As a (made up) example, I might have an application which is representing individual pixels abstractly (don''t ask me why).
Each pixel has an actual numeric data value, which is considered the "main" value of the pixel.
But each pixel could also have meta-data associated with it, such as a pointer to the lookup-table which maps the pixel value to a color, or an X-Y location for the pixel.
For the application, I could create a pixel aspect which holds all this information.
If I wanted to turn that pixel object into XML I might create a PixelToXDA transreptor. Presumably, this could/would represent all the pixel information (including meta-data) as XML.
But what if I want to get the pixel''s "main" data value...I could do this as a PixelToInt transreptor or as a getValue accessor.

So, to repeat, are there any rules (or principles) for deciding whether to create an accessor or a transreptor component to get some piece of information?
Like · Post Reply