From: Aredridel Date: 2003-09-13T05:06:42+09:00 Subject: Re: Should "new" methods do anything? --=-xt6+981JgEI+5w0faYqy Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Fri, 2003-09-12 at 14:03, Philip Mak wrote: > A programming style question: >=20 > Should "new" methods actually do anything, or should they only perform > initialization? >=20 > For example, let's say I have a class called "Httpd" which runs an > HTTP server. Should its interface be like this: >=20 > server =3D Httpd.new(:listen_port =3D> 80) # Initialize the server > server.run # Run it >=20 > Or like this? >=20 > Httpd.new(:listen_port =3D> 80) # Initialize and run the server Let it return self. Then: Httpd.new(:listen_port =3D> 80).run >=20 > The latter way is more streamlined, but feels bad for some reason that > I can't quite put into words right now. Well, perhaps you want to wait to run until you've checked some things... --=-xt6+981JgEI+5w0faYqy Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQA/YicstP09exA3hooRAmRhAKDKuJR5RYYlaw0M1+MNcRestyuLSwCgoNzX VsuKjF25CVlcnH0zm4ll288= =Ie5W -----END PGP SIGNATURE----- --=-xt6+981JgEI+5w0faYqy--