[Development] Some Qt3D feedback

Knoll Lars Lars.Knoll at theqtcompany.com
Tue Jun 16 08:59:11 CEST 2015


On 16/06/15 08:14, "André Somers" <andre at familiesomers.nl> wrote:

>Marc Mutz schreef op 15-6-2015 om 22:26:
>> On Monday 15 June 2015 21:01:54 André Pönitz wrote:
>>> if so:
>>>
>>>      Please explain how that avoids name clashes.
>> You only need to add the prefix when the compiler tells you. E.g. if
>>you use
>> QtGui::QTransform in one file and Qt3D::QTransform in another, in the
>>same
>> project, you can write QTransform in both, without ambiguity. Only when
>>you
>> need both in the same TU _and_ you using-direct _both_, you need to
>>prefix
>> QtGui:: or Qt3D::, but only for QTransform, not, say, QAspectThread.
>Would that help with being able to read and understand the code, or
>would it hinder? If someone were to post a snippet of code using that
>QTransform in it, how does one know if that is QtGui::QTransform or
>Qt3D::QTransform? Or would that be sufficiently clear from the context.
>Code is, after all, not only to be understood by compilers, but also by
>humans reading it. How would it affect people trying to use a search
>engine to find out what QTransform does? At QtCS, we saw that quite a
>portion of people just google class names for the docs (and discussed
>that one still ends up at 4.8 docs a bit too often when doing that).

This is quite an important point to remember when designing our APIs. Code
is written once, but read many times. We’ve always been striving for code
that is self explaining and not confusing to anybody reading it. It’s one
of Qt’s core strengths. And this is something that can become very hard if
we have duplicated class names in different namespaces and they are used
unprefixed.

Cheers,
Lars



More information about the Development mailing list