On 2010-06-13 10:27:48 -0700, Micha Zajc said:

> Hello,
> I write in ruby for few weeks and I have noticed that in ruby I use 
> class (static) methods more often than in "traditional" languages like 
> java or c#. In java I use instance methods for two purposes - 
> maintaining object state and to use polymorphic behaviour. In ruby 
> polymorphism is available to class methods as well as for instance ones 
> so I don't see need for using instance methods in stateless classes 
> (for example typical application / domain services).
> 
> It is common for ruby programmers or maybe I have miss something?
> 
> Best Regards,
> Micha

Classes are designed to instantiate objects. If you have classes that 
consist solely of class methods then they aren't functioning as classes 
at all but rather as convenient globally-available namespaces for 
singleton methods, which is a very procedural style of progrmaming. 
Procedural programming is not necessarily bad, but you are missing out 
on a great deal of the power and flexibility of an OOP langauge by 
writing procedural code.

Then again, if the system works for you and maintainability and other 
core values do not appear to suffer, who's to say you're doing it 
wrong? Even asking the question shows that you're thinking critically 
about the tradeoffs involved here, which is a good start.

-- 
Rein Henrichs
http://puppetlabs.com
http://reinh.com