Draw/Size model in MX2004
This has been bugging me for a while now, there is something fundamentally wrong with the Draw/Size model of MX2004.
Bear with me as I may ramble a bit as I just try to get some ideas down!!
I mean that, currently in almost every case Draw simply defers to Size which does all the work, which is simple yes, but it does mean that you get Size related methods being fired when size never changed which is inefficient
Fundamentally we have 2 different types of changes to a component, dimensional changes i.e. size and visual i.e. style. TO be efficient we should be able to separate the two types and invalidate and validate the two independently or both together.
We probably need a master method above this that can determine which needs to be called and when.
There is also an issue of timing, if a components has siblings it can be important that any dimensional changes are made immediately so that the components dimensions can be known by its parent i.e. think of cells in a grid, although we can be more relaxed when style changes are effected.
Come to think of it, it isn't that the dimensional changes need to be effected immediately as much as the boundary dimensional values need to be known now!
Also I think part of the issue is that setSize() always calls size()... Yes I know I sound stupid but what I am getting at here is that we sort of have linked in our mind that size() actually does the sizing of the component whereas I think a more useful way of looking at it is that setSize is the one that actually caries out the size operation and it does that by simply changing the height and width properties and nothing else i.e. the properties ARE the size of a component whereas the size() method is an adjustment of the internals of a component in response to dimensional changes, the difference may be too subtle and you might not follow it but I think conceptually there is a big difference here.
I don't think I have this thought through yet but I believe somewhere out there, there is a better model than the current Draw/Size model or at least its current implementation.