What's TOTALLY COMPELLING about Ruby over Python?

Alex Martelli aleaxit at yahoo.com
Tue Aug 19 07:23:10 EDT 2003


Andrew Dalke wrote:
   ...
> than many consider.  Though I know I can't recall needed a
> singleton for my code.  Maybe I have a different code style?
> I've noticed a tendency of mine towards functional programming...

Good program designers rarely NEED singletons -- even when they
tend towards object-oriented rather than functional programming.

Kent Beck's superb "Test-Driven Development by example" book
(Addison-Wesley, highly recommended to everybody!) has this to
say on the subject, as part of an excellent though brief survey
of useful design patterns:


"""
Singleton

How do you provide global variables in languages without global variables?

Don't.  Your program will thank you for taking the time to think about 
design instead.
"""


This is ALL that Kent's book says on the subject -- and, really, it
SHOULD be all that NEEDS to be said.

The concept of a language that ENCOURAGES you to disregard Kent Beck's
advice, and use Singleton instead of "taking the time to think about
design", is truly appalling.


Alex





More information about the Python-list mailing list