Boost logo

Boost :

From: Dragan Milenkovic (tyrant_at_[hidden])
Date: 2002-05-13 10:40:36


On May 11, 2002, Victor A. Wagner, Jr. wrote:

> At Saturday 2002/05/11 13:32, you wrote:
> >Hello,
>
> [deleted]
>
> >And x doesn't even have to exist. It can be something abstract...
> >The user's code is then full of something like
> > foo.set_x(foo.get_x() + 10);
>
> I think if you want "abstract" the user's code should be full of something
> like:
> foo.x += 10;
>
> the intent of the code, IMO, is a lot clearer

I agree. But that still doesn't mean it is useless. I have one example
on my mind. Consider some OpenGL wrapper class... Or let it be OpenGL
implementation of some abstract renderer... Anyway, it uses the state
machine, so we have 'bool lighting', 'Matrix4 modelview_matrix', and
many, many more variables. I would prefer these to be attributes
instead of get/set functions.

Also, I often find a new C++ library I could use and looking at the
documentation (possibly doxygen-generated) there are many get_this,
set_that functions that divert my attention to remembering (beside the
possibly wierd names of what they are setting) the coding style used.
If some "Widget" has its "size" that can be changed, the most natural
way of specifying that is by an attribute named size. Documentation
can be clean and simple.

Of course, this is only my oppinion...

>
> [deleted]
>
> >Dragan Milenkovic
> >
> >
> >_______________________________________________
> >Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
> Victor A. Wagner Jr. http://rudbek.com
> PGP RSA fingerprint = 4D20 EBF6 0101 B069 3817 8DBF C846 E47A
> PGP D-H fingerprint = 98BC 65E3 1A19 43EC 3908 65B9 F755 E6F4 63BB 9D93
> The five most dangerous words in the English language:
> "There oughta be a law"
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>

-- 
Dragan Milenkovic

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk