« first day (478 days earlier)      last day (4488 days later) » 

sbi
12:00 PM
 
:For units of measure primarily used in countries where English is not the main language, see the article specific to that country, a list of which can be found in the systems of measurement article. An unusual unit of measurement is a unit of measurement that does not form part of a coherent system of measurement; especially in that its exact quantity may not be well known or that it may be an inconvenient multiple or fraction of base units in such systems. This definition is deliberately not exact since it might seem to encompass units such as the week or the light-year which are quite "...
 
user784668
@RMartinhoFernandes In Soviet Russia, you consume C++.
 
@sbi you're late with that, was on Reddit early this morning
@DeadMG good to know you're so humble :P
 
sbi
@TonyTheLion So? AFAIK, most of us are not on reddit.
 
@thecoshman 2.20 - 2.30 ish
price of pint
 
12:01 PM
@sbi oh forgot
 
lunch time
 
That in pounds or Euro?
 
can I assume that when using vector i always can store in it 1e6 integers?
 
pounds per square inch
lol
 
12:01 PM
lol
 
lol
 
user784668
Combo breaker?
 
@ZoZo123 Use max_size() to be sure.
 
:)
thanks
 
user784668
@RMartinhoFernandes Doesn't the allocator throw an exception if the requested size is bigger than the max size?
 
12:03 PM
No idea.
 
in Singapore
 
Xeo
12:19 PM
@LucDanton Nice!
 
Hi everyone!
 
Xeo
What I find interesting, though, is the fact that you don't need parens inside of operator[] to trigger the overloaded commas
 
Which means that if you want a 'clever' (taking more than one argument) operator[] and not use an n-ary operator() if has to work with something like foo[{ bar, baz }].
 
Can someone please give me a small example of how to use `boost::is_base_of` to create a class template that can only be instantiated with subclasses of a base class
*I am still very new to template generic programming/SFINAE/still reading the book*
 
@Olumide struct base; template<typename T> struct foo { static_assert( std::is_base_of<base, T>::value, "Template argument must derive from base" ); };
Using std::is_base_of but same goes for boost::is_base_of.
 
You can use BOOST_STATIC_ASSERT instead of static_assert, too.
 
Xeo
@LucDanton Yeah, or what boost::multi_array does: arr[indices[1][2]] (or something like that)
 
12:42 PM
@LucDanton you mean its enough to just stick a static assert in the class that I want to instantiate with T?
 
@Olumide I don't know what you want to do exactly, but this appear to match your requirements.
 
