« first day (490 days earlier)      last day (4455 days later) » 

sbi
9:00 PM
@DzekTrek Well, "Gang of Four", of course.
 
How silly of me... Thanks. :)
Any recommended book about DP too?
Design Patterns: Elements of Reusable Object-Oriented Software
 
excellent @sbi This looks promising
 
if you're not careful, you'll end up with Object Orientated Software: Elements of Design Patterns
 
@DeadMG Why so?
 
9:07 PM
it's very common
what the book says is "These elements we've found often in good OO programs."
what people read is "Good OO programs are composed of these elements."
 
sbi
It seems Hitler had an illegitimate son who (unknowingly) fought against his Wehrmacht in the French resistance. This truly is one of the weirdest stories of the 20th century.
 
:) Thanks for explain.
 
got a problem? A Design Pattern must be the solution!
 
Got a design pattern? Let's put it here just in case we have a problem.
 
If you do auto& someref = *someptr; and someptr == nullptr, is the behavior undefined?
 
9:09 PM
Yes.
 
Thanks!
 
Do you have any objection for the use of DP in code? What is good and bad using it?
Particularly you can solve many problems using DP. I see no bad side of it at all.
 
Hello all
 
uh, DP?
 
hello @Hoxieboy
Design Pattern ( DP ) @DeadMG
 
9:12 PM
it's simple
they're inflexible
according to the Single Responsibility Principle, every class should have one and only one responsibility
 
@sbi Woah
 
? Isn't the main cause of DP was to be flexible? What do you mean by inflexible?
 
nobody ever said that responsibility could be expressed as one design pattern
and there are many places where non-pattern solutions are better than the pre-patterned solutions
for example, I have one class whose job is to represent the state of my Direct3D renderer
it's a Factory, but it's also a bunch of other things
 
@DeadMG not that this is my area of expertise at all (far from it :) ) but it usually doesn't matter from what programs I have made. Rarely are you ever going to make a swiss army knife of a program, but when you do, I would say that you are right :3
 
and decomposing it into patterns would be a great loss
patterns are not elements- not all good programs or classes are constructed from some combination of them
patterns are to be seen, recognized, documented- they're not to be explicitly created
that defies their whole purpose
the point of a pattern is simply that the GoF guys saw it often in the code they reviewed- that's it.
that doesn't make that code good code or beneficial code or code that's gonna fit your codebase
or what you really need
 
9:17 PM
GoF came up with several patterns, template, delegate, command, decorator, etc
however the important thing to understand is for every language they are applied differently
 
But, why would you use Factory for representing the state of Direct3D renderer if you don't use any other renderer?
 
and for some scripting languages theres an entirely different implementation of the pattern
 
@DzekTrek I do use some other renderer(s).
but the point is that the state of the D3D renderer is more than just a factory
 
my favorite pattern is the composite
 
it's a factory and a bunch of other stuff
 
9:18 PM
I see then you want use just Factory, but combination of several DP which will suit your need.
 
no!
I want to write the code that's going to work, the fact that it is also a DP is irrelevant
 
its not just abot patterns
its about algorithms
 
it's semi-useful when describing what the class does
that's it.
see, here's the thing about DPs- if they're what you need, then you tend to find them all on your own, at least, that was my experience
 
well, I don't know
but I find DP to be more clear/useful than anything rest in the code.
 
and no DP will tell you what objects to make from your Factory
 
9:21 PM
I think about building a robot's computer system when I code, 1.) make a literal library of functions that the robot COULD use when it encounters a problem 2.) have the main "brain" of the robot (program) that identifies the basics of the problem, determine the most efficient "library" to use, and it then implements it
 
@DzekTrek Clarity about bad code is still bad code.
coding, and OO coding, is hard. Anything that claims or seems to make it easy is a big red flashing light.
 
Well if I wanted to dynamically configure my factory I would call for prototype, if I wanted a single instance of Factory I would call for Singletone, if I wanted to implement Factory I would call for Factory method etc.
 
@DzekTrek See, you've just proved my point.
If you want a single instance of Factory, you would just call the constructor once.
There's no need for any Singleton here
 
It's pretty much obvious why the clarity of the code that uses DP is at much higher level than the code that doesn't.
 
you've just made a colossal mistake with the Singleton
 
9:24 PM
nver use a singleton
 
No, Singleton is already implemented into Factory
 
global access? Why? You never required that. One single instance? Just because you need a single instance today, tomorrow it's gonna be two instances.
 
there is no need for "putting" new singletone
 
SO still offline? What is the reason...
 
I just referred to the clarity of what Factory does.
 
9:24 PM
@sehe >.> what did I say
 
@DzekTrek As I've just said, there's no benefit in being clear about what your code is if what it is is a pile of junk
 
@Hoxieboy ROTFL
 
XD
 
