P
Philip Mak
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.newlisten_port => 80) # Initialize the server
server.run # Run it
Or like this?
Httpd.newlisten_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.
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.newlisten_port => 80) # Initialize the server
server.run # Run it
Or like this?
Httpd.newlisten_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.