Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Singletons

Name: Anonymous 2006-06-19 6:00

Give me ONE reason to use a singleton instead of a global variable/structure.

Name: Anonymous 2006-06-19 6:10

- global variables may have namespace collision when their programs are used as modules
- global variables are placed right next to executable code in memory and open up buffer-overflow vulnerabilites
- global variables violate the principle of information hiding and encourage the programmer not to perform sanity checks as there isn't just "one way" in and out of the variable (i.e., through an access function)
- global variables use up RAM the entire time the program is running
- global variables are for noobs

Name: Anonymous 2006-06-19 6:34

>>2
global variables may have namespace collision when their programs are used as modules
In most languages, global variables are module wise.

global variables are placed right next to executable code in memory and open up buffer-overflow vulnerabilites
global variables use up RAM the entire time the program is running
That only happens if you are using a low-level language; and in that case the global variable may be just a reference or a pointer to circumvent this.

global variables violate the principle of information hiding and encourage the programmer not to perform sanity checks as there isn't just "one way" in and out of the variable (i.e., through an access function)
That only happens if your language fail. Yours seems to fail.

global variables are for noobs
Lol, gb2/java.net, you are the noob here.

Name: Anonymous 2006-06-19 8:26

In a multithreaded environment, you can put the mutex/semaphore/whatever code in the access method of the singleton, it's neater that way.

Name: Anonymous 2006-06-19 12:10

A singleton is OOP's answer to a global. If you use a lot of singletons in your code, you're an idiot.

Name: Anonymous 2006-06-19 12:11

Name: Anonymous 2006-06-19 12:15

"OOP's answer" sounds as idiotic as "Pythonic" or "Ruby way" or anything-way.

Name: Anonymous 2006-06-19 13:36

>>7
Yes, but it is also an Enterprise Level Scalable Solution.

Name: Anonymous 2006-06-20 0:35

USE WHAT WORKS FOR YOU.

DO NOT READ THESE FAGGOTY ARTICLES THAT TELL YOU HOW TO PROGRAM OR HOW NOT TO PROGRAM.

I DON'T EVEN CARE IF DONALD KNUTH WROTE IT -- DON'T FUCKING READ IT.

Name: Anonymous 2006-06-20 3:12

>>9
Yeah, fuck Knuth. Dijsktra ftw!

Name: Anonymous 2006-06-20 5:32

You should use a singleton when you lack any capacity of independent thought!

Name: Anonymous 2006-06-21 11:49

How did I wrote singleton?

Name: Anonymous 2006-06-21 13:57 (sage)

>>12
907.18474 kilograms

Name: Anonymous 2006-06-21 18:09

1. Write a singleton that handles your global variable(s).
2. Convert the singleton to a namespace and hit yourself repeatedly for making it a singleton in the first place.

Name: Anonymous 2006-06-22 20:56 (sage)

>>10

no fuck all of those old fogeys

they dont know shit and they still jack off to Prolog code

Name: Anonymous 2009-01-14 4:32

If you want to use anti-patterns which harm productivity

Name: Anonymous 2009-03-06 11:29


target Do you want to really optimize   an application FFT.

Name: Anonymous 2010-12-17 1:30

Xarn is a bad boyfriend

Name: Sgt.Kabu埴壸kiman䧛߃ 2012-05-28 19:21

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List