From: Ben S. <bs...@vr...> - 2002-05-30 21:17:34
|
On Thu, 30 May 2002, Kevin Meinert wrote: > > I think that the translational aspect of a matrix is A PROPERTY OF THAT > > MATRIX. > > maybe this is your problem? :) actually it is a property, but how does > this matter? You're using that property of the matrix to initialize a > newly created item returned by the "make" function. right? It matters because I don't create properties of other objects, I ask for/retrieve them. Ignore what a "make" function is in GMTL and think about it. Do you really want to create a new translation vector or retrieve information about the matrix you have? > > > That property is generally considered as being the fourth column > > vector that makes up that matrix. Thus when I wish to retrieve the > > translation of a matrix I don't consider it creational, because IT ALREADY > > EXISTS as a part of the matrix. > > it is creational. 2 tip offs to the fact: > - a clone operation is creation. Agreed. > - the other tip off is that we're returning a temporary. > by definition, that is creational. But only as a consequence that the data structure required to pass on that information requires a Vec as a vessel for the data. I would say that creating a temporary object does make make a function creational since the intent is not to create the object and keep it around but to retrieve some data from an object which requires a temporary to transfer the data required by the language's syntax. > > > Now, consider this; we happened to implement our matrix as 16 floating > > point values. Thus to get the translation of a matrix, we must create a > > temporary vector to store those values in. What if instead we implemented > > the matrix as 4 column vectors? Then retrieving the translation from the > > matrix is no longer causes the construction of a new vector since just a > > reference to the fourth column vector would be returned. In that case, the > > function IS NOT CREATIONAL. > > but we dont implement it that way... and yes it would still be creational > (it is a clone, copy constructor, etc...)... EXACTLY! We call it makeXX because the syntax shows that we are returning a temporary rather than noticing that the semantics of the function dictate that it is really returning a distinct property of the object. > > > See, I think that the naming conventions used in GMTL are based on > > syntactic reasons rather than semantic reasons that may cause some > > interesting learning and usability problems since it goes against common > > Object Oriented design idioms. > > I don't agree... what book have you been reading? Not a book, but experience. When an object has a property, do you write a set/make method pair to manipulate it or a set/get pair? What does the industry standard tell you? What does any UML tool use while reverse engineering a diagram from the code to determine an object's properties? [snip] cheers, ----- Ben Scott Research Assistant VRAC bs...@ia... |