You may have already addressed it, but let me make it clear(er).
I have a class template `template<typename T> struct Test{}. I want `Test` to be instantiated only with subclasses of a `class Foo`.
 
can I use memset to reset everything back to 0 in a struct that's already been used. I don't want to delete it, I want to reuse it
 
@LucDanton Going a bit further I don't event want Test to be instantiable with Foo -- only derived classes of Foo are valid
 
user784668
@TonyTheLion Is the structure a POD?
 
12:48 PM
@TonyTheLion You can use assignment for that. s = {}; in C++11 for instance.
 
@Fanael yes
 
user784668
@LucDanton Or s = T(); in C++98.
 
it's a heap allocated struct
 
@Olumide You can add that case to the static_assert, the test would become std::is_base_of<base, T>::value && !std::is_same<base, T>::value (I'm assuming that std::is_base_of<T, T>::value holds for all T but I have no idea really).
@TonyTheLion The assignment operator won't ever care or check for that.
 
technically it lives in a memory mapped file
 
user784668
12:50 PM
@TonyTheLion So make it *p = T();.
 
right
 
user784668
If it is a POD, then you can use memset. Whether you should use it is a different issue.
 
Error: `syntax error : identifier "value"`
Should I be using `type` instead of `value`?
 
@Olumide You need the proper includes.
 
12:53 PM
I've included <boost/type_traits.hpp>
 
chances are you wanted to say boost:: not std::
rage of the week: namespace std { using namespace boost; }
please discuss!
 
I've changed all instanced of `std` to `boost`.
boost::is_base_of<MyBaseClass, P>::value && !boost::is_same<MyBaseClass, P>::value
 
now you need to know to use enable_if_c
or and_<,>
 
What? BOOST_STATIC_ASSERT is fine, and that's assuming no static_assert.
 
@JohannesSchaublitb I am an absolute beginner but I'm reading the C++ Templates -- The complete Guide I'm still on page 137 tho'.
Do you think traits are essential in order to understand enable_if's. (I'm yet to reach the chapter on traits.)
 
1:00 PM
Yes.
 
So that's why I'm struggling with enable_if's ...
 
if you're an absolute beginner, don't bother trying to understand how enable_if works. ;)
it's not exactly C++ 101 material
 
For instance there's a group of traits that forms a partitioning of the C++ types. That's important.
 
@jalf I am not a C++ beginner. I am a templates beginner.
So, what am I doing wrong here:
`static_assert( boost::is_base_of<MyBaseClass, P>::value && !boost::is_same<MyBaseClass, P>::value , "msg" )`
 
@Olumide that means you can be C\C++ expert, but you are C++ beginner
 
1:04 PM
@Abyx ??
 
C\C++ or C-with-classes
 
@Olumide We don't know because we don't have the error. There's nothing wrong with that code per se.
Well, there's a missing semicolon still.
 
@Abyx I wouldn't call myself am expert. I understand the language enough t use in commercially.
@LucDanton the semicolon is an error in copying.
Could it be a visual studio bug?
 
oh... every not working code is Windows bug
 
@Abyx why the backslash?
 
1:09 PM
Again, we don't know the error. For all we know the problem might just be that your compiler doesn't support static_assert.
 
I think its a visual studio issue. The following code produces the same error:

`static_assert( sizeof( char ) == 1, "" );`
 
@jalf because it's easier to type for me, that button is near [enter] on my keyboard
@Olumide WHAT ERROR?
 
Switch to BOOST_STATIC_ASSERT (doesn't take a second argument, unlike static_assert) or BOOST_STATIC_ASSERT_MSG.
 
@Olumide which version of MSVC do you have? (sorry if you already said)
 
1:12 PM
@Abyx way to go. I hope you don't communicate your intent in that fashion to a compiler :)
 
@jalf -- VS 2008
 
helping you would be a lot easier if you were willing to tell us (1) which compiler you're using, and (2) which error you're getting. Asking us what might cause an error we haven't seen is kind of futile
@Olumide that doesn't support static_assert
 
47 mins ago, by Luc Danton
You can use BOOST_STATIC_ASSERT instead of static_assert, too.
47 mins ago.
 
@jalf Or the error code is Error ID10T, but that is never nice to assume
 
@LucDanton Thanks! I missed that.
Now I'm getting the error message:
`too many actual parameters for macro 'BOOST_STATIC_ASSERT'`
 
1:16 PM
After having studied various programming languages for several decades, I now present to you the most awesome line of code ever:
 
Use BOOST_STATIC_ASSERT_MSG if you want the error message, or strip it.
 
sbi
Obviously, it's cold in Switzerland, too. It's kind of beautiful, though.
 
printf("%d", printf("%d", printf("Area ")));
 
5 mins ago, by Luc Danton
Switch to BOOST_STATIC_ASSERT (doesn't take a second argument, unlike static_assert) or BOOST_STATIC_ASSERT_MSG.
Note the doesn't take a second argument part
 
@sbi that photo is kind of hard to believe
 
sbi
1:17 PM
@thecoshman It's at the Geneva Lake.
 
@FredOverflow ah, of course. Cool. Who comes up with that shit
 
@sbi 0_o , this is real or some movie set?
 
@sehe I did while taking a shower his morning :)
 
sbi
@MrAnubis According to the news magazine's website, it was shot at the Geneva Lake.
@FredOverflow You take your computer into the shower?
 
1:19 PM
@sbi I can think about programming without a computer, too.
 
@sbi who needs a computer to come up with a pickup line
 
Do you seriously think one could use that nested printf code as a pickup line?
 
@sbi looking like wax , #pragma global_warming :(
 
sbi
@FredOverflow I don't think I have used printf() since the beginning of a C course I took about 20 years ago. (I asked for and got the permission to turn in C++ programs instead of C programs after two exercises.) I'd like to think this is why I don't understand what's happening there. What's "%d" stand for?
@sehe Is he trying to seduce you?
 
@sbi Decimal!
Whereas %h is hexadecimal. Oh wait, that's %x.
 
1:24 PM
@sbi (no.) what else would you use that line for? I guess all this flexing of muscles (including 'I can do pointfree function combinator with my left pinky' or 'templates are meh if it doesn't involve VVTTs and SFINAE on lazy return decltypes") is all to impress females of the opposite sex
(no that wasn't a typo)
 
@sbi looks awesome, really strange formation
 
sbi
@LucDanton Ok. And what does printf() return?
 
@sbi number of chars output
 
sbi
@sehe What's "VVTT" stand for?
 
1:25 PM
@LucDanton huh? %x is hexadecimal and %h is a "sHort" modifier
 
@sbi uhoh. fprint is obsolete. VVTT is the new hot thing!
 
sbi
@sehe Ah, Ok, now I get it. Thanks.
 
@Abyx h doesn't go in the same place as x though.
 
`BOOST_STATIC_ASSERT( sizeof( char ) == 1, "" );` works but
`BOOST_STATIC_ASSERT( boost::is_base_of<MyBaseClass, P>::value && !boost::is_same<MyBaseClass, P>::value );` does not
 
@sbi Variadic variadic template templates
 
sbi
1:26 PM
@sehe Ah, I heard about that one, but I haven't seen Andrei's talk, so I don't know what it is.
 
@Olumide That's because of the comma. Add braces, i.e. BOOST_STATIC_ASSERT(( ... ));.
 
Xeo
@Olumide You need to put the whole expression in extra (...) parens.
 
template <template <typename...> class...> class X {}; if I'm not fucking that up
 
<-- n00b
 
yep. that n00bz do "commercial programming".
 
1:28 PM
It now works. I'm a little bit smarter. Thanks for your patience. I will continue to read the book so that I can ask more meaningful questions.
@Abyx SO, especially the chat has showed me how much more I need to know. Especially in the generic programming. So I freely admit that I am a n00b for now. But I can feel the force rising in me ... )
Nope that's just gas :)
 
@sbi For those who don't get it: The length of "Area " is 5, and the length of "5" is 1 :)
I found it interesting that Andrei seems to prefer class over typename for template parameters. Is it just to save space on the slides, or is there a deeper reason?
 
sbi
@FredOverflow Well, I did say I got it. The necessary clue was what printf() returns. I didn't know that.
 
@FredOverflow I didn't even notice that.
 
Jiffy is an informal term for any unspecified short period of time, as in "I'll be back in a jiffy". From this it has acquired a number of more precise applications for short, very short, or extremely short periods of time. Known since the 18th century, the word's origin is unclear, though one suggestion is that it was thieves' cant for lightning. Beginnings in measurement The earliest technical usage for jiffy was defined by Gilbert Newton Lewis (1875–1946). He proposed a unit of time called the "jiffy" which was equal to the time it takes light to travel one centimeter (approximately ...
 
@LucDanton D doesn't need either, right?
 
1:33 PM
well there you have 'back in a jiffy' is a ridiculous thing to say
 
@FredOverflow Not familiar with the language.
 
sbi
@FredOverflow IME there's three major camps when it comes to that. 1) Those who've always used class and see no reason to change. 2) Those who use typename, because it fits so much better. ("Really, int isn't a class, after all.") 3) Those who use both, putting meaning into it. (Usually: "It's class when a built-in wouldn't do, typename otherwise.") There might be other camps, too, but those are the major ones.
 
@sbi classes can be PODs, too :)
 
I think #3 is the silliest.
 
sbi
@FredOverflow :b
 
1:35 PM
hmmm
should I have a while loop in destructor?
 
sbi
@RMartinhoFernandes When I was writing C++ for a living, I used #3.
 
There was a period when one compiler also allowed struct for template parameters :)
 
Xeo
@sbi 4) Those who find typename just too long. I mean, c'mon, three whole characters! (Yes, I'm in that camp.)
 
I'm destroying a process and waiting for a flag to be set until it's done
 
@TonyTheLion If you need one, sure why not? Unless it's an infinite loop :)
 
1:36 PM
and then resetting a data structure
 
@TonyTheLion depends on what it does
 
sbi
@Xeo That's just a sub-type of #1, really. Also, the time it takes to write code is irrelevant. It's only the time it takes to read and grok it that matters.
 
an infinite loop, probably not
 
well, the point is, if the process doesn't shut down for whatever reason, the while loop will be stuck
which is bad bad bad
 
then only allow it to run for X time?
 
1:37 PM
hmmm maybe I'll just have a destroy() function instead
 
anyway, what would you do if the process doesn't shut down?
 
that's another thing, wtf do I do?
 
@TonyTheLion up to you :)
 
windows doesn't give you much control of another process.
you can't ever really know if it's crashed
for one thing
 
1:39 PM
@Xeo #define TYPE typename
 
@jalf what would be the sane thing to do ?
 
@TonyTheLion How could you possibly know that?
 
std::terminate()
 
but usually, I guess it'd go something like this: (1) ask the process to close, and wait to see if it does, then (2) try to kill it, then (3) if practical, ignore it and continue execution, otherwise terminate your own process
 
@FredOverflow :abbr TYPE typename <- non-intrusive.
 
1:40 PM
@RMartinhoFernandes donno, Windows Error Reporting seems to know
so it must be possible to know
 
@RMartinhoFernandes What is :abbr?
 
Xeo
@sbi If something spans 5 80char lines that could be made to fit in 3 80char lines, that's a good reason for me to prefer the more concise version. It eases reading that thing.
 
@TonyTheLion Ah, but that's after it crashes.
@FredOverflow vim command.
 
Xeo
@FredOverflow Creates an abbrevation
 
@RMartinhoFernandes well, in the Win Kernel there is stuff to attempt to detect a hanging process
 
1:41 PM
@Xeo Go back to the 80's with your teletype and your 80 characters per line.
 
@Xeo So is that replaced during "typing time" or when? :)
 
Xeo
@LucDanton It was just an example. :P
 
@FredOverflow tn<Tab>
 
80 characters per line makes me so angry I'd buy a 4th monitor.
 
sbi
@Xeo No, it doesn't.
 
1:42 PM
you have 3 already?
 
sbi
Wrtn txt dsn't gt esr 2 rd thr shrtng.
 
lulz
we're not sending text messages
 
Xeo
@sbi That's not applicable, class isn't an abbrevation of typename, c'mon
 
like some do in some cryptic wording
 
@TonyTheLion but even if you could, would you rely on it? Can you guarantee that this mechanism always successfully detects a hanging/crashing process?
 
1:42 PM
@sbi Cn u plz trnsl d lst 2 wrds?
 
sbi
@Xeo But you claim short easier read text. Which simply isn't true.
 
@jalf not necessarily.
I'll just ignore it then
 
sbi
@RMartinhoFernandes I can't read them myself.
 
Xeo
@RMartinhoFernandes through shortening
 
@TonyTheLion so try to make it shut down nicely, and if that fails, you'll have to decide if it's possible for your process to continue meaningfully, or if you have to terminate yourself
 
1:44 PM
If the process is code you control and it stops behaving (i.e. doesn't shut down when asked), it's probably better to kill it.
 
Xeo
Damn. I thought N3337 would be nice to have as a more up-to-date paper of the standard than N3290(FDIS). Then I found out that the FDIS was 6 MB bigger for a reason: It seems to have a huge index of the words inside of it. Searching the FDIS for "signbit" took 2 seconds, searching N3337 for "signbit" took.... a little bit longer, it actualyl searched the whole thing word-for-word
 
@RMartinhoFernandes I have the codez
 
... kill it, log the thing, and fix the bug.
 
@jalf it can continue meaningfully, with only the potential of having a stray process around
 
@TonyTheLion so that's what you should do. Ask it to shut down, then try to kill it, then ignore it :)
 
1:46 PM
well thanks for the advice :)
 
Damnit, I want to see the rest of GoingNative. I have already watched STL's talk three times, where is Andrei's? :)
 
jeez three times
remember they are still sleeping over in Seattle
 
I had to watch it three times as per the rule of three ;)
 
so if they post it today, it will be late tonight our time
@FredOverflow oh, so you had to assign to something?
 
@FredOverflow it wasn't that good?
 
1:48 PM
Andrei's one on static if was good and funny
Herb Sutter's keynote on the second day was awesome
The second days live stream recording is still up btw
 
@TonyTheLion I watched it once for the copy constructor, once for the assignment operator, and once for the destructor. Kind of like when you eat one for mommy, one for daddy, one for aunt X, one for uncle Y etc.
 
I was watching Bjarne's talk on concepts earlier
lol
 
@TonyTheLion But the quality sucks compared to the downloads, right?
 
@FredOverflow it's not bad actually
 
I agree with Tony, it's neat.
 
1:49 PM
Oh wait, I got it.
 
@FredOverflow what are you guys using for browsing? My browser has an address bar.
I only have to start typing chan and it will complete the rest of the URL?
 
@sehe telnet
 
links doesn't have an address bar.
 
Or start VLC and Ctrl+1 to restart the live feed (not very useful a.t.m.)
 
1:51 PM
Oh nice, watching Herb's day 2 keynote now. Quality acceptable.
 
@RMartinhoFernandes It does (g) but its support for video requires libcaca which doesn't impress me too much
 
@sehe That's not an address bar.
 
a man walked into an address bar, and said... 404?
 
@RMartinhoFernandes a goto box? a destination modulator? manual url redirect intervention disruptor?
 
URL capacitor.
 
1:54 PM
@sehe Firefox
 
@RMartinhoFernandes anyways, shell history would be ok too
 
2:04 PM
I need a ptr_vector and I cannot use Boost, so I'm implementing my own, would I need to have allocator template arguments? I mean, I won't ever need it
 
@FredOverflow his co-workers got confused about the std he set in Modern C++ Design.
IIRC
 
He: "Do I know from somewhere?"
She: "307 Temporary Redirect" (or "403.1 - Execute access forbidden")
In the wrong bar, you might even get a "402 Payment Required" (eek)
 
depends on what you are looking for @sehe
 
@sehe oh, i'm just reading a book i bought by mistake. written by a fem. so now i gain some insight in the female always-social-game thinking. it's revealing and horrible. book plot is also silly: a wild virus makes people who die into zombies for a while. but the back page blurb said it got good reviews. huh.
 
sbi
@AlfPSteinbach That reminds me of: "I order chicken 404":
 
2:11 PM
is size_type a typedef of something?
 
Yes. Usually size_t
 
ah, hmmm
 
> Hi Dan,
> So what did you do to build 12.2.5, can't you do the same in 12.2.8?
>
> BR/Andreja
 
But you can probably just use it from the underlying vector.
 
@TonyTheLion in particular, as R. says for a std::vector without custom allocator, because it picks it up from the allocator
 
2:12 PM
needless to say, I'm not happy with that response
 
ok
how should I define the iterator here, can I use the underlying std::vector<T> iterator?
 
@TonyTheLion I haven't the slightest clue
 
@Gabe your avatar is too similar to @StackedCrooked
 
@TonyTheLion Yes. Except I'd expect you to use std::vector<T*> internally.
 
Xeo
2:22 PM
@TonyTheLion First, I'd use std::vector<T*>, so the user of that class only needs ptr_vector<int>
 
ah, so I have to have std::vector<T*> vec_;
 
Xeo
Well, it's a pointer vector after all
 
std::vector<T*>::iterator erase(std::vector<T*>::iterator first, std::vector<T*>::iterator last);
this would be my erase function signature?
 
Xeo
yes
@Tony, do you have access to C++11 features?
 
nope
should T be a pointer or not in erase ?
 
Xeo
2:24 PM
Well, then write yourself a value_ptr that automatically does deep copying
And use std::vector<value_ptr<T> >
@TonyTheLion The iterator needs to be from the same vector type as your internal vector
As such, yes, T*
 
@TonyTheLion I recommend typedef typename std::vector<T*>::iterator iterator;. That way the interface is 'fixed'.
 
meh, sounds good, but I have no idea :(
I probably need a dtor. copy ctor and assignment operator
meh
 
Xeo
Not if you write that value_ptr
 
right, well, what exactly does that value_ptr do?
it just owns the pointer
 
Xeo
Deep copy and otherwise behaves as unique_ptr
 
2:27 PM
I don't recommend deep copying if you want to mirror the pointer containers of Boost, they don't use that.
 
Xeo
aka value semantics for pointers
 
Do they?
 
Xeo
@LucDanton That'd be strange
Or are you thinking of boost::shared_array?
 
well, I'm taking Boost's vector_ptr as an example
> A ptr_vector<T> is a pointer container that uses an underlying std::vector<void*> to store the pointers.
so their underlying container has a void* in it
strange
 
Xeo
oO std::vector<void*> wtf
 
2:29 PM
how the hell do they keep type information when they cast all to void* ?
 
Xeo
@TonyTheLion template parameter of ptr_vector
 
For instance, I notice that the pointer containers aren't copyable.
 
hmmm maybe I should do the same
for ease sake
 
Ah yes, spotted it in the documentation. They do use cloning.
 
Xeo
@LucDanton linky?
 
2:32 PM
oh shit
can I just make mine not copyable, or is that a bad idea?
 
Xeo
@TonyTheLion Depending on your use. With a value_ptr, being copyable is easy
FWIW, here's an example implementation of value_ptr: ideone.com/nvrgV
I'm sure I missed a ton of stuff, but oh well
 
Most important of which being ADL for the clone operation I think.
Implementing that clone operation to use t.clone() where available instead of (potentially) slicing left as an exercise as I'm about to take a nap.
 
Xeo
Ah, yeah, interfaces do not cope well with new Base(*derived_ptr)
 
well I'm using it to manage a bunch of processes
 
2:38 PM
In MVC how do you know how much code (functions) belong to a controller?
 
and the most important thing I need to know is how many procs are running at any given time
so I guess, that I don't need copying/cloning
but I do need a dtor in my vector_ptr
 
Xeo
Eases your implementation
Obviously
 
Lets say you have a Question model, Question controller and Question view
 
I should prob make the copy ctor and assignment operator private then?
 
Should both admin and public functions in the controller be in the same controller?
 
Xeo
2:39 PM
@TonyTheLion Wait, you can even avoid that. Just use my value_ptr, remove the copy ctor (aka, make private or inherit from a boost::noncopyable-like class) and rename it to scoped_ptr. :)
 
let's say you're building a house in Switzerland. How many windows should it have?
 
@TonyTheLion The problem with using std::vector<T*> instead of a smart pointer is that simply put, you will mess up and forget to properly delete in some operation.
Since C++03 doesn't have std::unique_ptr, a cloning smart pointer is actually one of the simplest, most correct solution.
 
@LucDanton I was planning to do a delete in the dtor
 
@TonyTheLion What about erase? assign? operator=?
 
Xeo
@LucDanton A noncopyable scoped_ptr is even simpler
 
2:41 PM
damnit, I hate myself for not using c++11
 
You can use a shared_ptr and not let those pointers get copied by users, but that means not having copyable containers. It's not that bad.
@Xeo Good luck putting that into a container.
 
Xeo
@LucDanton Ugh, right, C++03 containers do require "CopyConstructible"...
 
@Pjotr maybe. The thing about design is that it relies no thinking, and analyzing your requirements, rather than on following a few simple and universal rules
 
Even C++11 doesn't let you get away completely with EmplaceConstructible or whatever construct they messed up :).
 
So which answer would lead to the cleanest, simplest, most maintainable design?
figure that out, then pick that
 
2:44 PM
@jalf clean, simple, maintainable; a list of three desirable attributes of which you can only ever have two
 
Xeo
@LucDanton Man, to hell with C++03. :/ A cloning pointer will copy up to twice when inserting it, and everytime the vector space expands... A raw pointer might actually be the best solution, albeit not the simplest.
 
@thecoshman not really. Often they're little more than different names for the same thing
if something is both clean and simple, it's going to be easy to maintain as well
 
@Xeo Boost.Move to detect moves?
 
anyway, you want all three, so you just have to come up with the compromise that gets you closest
 
Also, I'm supposed to sleep.
 
2:46 PM
@LucDanton I'm confused now, what should I do? Use a shared_ptr or the value_ptr that @Xeo showed me?
 
Xeo
@LucDanton No Boost for @Tony. :s
 
whether or not you can achieve all three perfectly is irrelevant
 
@jalf How do you know when to make a new controller? Instead of just adding to the same controller?....I mean when do you start to spread code?
 
@jalf I was making a funny, comparing it to cost, time and something or rather
 
Xeo
@TonyTheLion shared_ptr if you want a simple, albeit a bit slower solution (due to atomic refcount incs/decs), or raw pointers if you want performance but a more complicated implementation
 
2:47 PM
@Pjotr (1) when you look at your code and go "I could make this simpler and better if I split it out into two controllers", or (2) when you try to make a new controller and afterwards go "hey, this is nicer"
 
@TonyTheLion You have the final say. From my C++11 perspective you're between a rock and a hard place :p
 
@Xeo I'll use raw pointers and rely on the fact I have a Lounge full of experts to help me if needed :)
 
Xeo
@LucDanton +1
 
@LucDanton meh, been to hard places before, won't kill me
this makes me realize I don't know nothing about C++, just this little excerice
:(
 
@Pjotr once again, there is no simple rule you can apply instead of thinking. You have to look at your code, and ask yourself "would it be better if I changed X?"
 
2:49 PM
@jalf I see
 
and if in doubt, try it and see what happens. And roll back your changes if it's not succesful
 
So there is no such thing as one controller for each model?
 
@Pjotr depends on who you ask
 
You :=)
 
If you ask a MVC fanatic then there might be. But then the question becomes "should I split my model in two as well?"
if you ask me, then there should be exactly as many controllers as makes sense in your situation
but yes, with MVC it is common to have exactly one controller per model
apart from everything else, the advantage to this is in the principle of least surprise. People expect it, so if they encounter anything that behaves differently, they get surprised and confused
 
2:52 PM
I have one Question class and one Answer class which is the model of my application. One question has multiple answers. Would you make one Question controller that do CRUD operations on an Answer entity and also add answers to a question in the same controller as those that do this on the Question entity.
 
so if you feel the need for more than one controller, perhaps you should create more than one model as well
 
user784668
@jalf Oh, but there is! You don't have to think, you can throw a die.
 
but in the end, your goal is not to obey all the rules of MVC
your goal is to write code that does what you need, and which is easy for you to read, understand and maintain
@Fanael I prefer to use random.org :)
@Pjotr Depends on one tiny little insignificant detail, that people often gloss over
What does your application do?
Who cares how many Question classes it has? What matters is the problem it is trying to solve?
 
hey
 
That's what I'm trying to say. Are you writing a program, or are you doing architecture masturbation? If you're writing a program, then evaluate everything against the goal. If I do X, does it bring me closer to achieving my goal? Whether or not it is MVC, whether it is OOP, whether it is C++, whether it is anything else is completely irrelevant in itself. Those things are only relevant when they affect your progress towards your goal
3
 
2:58 PM
> architecture masturbation
priceless
 
keeping a nice MVC architecture might help you make your code more maintainable or readable. But then it's a means to an end, and not a goal in itself, and it is only useful to the extent that it helps you move towards that goal
 
@jalf But the controller purpose is to act as the "thing" who talks to both the model and view right?
 
@Pjotr Who cares? Fuck the controller?
does the controller pay your wages?
 
1+1+1+1+1+1+1+1+1+1+1*0= ???
 
@RMartinho: ahoy ahoy robot, is you here?
 
2:59 PM
What is your application's purpose? That's what matters? once you've decided that, you can ask whether you need a controller, and what the controller should do
 
haha
 
@TonyTheLion 10. the multiply has higher precedence, so it gets evaluated first.
 
It is infact a Rails app
 

« first day (478 days earlier)      last day (4488 days later) »