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.
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.