« first day (362 days earlier)      last day (4593 days later) » 

10:00 PM
MVC makes sense if the View part is written in a markup language like XUL. But it doesn't make sense when using Java Swing for example.
 
The problem starts when you think "Oh, I have to follow a pattern."
 
I don't even know what Java Swing is
 
@StackedCrooked Doesn't Java have some kinda markup for describing the GUI too? I thought that's what Android used.
 
Must use some XML thingy
 
10:01 PM
Swing doesn't come with anything like that AFAIK.
 
@Praetorian That's an Android thing.
Regular Java doesn't have that.
 
@Praetorian could be. I'm mean using swing api without markup language.
 
MVC can work, but not when you try to shoehorn your code into a pattern.
 
At least until Java 6.
Shoehorning code into patterns never works.
 
@CatPlusPlus I know you don't like Objective-C either, BUT I was an iPhone developer this summer and I must say it was great when using the Cocoa API and following the MVC-pattern. Really productive!
 
10:03 PM
I favor a pull approach: the View updates itself periodically. The classic approach where the GUI updates after receiving a changed-notification from the GUI is a little error prone imo.
 
I didn't look into Cocoa, but if it follows ridiculous conventions of e.g. NSString, then I don't want to use it.
 
I think MVC works best in Web apps.
 
Is the NS* stuff used by Cocoa part of NSPR? Just curious ...
 
@CatPlusPlus NSString and co aren't very intuitive.
 
Splitting models and views make sense in UIs.
Controllers, that's where shoehorning starts.
 
10:05 PM
TIL about 'shoehorning'
 
And model should update the view, after all, the data lies inside the model, so it knows when it changes.
Dammit, words, why do you keep being wrong.
 
I once tried to implement MVC rigorously and the result was like a bad dream.
It's the C part that is problematic.
 
Yeah, controllers make little sense.
There was a hilarious blog post from someone, crying that webapps don't really do MVC but something else, and should stop using the term.
 
10:08 PM
The controller receives the event from the view and updates the model accordingly.
The controller receives change events from the model and updates the view accordingly.
This makes me shiver.
 
You have a controller for each view, and you have models for one or several views
 
I prefer Django's model-view(-template) approach for webapps. There are no controllers.
 
You don't have models for views. You have views for models.
 
@StackedCrooked True, still you did understand what I meant hopefully
of course you have views for the data
 
I tried to implement a GUI library where you could bind the a component's value to a callback. e.g: label.setText(boost::bind(&Model::getUserName, model)); But it's error prone during program exit.
 
10:11 PM
"Here's this piece of code that is not actually possible, but I don't know that because I don't know the language and I didn't even try it. How is this possible?"
 
@CatPlusPlus MVVM pattern doesn't use a typical MVC controller either, the controller (ViewModel) resembles a sort of alternate version of the model itself
 
@RMartinhoFernandes What are you referring to?
 
A silly question someone posted.
-2
Q: How is it possible to cast between types without having to create an object of the target class first?

AlexI was wondering about the following: Object sender = new Object(); Button BtnPushed = (Button)sender; How come it's possible to cast from an object to for example a Button, but without having to create an object of the class Button first? For example like this: Object sender = new Object();...

 
@RMartinhoFernandes Those are real beginner questions and I don't think they should be bashed on. It's normal to ask stupid questions at this stage.
 
People seem to not be able to figure anything on their own.
 
10:16 PM
@StackedCrooked Isn't it best if beginners are taught to figure it out by themselves?
In this case trying it would make the question moot.
 
I remember my first C++ problems. I had spent over an hour trying to compile a dead simple program. I was going crazy and posted this stupid question.
That was in 2004, so long ago :)
 
I remember when I started programming, I did not have ubiquitous Internet access.
I had to figure out a lot of stuff on my own (and with some help from books too).
I think that was a good thing.
 
I've started with no Internet, one Turbo Pascal 5 book and a game magazine that were publishing a Pascal tutorial then.
 
Similar here, except it was Turbo Pascal 7, and no magazine.
 
Back in 2004 I had to rely on the C++ mailing list to get help. This meant waiting for 24 hours before getting an answer. So I still had time to think it over.
 
10:22 PM
The funniest thing is that there are still people trying to use TP7.
 
Ssh, don't bash that. I have very fond memories of it.
 
