[Borges-users] refactoring

Слепнев Владимир slepnev_v at rambler.ru
Fri Apr 30 18:09:13 EDT 2004


Hi,

I'm reading the Borges source, trying to understand what to refactor 
where, and where to stick the unit tests. IMHO, there's room for some 
improvement.

Why does Controller have #inform and #confirm? (No one's gonna use 
that anyway - in any kind of production job, it's conceptually simpler 
for the developer to create a custom "confirm" controller, with CSS, 
layout and such. Or to explicitly call one of the Borges library 
components. At the very worst, let's move those methods to Component, 
because Controller is already swollen.)

Why does Controller#answer check for @continuation.nil? If a 
controller attempts to answer and there's no place to answer to (or 
will_answer? had been set to false), this should be an error that the 
app developer will instantly see. Let's remove this check.

Why is Controller using class << self, instead of just defining 
self.inherited ? (#initialize_controller doesn't do much; and we could 
remove it altogether, along with class<<self, if we add some 
@delegate.nil? in strategic places. Funny those checks actually were 
there until I asked to remove them some time ago. So much for my 
consistency =)

Come to think of it, why do Controller and Session have to know all 
their subclasses at all? This isn't actually needed by the framework, 
except in some "preferences" stuff, is it? And, any application or 
admin tool that needs all subclasses can easily get them from 
ObjectSpace, so why keep it in the Borges core? The less code in the 
core, the better.

As for preferences - let's just kill them!

(Well, maybe I'm being a bit fast here... but I think that 
"core-level" tasks - controllers, sessions, continuations - should be 
clearly lower level than "administrative" tasks like this preferences 
thing. Even Component is a higher-level thing than Controller.)

It would much please me to see the Borges codebase polished, and it 
would please me even more to take part in the process.

Should I start making diffs for this stuff?

Vladimir Slepnev


More information about the Borges-users mailing list