You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
-
'Singletons are good design practice because you can always modify global object somewhere, or someone else can just overwrite it. Not possible with singleton pattern.' ?? Could you clarify the difference between 'singleton' and 'singleton pattern'?Michael K– Michael K2011-01-16 20:19:29 +00:00Commented Jan 16, 2011 at 20:19
-
Hm... singleton is a concept or something you can use and singleton pattern is how you'll make that concept work.Slawek– Slawek2011-01-16 20:24:42 +00:00Commented Jan 16, 2011 at 20:24
-
3Singletons only fix small problems with global variables. Global variables encourage coupling which ideally we'd like to prevent. The technique of using singletons does nothing to help there. The complaint against singletons is basically that people convert a global variable into a singleton and think all is good. But really they've only fixed relatively minor issues that come from using globals.Winston Ewert– Winston Ewert2011-01-16 20:55:22 +00:00Commented Jan 16, 2011 at 20:55
-
2Regarding Math, that's not a singleton its a static class. There is no problem with static/global functions as long as those functions as long as they are stateless.Winston Ewert– Winston Ewert2011-01-16 21:00:02 +00:00Commented Jan 16, 2011 at 21:00
-
1You might also examine some large open source "C" based projects for a solid example of how to handle logging etc w/o a singleton pattern. Apache, for one. Even in an OOP system, if you litter your code with what is basically a global object, then you are tightly coupling your code (bad OOP) and making unit testing a nightmare.red-dirt– red-dirt2011-01-17 13:27:42 +00:00Commented Jan 17, 2011 at 13:27
|
Show 3 more comments
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
-
create code fences with backticks ` or tildes ~
```
like so
``` -
add language identifier to highlight code
```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible)
<https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you