Porting bits of UI like dialog boxes by creating a
platform-independent base class and subclassing for each platform is
now no longer allowed.

In C++, inheritance is something to be used carefully. You should
create a subclass only when the derived class is a logical
specialization. That one class contains cross platform state for a bit
of UI and another class contains that platform-specific UI does not
mean that the latter is a logical specialization of the former.

Overuse of inheritance makes the code harder to follow and understand,
and Brett and I in particular have spent a lot of time over the past
few months correcting this throughout the Chrome front end.

If you are creating UI on another platform and want to reuse common
code, please move the common code into a separate object that the
platform specific UI owns. This applies to changes you're currently
working on, too.

e.g., I just redid the Task Manager to fit this pattern. There are two
frontends for it currently, TaskManagerView (windows) and
TaskManagerGtk (linux). Both have a TaskManager object that they use
to populate themselves.

It is always more convenient for native code in a particular frontend
to directly create its own UI components, rather than having to go
through a factory method.

If you need any advice on the feature you're working on, please let me
know. I'm more than happy to discuss.

We should also correct existing instances of the undesirable pattern
soon. As I discover them, I'll be emailing the people responsible. If
you know of any, please let me know.

-Ben

--~--~---------~--~----~------------~-------~--~----~
Chromium Developers mailing list: chromium-dev@googlegroups.com 
View archives, change email options, or unsubscribe: 
    http://groups.google.com/group/chromium-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to