A Singleton (swthoughts.blogspot.com)

submitted by skpananghatskpananghat(184) 4 years, 5 months ago

Here I am depicting a small and very simple pattern, the most familiar singleton design pattern. when we say singleton it should not create more than one instance at any point of time and there by it should ensure a class has only one instance and provide a global point of access to it.......

1 comment |category: |Views: 1

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by yesthatmcgurkyesthatmcgurk(4063) 4 years, 5 months ago 0

Hey, I like you, you're a nice guy; your mother and my mother are both mothers. So I'm going to give you a clue.

1) Your code fails. It returns a null for Instance(). And its not even that good a singleton pattern.
1.a) Singletons should be sealed, yours is not.
1.b) Singleton instances should be accessed via properties; yours is accessed via a method.
1.c) Your singleton MUST be instantiated when the type object is created (its a static readonly object), which means it is NOT lazy. Lazy means it is instantiated when it is needed and not before.
2) Your blog fails. You have comments turned off. A blog without comments sucks, and nobody who gives a flying fk will ever go there on a regular basis.
3) Google rocks for searching but SUCKS for blogging. Move to a different blog host and pretend all this never happened.

Reply

information Login or create an account to comment on this story