Arthur Debert
unread,Jan 18, 2008, 9:37:58 PM1/18/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to BulkLoader users
Hi Janoschart.
The long story:
Actually I have mixed feelings about this. You see, there'a a lot to
BulkLoader's design that is simply wrong. To make it right, it would
need to be split into many classes, such as classes for constants,
events, each loading item and so on. BulkLoader started very simple
and gotten more and more powerful, but with the burden of complexity.
My design goal was to have an ultra simple package, one class only.
That's why you don't see things such as Types.VIDEO, TYPES.IMAGE and
so on. A lot is bolted into the BulkLoader class, like the name of
events it dispatches. The idea was to keep imports, documentation and
learning curve into a minimum - that is, one class only. In fact the
first draft was just like that, the LoadingItem class wasn't even
public. With time, people needed it to be more flexible, more
powerful, so added features and split the class into other classes.
So the short answer is "you are right". LoadingItem should be some
base class and each loading type should be a more specific
implementation of that. I'd rather use a base class then an
interface, because many housekeeping utilities could be kept on the
base class. But I also feel that having few classes to learn and
understand, no complex code spread among a hierarchy of interfaces,
base classes, factories and what not results in a much simpler use
case. I've seen other loading libraries for as3 that take the design
to death principle, and although correct and well structured, they
feel very clumsy too me.
At first everything was public too. I have a strong bias against
access modifiers: I feel that everything show be public, and
developers should use internal parts on their own risk. But then,
people would read that, for example, the priority property in
LoadingItems was public, change it after the instance was created, and
wonder why the priority queuing didn't change. So in order to avoid
the burden of explaining and documenting all that. So I've left them
as internal, so the package itself would be able to see them, but it
would be off limits for other developers. The end result is exactly
what you are describing: a hard to extend, full of locks structure.
I`ve been juggling these issues a lot on my head and haven't reached a
conclusion. It's very likely that I'll split up LoadingItem into the 5
or 6 classes it needs to be, and by then it will be trivial to extend.
Right now, I wan't to make sure no remaining bugs are left (haha), and
also develop a comprehensive test suite for the library. Once that is
done, I'll probably start some heavy handed refactoring and the issue
you mentioned is probably one of the first targets. I guess I need to
make up my mind to what point it is useful to design and abstract
more, and how that will impact users.
The short story:
A quick hack is to put the extending stuff you need into the same
package. I am curious what are you requirements for extending
LoadingItem ? Maybe it turns out to be useful for more people and we
can merge that in.
This turned out longer than I expected, but I guess I have some more
thinking to do.
Cheers