[Borges-users] refactoring

Kaspar Schiess eule at space.ch
Sun May 2 12:53:45 EDT 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Слепнев Владимир wrote:

|> You seem to get bugged by the 'class << self' thing all over the place.
|> Do you know about this http://www.rubygarden.org/ruby?ClassMethods
|> discussion ?
|
|
| Why not just create regular class methods (def self.foo...end) when we
| need them? Why use those singleton hacks? This may sometimes be needed
| if we want subclasses to behave in a certain way - but it doesn't really
| apply to Borges, and to me this kind of thing is a "code smell" anyway.

class A
...
end

t = A.new
class << t
	def hack
	end
end

This is a singleton hack. But

class A
	class << self
		def someclassmethod
		end	
	end
end

is none. It's just another way of saying def A.someclassmethod. I kind
of like the class << self idiom because it should be natural to people
at ease with the language. And it makes think the rest about it,
especially because it is well documented (see link posted earlier).

I don't get the point of this being *code smell*.

About the properties:
Yes, they are a third leg, and they must go away. But we will need a
kind of runtime configuration that is common to all applications that
can be changed indepently of code, this is needed for deployment (stage,
test, live, ...). I would appreciate work being done on a configuration
system that we call could reuse in our own apps, and one that includes
Borges config. There certainly is a common need for this.

The fact that they are hot-changeable is nice too, but the admin/seaside
has to go.

I am meaning no insult by my remarks about the class << self; however I
find that to be valid Ruby code. Excuse me if it comes across as one.

best regards,


- --
kaspar

semantics & semiotics
code manufacture

www.tua.ch/ruby
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAlSeZFifl4CA0ImQRAmZrAJ9KUERFqnoItpGKkjhR5USoaKgiIwCgncNe
tMm4L0VK9O4ALLOvNbxQTCw=
=iXmy
-----END PGP SIGNATURE-----


More information about the Borges-users mailing list