Even the blog, that supposedly should shed more light, is now offline
 
Now I don't understand your point of view at all. Why would you classify DP coding as a pile of junk?
 
9:25 PM
sehe D:
 
@sehe I just loaded it.
 
@DeadMG link? does it show you content or placeholder :)
 
@DzekTrek Well, you just introduced a Singleton for no good reason. That's most certainly junk code.
 
thats alot of dlls :o
 
@DeadMG ah, apparently I replaced the link by clicking through
 
9:26 PM
and I also just loaded the SF blog just fine
 
Well, whole transaction matter would be gone if it wasn't for Singleton. ( just one example why Singletone is crucial for us )
 
lol "panic: Going nowhere without my init!"
 
@Hoxieboy nice
 
@DzekTrek Singleton is utter junk. Any design that calls for one should be scrapped immediately.
 
Singleton itself is one of the DP.
 
9:28 PM
Hey, it seems stackoverflow is back
 
which is why it makes a perfect example that DPs are hardly all-holy, everything's great
 
Yup it works
 
some DPs are utterly worthless, like Singleton
even the GoF think it was a mistake to add it
 
SO's back!
 
@sehe also I was experimenting with an agent based "hive" program in python, and I made it simulate essentially a beehive. I made the agents "bees" search "fly" through my computer, and find text files, take a random character, and mark it as searched, it then used those characters to build a new hive or repair the old one, or make more agents
 
9:29 PM
I just noted an example why is Singleton good for us. Without this pattern, encapsulation wouldn't be achieved at all.
 
It was fun to watch :D
 
@DzekTrek Are you kidding? Do you even know what encapsulation is? Singleton is practically the definition of non-encapsulated code.
 
Would you agree with the kicking of static out of C++?
 
in terms of non-const mutable global state?
 
@DeadMG Nah, you are wrong.
 
9:31 PM
yes
@DzekTrek I'm not going to treatise you on how bad Singleton is. That material can be found trivially.
jalf has a great post about it somewhere
 
What about constructor that calls itself only from the class?
@DeadMG Would be nice. :)
 
@DeadMG What about communication between many classes? What then should be used if not singletone?
 
@DzekTrek How about an interface?
 
Yes, interface + singletone
You can't achieve this if it wasn't for singletone for sure.
 
9:34 PM
uh, you could use just an interface on it's own?
I usually find them finefor all my interfacing needs
 
@DzekTrek Objects?
 
you could, but what if classes don't require instances to approach communication class, and what if even communication class doesn't have it's own instance? What then should be done? @StackedCrooked @DeadMG
Inheritance + singleton
 
@DzekTrek Then refactor the rest of your design to be less stupid
there should be no classes whose sole purpose is to communicate between other classes
 
rofl listening to my family argue and watching people argue on here, something tells me the world wouldn't be without arguing
 
and there should be no classes with no instances
 
9:39 PM
Communication between many classes using singletons with result in a tightly packed ball of suck.
 
Usually if I find myself wanting a singleton, I just write a bunch of free functions and put them in their own namespace
 
Communication between many classes is a code smell in the first place. It likely violates the "weak coupling and strong cohesion" principle.
 
@DeadMG It would be appropriate if it's about small app, but what if we have so many classes? What then?
 
@DzekTrek Then the same techniques apply.
also, if you have so many classes, then again, you have a bad design
 
Relying on globals is bad.
 
9:43 PM
define so many classes
 
It hides dependencies between classes.
Which should be stated in the interface.
 
You all have bad picture about singleton as some global variable or method. @DeadMG but what if that app is big?
 
Be it ctor or member function arguments, where needed.
 
@DzekTrek Each modular component should be of managable size. But adding a Singleton only makes things worse, not better.
 
There is no good picture about singleton.
It introduces tight coupling, dependency hiding, and in naive implementation, data races.
 
9:44 PM
because now every module has to know and deal with the Singleton
 
that's why you have to use singleton.
 
If a big application is using singletons, it's not testable.
 
no, that's why you have to avoid Singleton
 
You cannot unit test when units are all entangled together.
 
there are test modules for sure
 
9:46 PM
Good code is loosely coupled.
 
It's hard to keep huge GUI applications clean though. The UI is where everything comes together. To keep it maintainable different kind of "controllers" and "providers" are defined. And those often end up to be singletons.
 
not all, just module part ones
 
You cannot write loosely coupled code using singletons.
2
 
@CatPlusPlus Yes!
 
Ha! What a typo!
 
9:46 PM
Typo.
 
lols
 
I was really puzzled for a second.
 
Singleton is the very definition of tight coupling.
 
nah, I spotted it instantly
 
:D
 
9:48 PM
But go ahead and write your great singletonised apps. Just don't cry a month from now that it's unmaintainable.
 
