Mislav Marohnic' wrote:
> On 6/25/07, *Andrew Dupont* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>
> Perhaps someone could volunteer to convert a piece of Scriptaculous or
> Rico just for illustration purposes?
>
>
> Stuff in Prototype that benefits from inheritance:
>
> TimedObserver, PeriodicalExecuter, Form.Observer,
> Form.Element.Observer, Form.EventObserver
> "Observer" class from event.js in the "event" branch
> Ajax.Request, Ajax.Updater, Ajax.PeriodicalUpdater and maybe other
> (new) Ajax stuff
Yah, those use _inheritance_, but how much would they benefit from this
new advanced inheritance? How many of those methods would be
shorter/more maintainable/more extensible by accessing this.$super et al?
Browsing those functions, I don't see much if any opportunities for
improvement on those class methods. Looking closely at the Ajax
classes, for example, I see only one method (Ajax.Updater.initialize)
that is actually superseding a parent method. See below.
Aren't all the new OO patterns we are discussing dependent on child
methods that supersede parent methods? Maybe I'm mistaken.
I think that even just talking generally about how classes and functions
would be rewritten would be helpful to assessing real-world value.
--Ken
var Ajax = {
getTransport: function() {...},
activeRequestCount: 0
}
Ajax.Responders = {
responders: [],
_each: function(iterator) {...},
register: function(responder) {...},
unregister: function(responder) {...},
dispatch: function(callback, request, transport, json) {...}
};
Object.extend(Ajax.Responders, Enumerable);
...
Ajax.Base = function() {...};
Ajax.Base.prototype = {
setOptions: function(options) {...}
}
Ajax.Request = Class.create();
Ajax.Request.Events = [...];
Ajax.Request.prototype = Object.extend(new Ajax.Base(), {
_complete: false,
initialize: function(url, options) {...},
request: function(url) {...},
onStateChange: function() {...},
setRequestHeaders: function() {...},
success: function() {...},
respondToReadyState: function(readyState) {...},
getHeader: function(name) {...},
evalJSON: function() {...},
evalResponse: function() {...},
dispatchException: function(exception) {...}
});
Ajax.Updater = Class.create();
Object.extend(Object.extend(Ajax.Updater.prototype,
Ajax.Request.prototype), {
**initialize: function(container, url, options) {...},
updateContent: function() {...}
});
Ajax.PeriodicalUpdater = Class.create();
Ajax.PeriodicalUpdater.prototype = Object.extend(new Ajax.Base(), {
initialize: function(container, url, options) {...},
start: function() {...},
stop: function() {...},
updateComplete: function(request) {...},
onTimerEvent: function() {...}
});
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---