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

Pages: 1-4041-

Singleton is teh suck.

Name: Anonymous 2006-10-10 2:57

srsly.

Name: Anonymous 2006-10-10 3:09

what

Name: Anonymous 2006-10-10 3:15

Globals for OO fruitcakes.

Name: Anonymous 2006-10-10 3:16

>>3
QFT

Name: Anonymous 2006-10-10 3:59

"Singletons" serve as a way to make strict OO people not feel wrong for using globals. They saw at university globals are bad, though they don't exactly understand why or how, and in what cases would you still use them. They came up with something overly complicated (in the purest OO fashion) that does the same, but also serves as a buzzword so they can pretend they're knowledgeable professionals and their managers think it's a good thing.

Name: Anonymous 2006-10-10 4:02

That's confusing to someone who's familiar with Prolog.  Singleton means something totally different there.

Name: Anonymous 2006-10-10 8:18

Stateful singletons are evil for most of the same reasons that globals are evil. While stateless singletons aren't exactly evil, they get abused a lot.

Name: Anonymous 2006-10-10 8:18

>>5
I'm curious, why do you mention strict and pure OO ? Because I feel that singletons aren't really pure... suddenly there's two types of objects, those that can be created and those that can not.

Name: Anonymous 2006-10-10 8:59

>>8
a singleton is still an object that can be created.  it's just the creation is private and handled by the Singleton class itself to ensure only one instance is created.  you still end up with an object which can be handled like any other object, and all the advantages that entails.

Name: Anonymous 2006-10-10 9:44

>>7
Singletons are as good and evil as globals; the only difference is they are the professional enterprise scalable business web 2.0 solution version of "global myvar".

Name: Anonymous 2006-10-10 19:34

What exactly is a Singleton?  Are you guys talking about static classes?

Name: Anonymous 2006-10-10 21:00

>>11
a Singleton is a fancy OO way of making an Object that can only be created once.  in a nutshell, it has a private constructor and a public static 'getInstance()' method which will create the Object if it's not been created yet, and return a pointer to this same Object.  every call of getInstance() will return the same Object.

Name: Anonymous 2006-10-11 2:13

>>7
What can you do with a stateless singleton?

Name: Anonymous 2006-10-11 4:33

>>13
if you're smart, you can use it to justify having stateful ones.
oh wait, if you're smart you'll just do "global myvar" instead. or figure out some way to do what you want without using a global.

Name: Anonymous 2006-10-11 4:36

>>1
Java consultant version of a global variable. Instead of a global variable (which is 3bil), you have a global factory which returns an object, and always the same object, to anyone who requests it. So you need a professional enterprise design pattern instead of "global x".

Name: Anonymous 2006-10-11 4:38

>>15
I suffered from premature post ejaculation due to wrongly placed Reply button due to idiot changing the original world4ch.org theme into this shit.

That was for >>11, and I forgot to add, globals are 3bil (not really) but singletons aren't because they are OO and everything OO is good (not really).

Also, quoting >>14 for win:
if you're smart you'll just do "global myvar" instead. or figure out some way to do what you want without using a global.

Name: Anonymous 2006-10-11 7:35

Singleton is an enterprisey global

Name: Anonymous 2006-10-11 7:36

I think that the problem we have here is that we discuss singletons in some abstract context, they can be useful, they can be useless... depend on language and problem we are trying to solve. But I think we all agree that you should avoid singletons, unless you really know what you are doing.

Name: Anonymous 2006-10-11 21:43

>>18
Singletons are, as >>17 said, enterprise scalable globals. There's nothing they do you can't do with globals 10 times simpler and shorter, and easier to maintain.

Name: Anonymous 2006-10-12 0:04 (sage)

>>19
one thing you can do with singletons that you can't do with globals: write a java program.

Name: Anonymous 2006-10-12 4:56

>>19
Thats BS, but whatever, I'm not interested in discussion where you refuse to listen, obviously everyone here must be much smarter then me.

P.S. I hate Java as much as the next guy.

Name: Anonymous 2006-10-12 5:16

>>20

That explains it then. I was wondering why I would ever want to use a singleton in my C++ programmes.

Name: Anonymous 2006-10-12 7:05

>>20
why would you write non-OO code in java? java was designed to be a horrible language for non-OO code.

Name: Anonymous 2006-10-12 7:51

Yeah, but... it's a horrible language for OO as well.

Name: Anonymous 2006-10-12 11:09

>>24
Truth was told.

Name: Anonymous 2006-10-12 12:10

Java is pretty good at OO for a statically typed language. I'm afraid you fags have no idea what you are talking about.

Name: Anonymous 2006-10-12 12:45

>>26
I'm afraid you have no idea what you're talking about.

Name: Anonymous 2006-10-12 14:33

singletons are awesome for pretending to code oop.

Name: Anonymous 2006-10-12 16:40

>>26
I'm afraid you fag never tried a decent OO language.

Name: Anonymous 2006-10-12 17:24

I'm actually slightly interested in what you people think about Java. Name some things that suck about it.

Name: Anonymous 2006-10-12 18:12

Since others will no doubt be here to explain the many faults of Java I'll just devote my attention tonight towards explaining one of them. A pet peeve of mine, if you will. It may seem minor to you, but Java is more death-by-a-thousand-cuts than anything else.

As we know much inspiration for Java was drawn from Objective-C and C++.