Singleton can be used as loosely coupled if you rely on one aspect of the code.
 
What?
 
there's no such thing
 
When I first learned about the singleton design pattern the provided sample was a President class. Since there can only be one President the class must be a singleton.
 
the Singleton has only one responsibility, remember?
 
9:49 PM
only one responsability, but can act in many scenarios.
 
You're not making sense.
 
Is it like that one ring to rule them all?
 
As for UIs, even large "UI context" structure is better than a global singleton.
 
it can only act in one scenario, making your code bad
 
oh my god you guys are still going on about singletons? -.-
 
9:50 PM
I have OS context and Render context
 
Also strict MVC doesn't really work for UIs.
 
Yes, for good sakes! Ok, you have one OS context and one Render contezt
 
and will have a UI context
 
how come you can use both of them?
 
"Context" objects are useful to avoid static variables, which can lead to unintended singletonism.
 
9:51 PM
well, you can make two Render contexts if you really want
why you'd want to, I don't know, but you could
 
what a bunch of robots, I say maybe its a good idea to stop talking about "singletons" and you guys just keep going... erg
 
Shoehorning concept of "controller" into inherently asynchronous code is silly.
 
you can make, but for the implementation only one render is needed.
 
._.
 
That doesn't justify making it a singleton.
 
9:52 PM
that's why you come to the part of abstract factory, in which is implemented singleton too
 
Boost asio also has the "io_service" object, which is a sort of context object.
 
Which makes coding harder, not easier.
 
rageface
 
Why don't we all get on with our lives
 
@Hoxieboy: no your help isn't needed
 
9:53 PM
there's no reason that much of my code should access the Render context
 
14 mins ago, by Hoxieboy
rofl listening to my family argue and watching people argue on here, something tells me the world wouldn't be without arguing
 
@sehe its not help its a sugestion
 
so, you could always use decorator for it
 
@SethCarnegie First we must kill the singleton.
 
@StackedCrooked I saw what you did there
 
9:53 PM
haha @Hoxieboy
 
@StackedCrooked Burn it at the stake
 
Yes, I rephrased.
 
burn it with fire before it lays eggs?
 
@StackedCrooked :) for posterity!
 
oh yeah
 
9:54 PM
I love the random pattern name dropping.
"We don't have a problem? Let's make ourselves one with a design pattern!"
 
also, it's a really bad idea to make the render context a Singleton because in a few years, I might well decide to replace it with a Direct3D11 context
 
@CatPlusPlus "If it ain't broken, fix it until it is"
@DeadMG You mean, replace it with someone else's singleton. Yeah, much better
 
FUUUUUUUUUUUUUUUUUUUUUUUUUU "singletonthissingletonthatsingletonthissingletonthatsingletonthissingletonthat"
 
If it ain't broken, add more abstract decorating singleton factory proxies.
 
nah, cause you might wish to swap them at runtim
 
9:55 PM
@Hoxieboy Hey, you didn't influence the word frequency stats by even a percent there
 
that's why you can use AF.
 
@sehe I count that as a good thing
 
after some years to code you only add D3D11
 
@CatPlusPlus Honest face: "But it makes sense to have a singleton for a global factory factory" (.... :))
 
singleton is not global method or variable.
 
9:57 PM
@DzekTrek It's global state.
 
@sehe It obviously needs parametrised parametrised factory factory configured with ten XML files.
 
it ain't global state too.
 
Enlighten us, master, with a singleton that's not global.
 
I'm a singleton
 
It's just a state with high priority that is used when some object is called.
 
9:57 PM
@CatPlusPlus Ooooh, make it XBRL to be more enterprisey. That way you can depend on a dozen taxonomies and require a XBRL processor to even read the config
 
The Design Patterns book refers to the ideas of a certain architect called Alexander. One of the ideas is that the construction must naturally blend in with the environment. This is funny because the code has the opposite effect when using names like AbstractSingletonFactory.
 
@Hoxieboy "I'm a singleton and I'm okay ♫"
 
XD
 
"I'm singleton and I'm high priority."
 
9:58 PM
singleton your mom!
 
hahaha
:D
 
lol
 
Ell
has anyone got a c++11 smart pointer cheat sheet? which one to use when?
 
It's poetically speaking, @CatPlusPlus . I'm sure you understood what I wanted to say.
 
9:59 PM
@Ell I believe we manufactered a faq entrt on that a month ago
 
37
Q: Which kind of pointer do I use when?

sbiOk, so the last time I wrote C++ for a living, std::auto_ptr was all the std lib had available, and boost::shared_ptr was all the rage. I never really looked into the other smart pointer types boost provided. I understand that C++11 now provides some of the types boost came up with, but not all o...

 
No. Singletons make code worse, always, even when they're justified.
 
always
 

« first day (490 days earlier)      last day (4455 days later) »