Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Object Constructors/Initializers

Name: Anonymous 2014-03-08 15:47

Object constructors/initializers should *always* be pure functions which use only their arguments. Any other initialization should be in a factory function or if your language supports it, overloaded constructors.

I've seen too many pieces of code where the only constructor reads a config file or some such garbage, so if you happen to want to specify different configuration you have to *write to the fucking config file* only to have it read moments later. On top of this it looks for the config file using a hard coded piece of logic that you'd need to duplicate outside of the class and hope it never changes.

Name: Anonymous 2014-03-08 16:44

What if one of the arguments is a file name? Checkmate, athiests.

Don't change these.
Name: Email:
Entire Thread Thread List