[webkit-dev] Simplifying "hub" classes (was Cleaning up directories in WebCore)

Adam Barth abarth at webkit.org
Sun Nov 20 20:55:57 PST 2011


On Sun, Nov 20, 2011 at 8:36 PM, Hajime Morrita <morrita at google.com> wrote:
> One traditional pattern is to split a big class into  a set small
> classes plus a "hub" class
> like how Adam has done for original Frame.

^^^ The work to split up Frame was largely done before I was involved
with the project.

> In that pattern, small classes has a reference to the hub class and
> know its API.
> I hope these small classes know just a small part of its hub class via
> interface (abstract class.)
> In that way, such classes can be unit-tested independently without
> instantiating the hub class,
> whose instantiation is typically a difficult job.
>
> Personally, I feel that we don't need category-like mixin mechanism
> for existing hub classes.
> Since we have just a few or dozen of instances of these classes and
> the size overhead from extra pointers
> is negligible. It isn't case for the node family though.
>
> --
> morrita
>
> On Sun, Nov 20, 2011 at 2:23 AM, Adam Roben <aroben at apple.com> wrote:
>> On Nov 18, 2011, at 5:55 PM, Adam Barth wrote:
>>
>>> Really, SQL_DATABASE just wants to store some state per
>>> ScriptExecutionContext.  It seems like there should be a way to do
>>> that without making a mess of ScriptExecutionContext.
>>>
>>> IMHO, we want something like the C++ equivalent of Objective-C
>>> categories.  I'm not sure how best to achieve that.
>>
>> Note that ObjC categories don't allow you to add extra state (i.e., ivars) to classes. They only allow you to add extra methods.
>>
>> -Adam
>>
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>
>
>
>
> --
> morrita
>


More information about the webkit-dev mailing list