[Liblas-devel] .net/mono bindings in c#

Mateusz Loskot mateusz at loskot.net
Fri Aug 8 08:54:49 EDT 2008


Howard Butler wrote:
> 
> On Aug 7, 2008, at 4:23 AM, Martin Rodriguez wrote:
> 
>> Hi:
>>
>>
>>> Fixed http://liblas.org/ticket/64
>>
>> Thank you so much, but I find more bugs not only that:
>>
>> LASHeader_GetCreationDOY ->LASHeader_SetCreationDOY
>> LASHeader_GetCreationYear->LASHeader_SetCreationYear
>> LASHeader_GetDataFormatId-> LASHeader_SetDataFormatId
>>
> 
> Fixed.  http://liblas.org/changeset/819
> 
> 
>> LASHeader_SetScale ?????    Why not 3 setters like the 3 getters???
>> LASHeader_SetOffset?????   Why not 3 setters like the 3 getters???
>> LASHeader_SetMax?????   Why not 3 setters like the 3 getters???
>> LASHeader_SetMin?????   Why not 3 setters like the 3 getters???
>>
> 
> These functions mimic the C++ API, which sets the values in triplicate.  
> As to whether or not this is a good approach, I could be convinced 
> either way.  I think the main reason we make sure to set all three at 
> once is if a developer forgot to set one of the values, it might be very 
> hard to figure out why your data has changed or isn't coming out right.  
> Mateusz may have some more thoughts on this.

Hobu,

You are right.

I'd add that these setters are based on logical design instead of 
physical structure. IOW, user sets all values of offset or scale at once
instead of each value in separate call.

Personally, I prefer that approach even in plain OOP like C++ or C#.
This way data integrity and object consistency is assured.

Dividing setters by physical structure of private data members inside a 
class makes things more complex to understand to users and is error 
prone (ie. user forgets to set 3rd value of scale by some accidents).

Yet IOW, scale or offset is like a single object or value, but from 
nature built up with 3 numbers. For single object, one setter is the 
choice. If you have a math class that manipulates complex numbers, 
setter accepts single object internally built with two components: real 
and imaginary unit.

Let's treat these all these 3 numbers of scale or offset as a single 
object consisting of 3 components.

Hope it makes sense.

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org



More information about the Liblas-devel mailing list