Originally at 2015-02-24T18:57:25Z by Herbert Vojčík
There are classes that initialize its sole instance in class-side initialize and they do some job. One of them is SmalltalkImage, create its instance and putting it as global Smalltalk. This one is ok. But of the others, it would be better if the initialization was explicit, not implicit. One of such classes is PackageStateObserver. Other such classes are implementations of services, where the situation is different case, again.
If a class is self-instantiating, it should be clear - mentioning it in class docs, as well as seeing it in Browser somwhow (maybe creating protocol 'self instantiation' and putting 'start' or 'selfInstantiate' or similar method there for all such classes?). Ideally, it should be better if instantiation / registration of such cases could be external - same as Helios was moved from implicit startup to external one.
Originally at 2015-02-24T18:57:25Z by Herbert Vojčík
There are classes that initialize its sole instance in class-side `initialize` and they do some job. One of them is `SmalltalkImage`, create its instance and putting it as global `Smalltalk`. This one is ok. But of the others, it would be better if the initialization was explicit, not implicit. One of such classes is `PackageStateObserver`. Other such classes are implementations of services, where the situation is different case, again.
If a class is self-instantiating, it should be clear - mentioning it in class docs, as well as seeing it in Browser somwhow (maybe creating protocol 'self instantiation' and putting 'start' or 'selfInstantiate' or similar method there for all such classes?). Ideally, it should be better if instantiation / registration of such cases could be external - same as Helios was moved from implicit startup to external one.
<bountysource-plugin>
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/8877498-eliminate-self-initializing-singletons?utm_campaign=plugin&utm_content=tracker%2F79201&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F79201&utm_medium=issues&utm_source=github).
</bountysource-plugin>
Originally at 2015-02-24T18:57:25Z by Herbert Vojčík
There are classes that initialize its sole instance in class-side
initialize
and they do some job. One of them isSmalltalkImage
, create its instance and putting it as globalSmalltalk
. This one is ok. But of the others, it would be better if the initialization was explicit, not implicit. One of such classes isPackageStateObserver
. Other such classes are implementations of services, where the situation is different case, again.If a class is self-instantiating, it should be clear - mentioning it in class docs, as well as seeing it in Browser somwhow (maybe creating protocol 'self instantiation' and putting 'start' or 'selfInstantiate' or similar method there for all such classes?). Ideally, it should be better if instantiation / registration of such cases could be external - same as Helios was moved from implicit startup to external one.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.