From: Jim Weirich Date: 2006-04-01T12:26:52+09:00 Subject: Re: (Static) Constructors/Destructors in Ruby PrimaryKey wrote: > Please consider the following (pseudo) C# example: I think Logan Capaldo's answer is hits pretty close to your intention here. However, I have to comment because I've been retrofitting unit tests in to a legacy (Java) code base this past week and I've come to *hate* static initializers. The code base does something similar to your example and the code is impossible to unit test without some restructuring. Since the database connection is made in static initializers, I can't even load the class without having the infrastructure for a database connection available. Yuck! I've come to consider complex static initializers (e.g. making DB connections in the initilizer) a thing of "evil". Ok, rant over. ;) > [...] > 2. It can be helpful for meta-programming purposes. My impression is > most languages try to implement the traditional OO tools on class > (static) level I'm not getting statement #2 above. Thanks. -- -- Jim Weirich -- Posted via http://www.ruby-forum.com/.