In Objective-C, and indeed in C++, integers and floats are primitives rather than objects because, hey, we have to be 100% compatible with plain vanilla C. Of course, not making integers and floats primitives would also be fucking slow.

Enter Java. While Objective-C is a dynamically typed language where you never know what type an object has until runtime, Java is statically typed. Also, Java's wrapper classes for the primitives are final classes, so you would never have to worry about their methods being overridden. So with a certain amount of trickery in the compiler they could have had the best of both worlds -- integers and floats could be primitives internally, with automatic boxing and unboxing when you needed them to be treated as objects, and with method calls being replaced with function calls when you used them on the primitive form. It could have been awesome.

Instead, we still have primitives that aren't objects. Such wasted potential.

Name: Anonymous 2006-10-12 18:47 (sage)

God, do you Java haters really have to trash every thread ? Yes, we get it, Java sux, but this thread has nothing to do with Java.

Name: Anonymous 2006-10-12 19:00

>>32
Singletons suck, thread is over, so now it can be recycled for discussion of the flaws in Java.

Name: Anonymous 2006-10-12 21:56

THIS THREAD IS NOW ABOUT JAVA SUCKS

- Sucks for being statically typed (this is even worse being OO)
- Sucks for lacking support for anything that's not strict, goody two-shoes, masochistic OO
- Sucks for having special primitive types that aren't objects and you can't inherit from
- Sucks for not having first-class methods (and of course, first-class classes and callable objects are out of the question)
- Sucks for not having multiple inheritance
- Sucks for not allowing you to define operators, because x.add(y) is so much cleaner than x + y
- Sucks for having the worst piece of shit of a standard library which does everything in a way that's so fucking overcomplicated and retarded in the purest enterprise scalable business solution you want to implement it yourself

In before more reasons why Java sucks

Name: Anonymous 2006-10-13 0:04

>>34
Truth got told.

I'd also like to point out that Alan Kay himself has said the central idea in Smalltalk was message-passing, not OO. OO was just an artifact.

Name: Anonymous 2006-10-13 0:06

PS. For those of you who didn't understand >>35: enjoy your statically-typed castrated-OO AIDS. Especially Java.

Name: Anonymous 2006-10-13 2:12

Name: Anonymous 2006-10-13 18:12

I have to work with Java every single fucking day. Java is so shit, I've gotten sick of explaining it over and over every single time to hype-sucking asstards who lack independent thought.

For the benefit of the non-asstards, yet another reason Java sucks are all the lame excuses they come up with to do things in the most absolutely fucking retarded way - ways that actually made things WORSE.
e.g.
easier to maintain = takes 3x more effort to maintain.
Makes code cleaner = turns your program into an unreadable mess.
Innovative framework = take something that requires only a few lines of code, and be built and loaded seperately, into an overbloated framework with dozens of large dependencies and shit loads of messy XML goop "configuration."
'Managebility' = (AHAHAHAHAHA take a guess).

Name: Anonymous 2006-10-15 12:36

Protip: Azureus is made of singleton.
A fucking pain to read...

- Sucks for having special primitive types that aren't objects and you can't inherit from
int takes less place that Integer.

- Sucks for not having multiple inheritance
I hated that in C++

- Sucks for having the worst piece of shit of a standard library which does everything in a way that's so fucking overcomplicated and retarded in the purest enterprise scalable business solution you want to implement it yourself
Learn to RTFM

But for
- Sucks for not allowing you to define operators, because x.add(y) is so much cleaner than x + y
you definitely have a point

Name: Anonymous 2006-10-15 13:46

>>39
int takes less place that Integer.
So? A special magical type and a handicapped class. Implementation efficiency shouldn't get in the way of a good language; if there's an optimization to do, it should be done transparently, not at the cost of the language.

I hated that in C++
Several things can't be done with it. Then you have interfaces, which suck.

Learn to RTFM
Of course I RTFM, it's the only way I can use it, because there's no way in hell I could memorize all that shit. Which gets me to the point the Java standard library is unproductive, like anything Java, which is just the opposite to what Sun claims.

Name: Anonymous 2006-10-15 17:10

>>40
I wouldn't say it's unproductive. It's just miles away from C and thus, from C++, making it hard to take habits on both languages at the same time.
Maybe you have years of experience with C++ but when you get your hands on C++ and Java in two years' time, C++ blows. This coming from someone who loves C.
I heard Objective C was nice but the syntax is weird.

Name: Anonymous 2006-10-16 7:46

>>41
C++ blows, but Java is even worse. It has the disadvantages of a lower-level language (unproductive, anal) without many of the advantages of a higher-level language (flexible, dynamic, simple), and its performance leaves something to be desired for a low-level language.

Name: Anonymous 2006-10-16 8:52

>>41
I heard Objective C was nice but the syntax is weird.
Yeah, it's weird, but the abilities that weird syntax gives are to die for in a system language...

Name: Anonymous 2006-10-16 10:14

I heard Objective C was nice but the syntax is ripped straight out of Smalltalk.
Fix'd

Name: Anonymous 2006-10-16 11:15

Objective-C's syntax may seem alien, but I wouldn't call it weird.

Name: Anonymous 2011-02-03 7:59

Name: Anonymous 2011-08-08 12:13

// test

Name: Sgt.Kabu签沦kiman﵈横 2012-05-28 20:31

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
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