I had done a Java Tetris game around 2000 before I had internet. I got it to work but it was a horrible mess. I had numerous copies of my code called backup, backup2, etc.. (Didn't know about source control back then.)
 
I remember when I discovered what the Debug menu was for.
 
And it was outdated like hell even 10 years ago.
 
That was awesome.
 
10:22 PM
I don't think I did any debuggers before learning C++.
 
Actually I was using Visual J++ back then.
I learned to use the debugger when I learned C++.
 
And one day, someone told about these things called "functions" and "procedures".
You won't believe how happy that made me.
 
Also, I remember staring at Turbo C and wondering what the hell is memory model.
 
"You mean I can avoid repeating this code all over the place? I knew this could not be right."
 
And then I discovered PHP.
 
10:25 PM
@CatPlusPlus Strange -- I remember exactly the same thing. Happened when I finally switched from CP/M to this strange new MS-DOS thing.
 
I shiver when I think about that hilariously wrong book I had then.
 
Hehe, I remember when I didn't know about malloc and tried to create a 100000 element global array. Turbo C didn't like that very much
 
I would never thought I could be better than someone who wrote a book.
 
@RMartinhoFernandes You were pretty bright then. I was very chaotic. Learning about good coding practices was a necessity for me in order to write even a small application.
 
Oh, you can.
 
10:26 PM
Well, now I know.
 
This was my first book:
 
It's late, so I might be using wrong tenses here and there.
 
It was actually helpful because it showed me how to create a console application in Visual Studio. I couldn't even figure that out myself.
 
My first impression of Visual C++ 6 (being the first IDE after TP7) was "lol wtf".
 
@StackedCrooked I had a plan. I quickly learned whenever I copy-pasted some code and found out some bug later, I had to fix it in two places. So I added special comments like (* ACTION: move up *) so I could easily locate the places where I had to fix the same bug.
 
10:29 PM
I learned procedures pretty quickly IIRC.
 
I was begging for functions from the start, I just didn't know they existed until about a month later.
 
I learned much from The Pragmatic Programmer.
 
But I could never figure out the magic of not having to put names of the enum values in quotes.
I think that was enums.
 
@RMartinhoFernandes I remember writing without functions and using numerous variables that indicate the context.
 
Or something similar.
Haven't wrote a line of Pascal in years.
 
10:30 PM
I'm surprised I still remember the comment syntax.
 
{foo}
(*foo*)
 
Oh yeah, curlies too!
 
Incidentally, that's OCaml's syntax, too.
The second one.
 
I think I used (* more.
 
10:31 PM
Curlies required AltGr to type.
@StackedCrooked BASIC!
 
(**************************
 * ...
 * ...
 * ...
 **************************)
With stars on the end of lines, too.
 
My very first programming experiences were when I was experimenting with BASIC on the Commodore 64.
 
It looked so cool.
But I think compiler directives had to be put in curlies.
 
I didn't know there were such things as compiler directives.
 
{$something}
 
10:33 PM
I didn't understand how to make a game character move without having it wipe away the background where it moved.
 
It had conditional compilation, too.
 
One of the things I never figured out is how you create overlays.
 
10:37 PM
@CatPlusPlus No loss there. One thing I really don't miss about MS-DOS is overlays.
 
They were magical.
 
What are MS-DOS overlays? Do I want to know?
 
10:52 PM
u don't wanna know
 
Ok, I was kind of expecting that answer.
 
Magic to write programs that don't fit in the memory.
 
what i'm concerned about in that respect is mostly how one convinces a windows console window to use the colors for a popup. it does for F7. but that's all.
 
@RMartinhoFernandes Actually, there are two entirely separate things called overlays. One was video trickery, where you could tell the video card to display stuff from two disjoint parts of video memory at once. The other was a mediocre imitation of virtual memory that swapped pieces of code in/out of a fixed-size area so you could use a program too large to fit in physical memory.
 
evening fellas
 
10:54 PM
Hi.
 
what have I missed?
 
@AlfPSteinbach Programmatically? SetConsoleTextAttribute.
@TonyTheLion A bit of nostalgia.
 
@CatPlusPlus is that supposed to be a joke?
 
@JerryCoffin i think it's worth noting that we have that manual swap-out still in Windows, via DllCanUnloadNow (or whatever the name is, COM function). risky stuff.
 
Er, no.
We were talking about them old days.
 
10:56 PM
oh I see
the oldest I remember is win95
 
We, the 20-ish year old kids.
 
heheh yea indeed
 
I've used Win3.11 as a first one.
 
10:57 PM
oh wow
so I came late then I guess
 
CRT monitor full of orange.
 
I got into computers when I was 13 years
 
Coming late is not always bad.
I probably shouldn't have made that joke.
 
and I started learning programming using MFC and VC 6.0
 
@AlfPSteinbach There are bits and pieces still present -- but you only rarely have to worry about them now. I can recall spending weeks working at optimizing which functions went into which overlay. Maybe it wasn't quite as bad as I remember, but it was pretty ugly anyway.
 
10:57 PM
I was playing DOOM when I was 4.
-ish.
 
MFC and VC6 was a bad idea to start
with
@CatPlusPlus you are a true geek :P
 
DOOMed from the very beginning.
 
I never really played much games, but that might change soon, since I got an Xbox
lulz
 
I started messing with computers when I was 9 or 10.
 
@TonyTheLion You need to get Battlefield 3, comes out later this month
 
10:59 PM
Programming around 12.
 
I was starting Pascal then.
 
@Praetorian oh thanks for the tip :) I shall
@RMartinhoFernandes what was your first programming language
 
My dad was maintaining a fairly large software in Clipper, and I wanted to be cool, too.
 
So, I've already wasted enjoyed half of my life programming.
 
@RMartinhoFernandes When I was 9 or 10, "computer" was a job position, not a machine (Okay, I'm exaggerating -- a little).
 
11:00 PM
I'm in a room with 25 people here and I'm sitting here chatting, talk about not being social :P
 
@JerryCoffin A mentat!
 
They're not as awesome as we are.
 
@TonyTheLion I started on a Casio calculator, but quickly moved to Pascal.
 
hahaha
@RMartinhoFernandes oh wow, how old are you? (if you want to say)
 
11:01 PM
damn
 
I'm ~19,5!
 
@TonyTheLion Damn?
 
I finally came across I could not download through reverseString("tnerrot") :(. And the book looks damn good.
 
hahah, really?
@RMartinhoFernandes I'm older then you and I'm essentially feeling dumber
jeez
 
Oh, please don't do that.
 
11:01 PM
> On October 4, Epic’s founder and technical director, Tim Sweeney, revealed Unreal Engine 3 running in Flash onstage at Adobe MAX 2011.
Madness.
 
@RMartinhoFernandes Frank Herbert aside, it really was a job position at one time, and when I first heard about computers, that was still common enough that people still specifically disambiguated the two).
 
@RMartinhoFernandes lol
 
I've recently seen an interview with a woman who had that job.
 
@TonyTheLion I mean it. It makes me sad when people compare themselves to me and that makes them sad.
 
11:03 PM
@RMartinhoFernandes Strange parallels. I started on an HP calculator, but quickly moved to FORTRAN.
 
I don't remember if it were linked from here, reddit, or HN.
 
I saw a cool interview yesterday with the guy in charge of solving compatibility problems with software running on any windows version
 
Now paw up, who did dBASE III?
And Clipper.
 
@JerryCoffin I would say "Great minds think alike", but I usually say "Great minds are unique" instead, so...
 
@RMartinhoFernandes I'm sorry :(
supposedly people still run software written for windows 3.1
that scares me
 
11:04 PM
@CatPlusPlus Nope. Did dBASE II, then moved on to better things.
 
Win3.1 support ended, like, 2 years ago or so.
 
Two years ago?
 
I don't think that MS can keep this backwards compat thing up forever, or am I wrong?
 
You mean, in this millennium?
 
Yeah.
 
11:05 PM
@CatPlusPlus per this guy, it hasn't ended ever
 
I mean MS support.
 
@TonyTheLion I still have source code (that compiles cleanly for x64), that I originally wrote for Win 3.0...
 
People still run it.
 
@JerryCoffin wow, what language was it written in?
 
@TonyTheLion C++ (with MFC).
 
11:06 PM
.
 
> On July 9, 2008, it was announced that Windows for Workgroups 3.11 for the embedded devices channel would no longer be made available for OEM distribution as of November 1, 2008
 
pizza time
 
A design issue regarding a vector class, if you want add it to a ostream, do you usually have both a reference and a pointer?

std::ostream & operator << (std::ostream &s, const Vec2 &v);
std::ostream & operator << (std::ostream &s, const Vec2 *v);
 
So, 3 years ago. But I remembered mostly right.
 
@JerryCoffin wow, but what about pointer sizes and stuff? (unless it runs on WOW)
 
11:06 PM
@ManofOneWay No pointer.
@TonyTheLion Unless you are silly and write code that depends on pointer sizes, that should not be an issue.
 
When I output pointers, I usually want the address, and standard operators do that already.
 
world::Vec2 *vec2 = new world::Vec2(5.2,4.2);
std::cout << "Vec2: " << vec2 << std::endl;
 
So, overload for references only.
 
so this should display 0x121...
 
@ManofOneWay Why new?
 
11:08 PM
instead of 5.2, 4.2 ?
 
world::Vec2 vec2(5.2,4.2);
std::cout << "Vec2: " << vec2 << std::endl;
FTFY.
 
@TonyTheLion Pointers aren't a problem -- the compiler deals with that pretty cleanly as long as you really keep pointers straight from ints (and such). The part that's usually ugly is message cracking, but MFC handles that so I literally have some code that will compile cleanly for 16, 32, or 64 bit target without a single change.
 
@JerryCoffin Wow, someone complimented a MFC feature.
 
@RMartinhoFernandes True. Still if I have another class that I do want to allocate dynamically
 
@JerryCoffin oh cool
 
11:09 PM
@ManofOneWay std::cout << "Vec2: " << *vec2 << std::endl;
 
Should it not support pointer?
yes but that looks a bit ugly maybe
 
I don't see how overloading a stream for pointers would be useful in any way.
 
@ManofOneWay Using naked pointers is ugly by itself.
 
Yes you are right
 
@ManofOneWay use smart pointers
 
11:10 PM
Use values, first.
 
well yes
 
@RMartinhoFernandes It's become fashionable to bash it, but MFC isn't really nearly as bad as a lot of people try to claim. In fact, it's pretty clear a lot of the bashers have never used it and really don't know what they're talking about.
 
but in the cases where you need a pointer, use smart pointers...
 
@JerryCoffin Oh, I wouldn't know, I never even saw a line of code written with it. But I see a lot of bashing.
 
@JerryCoffin wow
Bash ALL THE THINGS
Java, MFC, singletons, etc...
 
11:12 PM
It uses silly naming conventions. It deserves to be bashed.
 
who's dmr referenced int the tag line?
 
Dennis Ritchie.
 
The creator of C.
 
hungarian notation, ugh :(
@RMartinhoFernandes oh wow, I thought he was a musician, obviously wrong I was
 
What.
 
11:12 PM
cause I saw the name on Reddit earlier
 
Why would we care about some musician.
Pff.
 
The musician is Lionel Ritchie.
 
You know what, Haskell report is more readable than C++ standard.
 
11:14 PM
Yes, it is.
It's also much, much smaller.
Being a simpler language also helps.
 
How do you read the next character from a stringstream?
 
@Praetorian are you reading a char type or std::string?
 
doh, figured it out
char c;
ss >> c;
that's all i need
little brainfart :)
 
Or ss.get().
 
even better, thanks
 
11:27 PM
lol
 
@CatPlusPlus what happens if i call ss.get() when the stream's empty?
is an exception thrown?
 
Sets an eofbit, probably.
And returns EOF.
IIRC. You can check the standard.
Streams normally don't raise exceptions, unless enabled explicitly.
 
@CatPlusPlus what's the reason for that?
 
Hell knows.
 
11:30 PM
Bad input isn't always an exceptional situation.
 
thanks, I just wanted to make sure I don't need to add a catch
 
Think user input.
 
IOstream pre-dates sanity. That's why it's full of char*.
 
oh valid point
 
I don't know why that's the default, but it's nice to have both options.
 
11:32 PM
surely
 
What would a decent I/O interface for C++ look like?
 
IO ()? :P
 
does it have to be any type of I/O or like for something specific like sockets?
template<typename T> class Input {} donno
 
11:47 PM
Ideally, it would be agnostic of source.
I shall ask @DeadMG what he plans for DeadMG++.
 
Well, file-like objects are quite nice. You can then implement streams using them.
 
File-like objects?
 
It's a Python concept, something like concept FileLike { string read(int); void write(string); ... }
In a true duck-typing fashion, if an object implements some methods that file object would, it's a file-like object.
 
Oh, so something like the POSIX file API?
That read/write stuff?
 
Yeah, but with more vowels.
 
11:54 PM
(Except less C-y)
 
@CatPlusPlus How much better is that than InputIterator and/or OutputIterator?
 
Dunno.
 
One thing I dislike about operator>> is that you need a pre-existing object before you read.
It's basically two-phase initialization.
 

« first day (362 days earlier)      last day (4593 days later) »