« first day (1342 days earlier)      last day (3835 days later) » 

10:01
21
A: Singletons: good design or a crutch?

BleadofThere's three pretty good blog posts about Singletons by Miško Hevery in the Google Testing blog. Singletons are Pathological Liars Where Have All the Singletons Gone? Root Cause of Singletons

People have been discussing this for 6 years already? Wow :)
10
A: Singletons: good design or a crutch?

Repo ManChicks dig me because I rarely use singleton and when I do it's typically something unusual. No, seriously, I love the singleton pattern. You know why? Because: I'm lazy. Nothing can go wrong. Sure, the "experts" will throw around a bunch of talk about "unit testing" and "dependency injection...

lol Singleton fanboy
including singletons, hingletons, mingletons and fingletons
You remember the show Highlander from the 1990's? The singleton is kind of like that because: A. It can never die; and B. There can be only one.
Those words seem to be made up.
7
Q: Industrial-strength n-ton base class template

FredOverflowI am working on an n-ton base class template. I don't worry about laziness yet, so the Intent is: Ensure a class has only n instances, and provide a global point of access to them. Here is my code so far: template<typename Derived, size_t n = 1> class n_ton_base // Singleto...

10:04
Chicks dig me because I rarely use singleton
Sometimes you need more than one!
@FredOverflow A lot more than 6 years
@FredOverflow threesome<T>
threesome<T1, T2, T3>
u racist
The singleton pattern makes you invincible.
user1804599
10:05
@FredOverflow Your answer is nice.
@rightfold It even ends with the word "Nice!"
I hope my answer helped the guy who asked the question.
Singleton as a pattern is not for accessing globals.
@LightnessRacesinOrbit When you ask 100 professional programmers, how many of them would say that Singletons are bad?
singletons sure make for a good discussion topic
@FredOverflow invincible means "not convincible" right?
10:07
@sehe lol
@FredOverflow how many would say that that depends on the sample and precise question position? #skeptics
@FredOverflow is there a typo in "imbecile"?
Ven
Ven
zerotons ? wtf
It seems the epic Alex was involved on the Garan's incidence?
my plan to become the god of gd.se is working marvelously
I am already the epic Alex
lol, there are 3895 questions about Singletons on SO :)
10:11
If the pattern is used in order to create a single instance of an object at any given time then the pattern is being used correctly. If the singleton is used in order to give a global effect, it is being used incorrectly.
@Ven my favourite design pattern to resolve bugs
why do singleton supporters keep saying that "global access is a side effect"?
it's not
@Jefffrey what is that supposed to mean?
@Ven Well, sometimes you don't want more than 0 instances, right?
3
Why make 1 a special case?
@AlexM. ask this guy:
"Global access is a side effect" I'm glad someone pointed this out. The global aspect is probably the most misused part of a singleton — RobS Feb 8 '10 at 22:24
How can you use a singleton without accessing its global instance?
10:14
You could ask a SingletonProviderAccessManager for it.
but first you have to use a SingletonProviderAccessManagerFactory to build one
user1804599
Nil is my favourite singleton in Scala.
38 mins ago, by FredOverflow
One example would be the empty immutable list. There's no point in having more than one.
@rightfold By the way, I was asked to do half a lecture on immutable stacks :)
(Featuring Nil and Cons, of course.)
user1804599
@FredOverflow nice
user1804599
It's easy as hell.
user1804599
10:17
All you need is cons and uncons.
Would you be willing to review my code?
user1804599
Sure.
You know it's Java code, right? ;)
user1804599
Now I do.
Ven
Ven
@sehe remove code ?
10:19
we need to have a vote ... who is the geekest person in the lounge
Ven
Ven
use that word once again
I dare you mutafuckah
I try hard to be a nerd but somehow I just blend in with other people
Ven
Ven
why the fuck would you try to be a nerd
I'm starting to think I was not meant to be a nerd
Ven
Ven
that's a pretty disgusting thing to do
user1804599
10:20
We use zerotons in our code base. :)
user1804599
PHP lacks enums, and constants can only be class members.
Ven
Ven
@AlexM. here google.fr/…
@rightfold it's not a fucking "zeroton"
user1804599
final class LinkStatus {
    const ON = 'on';
    const OFF = 'off';
    const INACTIVE = 'inactive';

