By bloid
via usrportage.de
Published: Jul 31 2008 / 23:24
Constructors are often used to shortcut dependency injection and parameter passing on instantiation. This is a valid practice and often leads to shorter code. Consider the following example (a simple value object, often used to not mess around with floats and to keep currency and amount together)



Comments
antych replied ago:
This looks dumb, how about you document your code so the constructor's parameters are known? And you don't need setters for everything, some things just belong to the constructor.
Voters For This Link (11)
Voters Against This Link (1)