On 2009-09-21, at 05:07 , Ajay wrote:
> Does this imply that the language is also doing away with singletons?
Not entirely - we're getting rid of the standard implementation
practice of a singleton in Java, which would normally look something
like this:
public class Foo {
private static final Foo instance;
private Foo() {
.. do stuff
}
public static Foo getInstance() { return instance; }
}
The above is really hard to test, especially if Foo has a method which
does something like
public Myoutput doBlah() {
return new MyOutput(Bar.getInstance().getRecentValues() / 5);
}
This sort of singleton chaining is death to testability.
But we will support the "once per application" pattern, through scoped
dependency injection.
regards,
Christian.
Christian Edward Gruber
e-mail: christiane...@gmail.com
weblog: http://www.geekinasuit.com/