    private function __construct() { }
}
Ven
Ven
Why the fuck would you call a class that only has static members "zeroton"?
@melak47 :D
user1804599
10:21
You can create exactly zero instances of it!
I do use zerotons too
my FooManager is a zeroton
here's the contents of FooManager.cs
Ven
Ven
That looks like a terrible, terrible and confusing name.
Geeks and nerds...
@FredOverflow When you read the code of 100 professional programmers, how many of them would appear to have any fucking clue what they are doing whatsoever?
@rightfold Bored to death? Wanna review some Java code? Good news!
10:22
Invoking the popularity of cargo culting is hardly a valid argument.
user1804599
@FredOverflow Does Java have sealed?
@rightfold no :(
user1804599
:[
user1804599
ADTs without sealed suck.
user1804599
How about enums?
@rightfold Enums can't be generic, and they can't inherit.
user1804599
Apart from the German exception messages it looks fine to me.
user1804599
Although I'd make it covariant.
That was quick. Maybe I should have you review more of my code in the future :)
10:25
@rightfold Sure, I have thought about variance, but that would probably be too much for my students.
I would have expected you to complain about size not being tail-recursive ;) Oh wait, the JVM doesn't optimize tail calls, anyway :(
shit, I almost decided to litter this thing with circular dependencies
lucky me, it's still easy to fix
user1804599
@FredOverflow Make the constructor of Stack have package visibility.
@AlexM. Use the CircularDependencyLitterFixerPattern!
user1804599
Then nobody can inherit from Stack from another package.
@rightfold Oh, very nice suggestion! That would just be Stack(){}, right?
user1804599
10:27
C# has protected internal for this; you can only use it in subclasses in the same assembly.
user1804599
But Java probably doesn't.
user1804599
@FredOverflow Yeah.
@rightfold What is "an assembly"?
user1804599
With a comment, perhaps.
-4
A: Why does C++ not allow inherited friendship?

mswFriendship C++ was really just a limited hack and had it not been loosed on the world when it was, there'd probably be something less kludgy in its place. Even its few obscure uses aren't all that respectable. Forget that it exists, if you can.

