From: Gavin Sinclair Date: 2003-09-13T09:57:24+09:00 Subject: Re: Should "new" methods do anything? On Saturday, September 13, 2003, 6:03:51 AM, Philip wrote: > A programming style question: > Should "new" methods actually do anything, or should they only perform > initialization? > For example, let's say I have a class called "Httpd" which runs an > HTTP server. Should its interface be like this: > server = Httpd.new(:listen_port => 80) # Initialize the server > server.run # Run it > Or like this? > Httpd.new(:listen_port => 80) # Initialize and run the server > The latter way is more streamlined, but feels bad for some reason that > I can't quite put into words right now. The method is "doing too much", a common problem. You may want to pass the server to another method which runs it, or not, based on some other things. Gavin