[Development] Some Qt3D feedback

Marc Mutz marc.mutz at kdab.com
Tue Jun 16 12:25:08 CEST 2015


On Tuesday 16 June 2015 08:59:11 Knoll Lars 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.

Note that in a world of auto variables, class names are no longer _that_ 
important. Functions are important, they are still visible. But other than at 
initial creation, class names fade to be background.

And now you tell me how using lots of auto is bad for readability, because you 
never know what type the variable has, to which I will reply that in Python, 
Perl, PHP, JavaScript and others, there's no way to spell the type of a 
variable, and people write very large projects in these languages and never 
look back.

Thanks,
Marc

-- 
Marc Mutz <marc.mutz at kdab.com> | Senior Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
Tel: +49-30-521325470
KDAB - The Qt Experts



More information about the Development mailing list