user1804599
10:28
@FredOverflow library or executable basically.
user1804599
Like a jar.
// Prevent classes outside of this package from inheriting
Stack()
{
}
Like this?
y so saad?
user1804599
@FredOverflow yup
10:30
@LightnessRacesinOrbit lol
because spain is out of the world cup
user1804599
I think this is good use of a comment.
C++ really lacks final and override
8
@JesusChrist C++ has both final and override, but thanks for playing
user1804599
No, it doesn't. :v
user1804599
10:30
It has both.
user1804599
@Jefffrey I like the "JesusChrist" in front.
shit. it's jesus
user1804599
No, that's bullshit as well.
no it doesn't :D
10:31
yeah, it also lacks public in front of classes
@JesusChrist go read a book
class T final { }; is perfectly valid
user1804599
class t final { }; works fine.
@rightfold durr
it's because it's not necessary and it's not Java
user1804599
10:32
Although inheritance is often used for implementation details even in generic contexts for EBO, so you should avoid final classes.
@Jefffrey don't confuse him with noise.
Xeo
Xeo
yeah, pretend final classes don't exist
@JesusChrist why
@JesusChrist Jeffrey was derailing with a different topic (visibility modifiers on classes)
Xeo
Xeo
I don't think they have much if any use
user1804599
10:33
@Xeo Maybe optimization.
@rightfold It's the only comment in ~250 lines of code :D
@JesusChrist You need modules, not visibility modifiers on classes
Xeo
Xeo
there's all kinds of reasons why someone might want to inherit from your class, and you won't anticipate those
user1804599
@FredOverflow Well, it's also the most obscure code so. :v
Xeo
Xeo
@JesusChrist Why?
10:33
aand plonk'd
@JesusChrist I'd even go so far to say that not being able to inherit from classes should be the default.
3
user1804599
@ScarletAmaranth Yup, good idea.
Xeo
Xeo
@FredOverflow ew
go away
@Xeo and there's equally many reasons why you can't support that in your library. It all depends
@FredOverflow lol
10:34
Classes that weren't specifically designed for inheritance often make for very bad base classes.
user1804599
@FredOverflow I agree, but not in C++.
@rightfold What's the difference?
Xeo
Xeo
private inheritance, parameterised base class, traits
user1804599
In C++ inheritance is used for composition and EBO.
@FredOverflow can't you please just mention the guy so that his name appears in the starboard?
10:35
@rightfold good point
user1804599
user1804599
Awesome.
@Jefffrey Jesus Christ
^ There, I mentioned him.
@JesusChrist No it isn't.
@JesusChrist No.
@JesusChrist lol
Xeo
Xeo
10:36
@sehe What I'm thinking of doesn't need the base class to be anything special or specifically 'support' being inherited
Christ, get your shit straight.
user1804599
Jesus can walk on water, but can he walk upside down?
Xeo
Xeo
@JesusChrist you made a claim, you prove it
user1804599
@Xeo "I'm the son of God."
taking the bait again?
user1804599
10:38
Then shut the fuck up.
shameful I tell ya
it's just fun iunno
user1804599
OOPS
rapptz just ruined the fun
it was boring as hell anyway
10:39
@Xeo Yeah good point. I think rightfold convinced me of that use
he's getting philosophical too
NOT FOR ME
anyhoo, I'm going to go pasta.
now I'm hungry :(
Xeo
Xeo
@Rapptz Well, he's Jesus, for Christ's sake.
Jun 4 '12 at 13:26, by sehe
EVERYBODY: Commit chatticide and PRESS IGNORE simultaneously?
Probelmo solvo
user1804599
10:41
@JesusChrist Great idea; I was into some pork.
@sehe great typo you got there
@Jefffrey I'm amazed you find this fun
see you later righty
Xeo
Xeo
hahaha
you suck, get out
user1804599
@JesusChrist I'm offended by your typo.
user1804599
10:42
Please get out or else I'll sue you for everything you have.
wanna play 1.. 2.. 3.. bin?
user1804599
Satan is my hero.
Xeo
Xeo
1 message moved to bin
Awful.
user1804599
:17253946 Thanks for the constructive talk. Hope to see you again.
Xeo
Xeo
10:45
Age: 25
hahahaha
As any books have been released on C++11?
Yes
Stroustroupe's?
10:46
Also
user1804599
STRAUS' TROOPS
I can't wait for c++17
They promised standardized filesystem and many other cool stuff
That's C++14 TS
who knows how long that'll take though
I think C++ really lacks of good standard and cross platform library as C# or Java have
10:48
Not really, no.
Like to have all the needed stuff in one library
@Rapptz taking the bait?
@Jefffrey Probably.
I'm not trolling, Jeffrey
I'm watching House of Cards though so I'm on autopilot.
10:49
I'm going to take a short pause because this looks like it's staged or something
@Rapptz so good
that show I mean
otherwise I can't understand how this kid can be fed like this
huh
I'm not kid)
And I'm not trolling.
@JesusChrist FWIW -- boost and stdlib fill a lot of gaps. Including niches.
Seriously, why not
@Rapptz yes, they fill
But
even boost libraries are not compatible with each other
They all have different types
10:51
what
why do people always "move the fencepost" when discussing why something is lacking or bad?
This is from Herb sutter words, personally I've never used boost libraries)
Xeo
Xeo
dammit. I bit my cheek, and now it's bleeding
RIP
@JesusChrist Maybe you should. I doubt Herb would say something that silly.
But I've used Qt, and found this is a very good library.
@Rapptz I will try to find a link on youtube with time code when he saying it
@JohnPoison that question always puzzles me. Can you propose an alternative to prefixing all your classes with ThisIsMyClass? Just don't do it, is the alternative.
10:54
gl
You're a programmer, you can express what you want in code. It is not difficult to pass a parameter to a function. You know how to do it. It shouldn't leave you stranded and baffled.
@jalf we've already solved this. Calm down
@JohnPoison don't worry, I'm calm :p
from 1:22:00 I think
10:57
it's just a question people ask surprisingly often
@JohnPoison ideally, yes, absolutely. Each test should run in isolation, without sharing any state with other tests.
@Rapptz please watch when you have time
I already did
and that said absolutely nothing about boost
just the standard library
he said a lot about boost
@jalf I can fullfill that requirement in 5 mins in my current design. So i guess it's not a problem. Thanks, I got your point
@JesusChrist Yet he didn't say anything that boost lacked consistent types nor did he imply it.
He went on to say that Boost is the most widely used standard library due to its utilities.
He just went on to say that "Boost is good but people use it because it isn't in the standard library"
11:01
@Rapptz I distinctly recall that he said that somewhere on the presentation. Just don't remember exactly where.
@JohnPoison :)
(as long as it's not 5 minutes every time you want to run your tests... :p)
BTW why do people avoid using boost
@Rapptz he didn't said that boost doesn't have consistent types. He said about consistency of types between boost libraries.
No he didn't.
11:03
Like if you want to use 2 boost libraries together.
You can very well use two boost libraries together -- absolutely nothing is stopping you.
@Rapptz I recall he did.
@Rapptz ok, let's stop on that.
@JohnPoison Depends on the people. In some cases (especially if you're making a library) you might want to minimize external dependencies. Sometimes, their template-heavy style might hurt compile times. Sometimes, people just suffer from NIH
@LightnessRacesinOrbit bored much?
11:05
@JesusChrist Consider trying boost out.
@Mgetz procrastinating
I should stop now actually
I was away, brushing my teeth. Has Jesus turned water to wine yet?
nope
user1804599
We programmers are smarter than runners, because we just restart the race every 100 yards and call it a new sprint.
Ven
Ven
@rightfold that's a pretty terrible metaphor
11:18
Water into wine is easy. Giving the Spanish defence some backbone is hard.
user1804599
@LightnessRacesinOrbit freaking out for a bee. :v
user1804599
Bees are awesome.
Also, Lord, if there is going to be any smiting, please direct it against Uruguay tonight.
user1804599
func map<A, B, C: HList, D: HList, L: HList, M: HList where L.Head == A, M.Head == B, L.Tail == C, M.Tail == D>(list: L, fn: A -> B) -> M
user1804599
Those constraints.
pezant lol
Ven
Ven
circlejerking since ... since ?
@rightfold What language is that?
user1804599
@VáclavZeman Swift.
Ven
Ven
Akka vs boost::asio. which do I use.
user1804599
11:33
@Ven They're completely different things. :v
Ven
Ven
@rightfold I don't care, I just need a crappy UDP server
user1804599
If you want to implement actors I'd use Boost.Coroutine.
user1804599
If you want to do async I/O I'd use Boost.ASIO with Boost.Coroutine.
user1804599
Or Erlang or Go or something like that.
Ven
Ven
Don't get me started on go
user1804599
11:34
Akka is callback-based and as such inherently terrible.
Ven
Ven
:(
user1804599
And Scala has no coroutines so you're screwed.
What's wrong with Google Go?
Or what is right with it?
user1804599
@VáclavZeman Go is simple.
user1804599
@VáclavZeman Go makes it difficult to write generic code.
Ven
Ven
11:35
No.
Go is stupid.
Simple is good. Stupid is bad.
user1804599
@Ven Uh yes, it is simple.
Ven
Ven
Python and Go are terrible and they should feel bad
user1804599
Python is nice.
Ven
Ven
Making abstractions difficult to do is not being good
it's being a terrible tool
user1804599
Python makes it easy to make abstractions.
Ven
Ven
11:38
Python, the language thinking "reduce is too complicated of a function ! let's not include it !"
user1804599
Reduce is part of functools.
user1804599
And if you don't like imperative programming than don't use an imperative programming languages.
Ven
Ven
haskell is the best imperative programming language.
user1804599
I don't like reduce for anything but simple stuff like summing or multiplying the elements in a list.
Ven
Ven
Which is something I do all the time
user1804599
11:40
Which is?
Ven
Ven
summing or multiplying the elements
or or stuff (all / any)
@rightfold go was never intented to write generic code
user1804599
If you do it all the time, then you only use reduce once, because you create an abstraction called sum.
@LightnessRacesinOrbit Meh. Same story in russia:
this kid goes "LET ME HANDLE THAT" and he fucking pulls out a FUCKING KNIFE AND THROWS IT THE FUCK AT IT IN ONE TRY. Of course, the bee flies out of the window quickly.

TEACHER EXPELS THE KID FROM THE CLASS FOR NOT KILLING THE BEE

Kiddo goes on to explain to head master that it was the right thing to do: "BELIEVE ME, THIS BEE WILL NEVER HAVE KIDS! I'VE LET IT LIVE TO TELL ALL THE OTHER BEES NOT TO MESS WITH RUSSIAN KIDS"
user1804599
Which (surprise) is already a builtin in Python.
11:43
@sehe and then the bee used it's russian bee mafia connections to have the kid stung to death
Ven
Ven
@rightfold I certainly hope it is
@Ven It's imperative that Haskell is named the best programming language
Ven
Ven
@sehe meh, no points
@Mgetz It happens. They have spare kids for this
@sehe fun fact Killer bees have gang colors: don't wear black around them.. they will kill you. Or in oakland terms: they don't like nortes.
user1804599
11:46
Often when I use reduce I end up with obscure code and I use a mutable variable instead.
user1804599
Mutable variables are fine in narrow scopes.
@rightfold wait... you got banned?
This is so old, and isn't anything special or "new" you just recycled a previous trick. I've seen it before when I was 17 and was fooled by it, but then I used deduction to find it out.
but then I used deduction to find it out
it was super effective
pasta was very good btw
Ven
Ven
@rightfold "mutable variables in narrow scope" (are you a clojurian to say such things ?) usually means "lack of good abstractions"
user1804599
11:55
I'm a pragmatic programmer to say such things.
@FredOverflow btw it's a dupe: stackoverflow.com/questions/7682477/…
user1804599
Write code that is readable and easy to understand no matter what.
user1804599
Not a single exception.
Ven
Ven
@rightfold I'm very sorry if you can't understand what reduce (+) means :/
user1804599
Some solutions are best expressed using mutable variables.
Ven
Ven
11:56
or even better expressed with good abstractions
sometimes mutilation is the answer
user1804599
@Ven Never said I did.
user1804599
I said often not always. Are you illiterate?
Ven
Ven
@rightfold and I know you understand it
okay, conversation over, you're getting mad and I cba.
user1804599
Good.
Ven
Ven
11:57
@StackedCrooked that's why you created coliru, right ?

« first day (1342 days earlier)      last day (3835 days later) »