From: Braden M. <br...@en...> - 2005-11-17 20:53:56
|
I've been reminded recently that the distinction between "node_class" and "node_type" can be confusing; and I'm inclined to believe this is mostly because of how they're named. OOP tends to treat the terms "class" and "type" as synonyms. But in OpenVRML, a node_class is very different from a node_type. I believe node_type is pretty accurately named. It corresponds to what the VRML97 spec calls a "node type". node_class, on the other hand, doesn't exactly correspond to anything in the spec. A concrete node_class provides a sort of foundation for the implementation of a suite of node_types that share that implementation. As such, it is closest to the VRML spec's concept of a PROTO. However, while a PROTO could be considered a "kind of" node_class (and in fact OpenVRML implements PROTOs that way), not all node_classes are PROTOs. So I am considering renaming "node_class". The frontrunner in my mind at the moment is "node_metatype". This class is responsible for creating node_types; and it can create n! distinct node_types, where n is the number of node interfaces supported by the node implementation. "node_type_factory" has also been suggested. It is accurate; this class is a factory for node_types. However, it strikes me as less expressive than "node_metatype". Opinions? Other suggestions? Braden |
From: Reed H. <re...@in...> - 2005-11-19 21:23:09
|
I looked at node_class a bit but don't remember exactly how it works, but "factory" does imply a specific way of operating. Could a node_metatype in fact be a kind of node_type? Then you could just have "nothing but node_types all the way down" :) Either way, but yes, I did find the whole idea of node_class a bit mysterious at first, partly because I didn't know what _class meant. Most of us openvrml users won't need to deal with node_class anyway if we're not creating new types of nodes, right? So the documentation could just say so and we could skip over it. Reed Braden McDaniel wrote: > I've been reminded recently that the distinction between "node_class" > and "node_type" can be confusing; and I'm inclined to believe this is > mostly because of how they're named. OOP tends to treat the terms > "class" and "type" as synonyms. But in OpenVRML, a node_class is very > different from a node_type. > > I believe node_type is pretty accurately named. It corresponds to what > the VRML97 spec calls a "node type". node_class, on the other hand, > doesn't exactly correspond to anything in the spec. A concrete > node_class provides a sort of foundation for the implementation of a > suite of node_types that share that implementation. As such, it is > closest to the VRML spec's concept of a PROTO. However, while a PROTO > could be considered a "kind of" node_class (and in fact OpenVRML > implements PROTOs that way), not all node_classes are PROTOs. > > So I am considering renaming "node_class". The frontrunner in my mind at > the moment is "node_metatype". This class is responsible for creating > node_types; and it can create n! distinct node_types, where n is the > number of node interfaces supported by the node implementation. > > "node_type_factory" has also been suggested. It is accurate; this class > is a factory for node_types. However, it strikes me as less expressive > than "node_metatype". > > Opinions? Other suggestions? > > Braden > > > ------------------------------------------------------- > This SF.Net email is sponsored by the JBoss Inc. Get Certified Today > Register for a JBoss Training Course. Free Certification Exam > for All Training Attendees Through End of 2005. For more info visit: > http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click > _______________________________________________ > openvrml-develop mailing list > ope...@li... > https://lists.sourceforge.net/lists/listinfo/openvrml-develop |
From: Braden M. <br...@en...> - 2005-11-20 05:51:47
|
On Sat, 2005-11-19 at 16:25 -0500, Reed Hedges wrote: > I looked at node_class a bit but don't remember exactly how it works, > but "factory" does imply a specific way of operating. Could a > node_metatype in fact be a kind of node_type? Then you could just have > "nothing but node_types all the way down" :) A node_class is a factory for node_types. node_class and node_type have distinct roles. A node_type identifies a subset of the interfaces that can be supported by a node implementation and is a factory for nodes that have those interfaces. The node_class gives the node implementation identity and provides a way of creating node_types. Different node types can share implementation logic--that's not unique to OpenVRML; that's just the way VRML97 works. node_class is a place to hang that shared implementation logic. > Either way, but yes, I did find the whole idea of node_class a bit > mysterious at first, partly because I didn't know what _class meant. I agree it's vague. So is _metatype better? If not, then what? > Most of us openvrml users won't need to deal with node_class anyway if > we're not creating new types of nodes, right? So the documentation > could just say so and we could skip over it. That's true to an extent; though API changes that will be going in soon will raise its visibility a bit: I'll be making it possible to add and retrieve node_classes to/from a browser instance. Most casual users probably won't be interested in this functionality; but it does expose a rather important dimension of flexibility to those who need it. -- Braden McDaniel e-mail: <br...@en...> <http://endoframe.com> Jabber: <br...@ja...> |