Huge thanks to all the lovely people who picked up the mundane monday idea and ran with it. Here (rather late, sorry) is mine...
I work for a company that provides a "cross-platform gaming solution". The easiest way to think of this is to liken a computer game to an mp3; if someone sends you an mp3, you don't worry about whether they were using a PC, or an iPhone, you just assume that your music player will handle it. We provide an analagous game "player" which means the file which contains the game will work on your PC, in your browser, on your Android phone, on your internet-capable TV, etc.
Monday wasn't actually all that mundane for me - I've just started work on a completely new project. I was also required to be in a meeting with our CEO as his technical demonstrator (which is something I only do around once or twice a month).
So, after the usual morning round of tea, email and checking everyone's had a nice weekend I round up the phones and tablets I'll be using for my demo, boot up the set-top box, switch on the TV, and quickly run through everything. I'm making sure that no one's installed experimental bleeding-edge versions of any software while I wasn't looking (they haven't), and that everything's behaving as expected (it is). Also that everything is fully charged (it isn't) and attached to the correct wireless network (it isn't).
I'm also working out what aspects of our software I should be emphasising - I might show a slightly different set of demos to a TV manufacturer, or a mobile phone operator, or chipset company. Today's guest is from an annoyingly hard-to-pin-down company and it's not clear what he'll want to see.
Having plugged everything in to charge up, I go back to my real job. Day-to-day I do a bunch of disparate stuff (writing games, writing demo code, writing and organising the documentation and development materials we send to games publishers) but my new project is porting a third party game to our system.
Game porting means taking an existing, working game written for a different system and converting it to work on ours. The game that has been dropped on me is huge by my standards, vastly complicated and uses features of C++ that I never use. I spend quite a lot of the day staring blankly at it in horror and confusion.
I have a C++ book on my desk, and have to keep stopping to read up on features of the language which I don't know about. A couple of times I have to be rescued by
hjalfi - who hates C++, but is extraordinarily well-informed about it (so he can hate it properly, I think). He explains just what's being used by a particular bit of code so I can work out what to look up and read about.
I also spend a lot of time chatting on Skype (IM, not phone-a-like) to a colleague who's done a lot of this sort of work before. He's very good at it, but I don't seem to be doing a very good job communicating with him.
Around one o'clock, our visitor arrives and I am summoned into the meeting room. The demos should, in theory, be very simple. Show some games running on a TV, send the games to phones and tablets over wi-fi, show the same games running on them. Show some multiplayer games between different devices. It's all very easy - the only reason a demonstrator is required is because if you give any piece of electronics to our CEO, then within 30 seconds it will have crashed, rebooted into some hitherto-unseen factory-only development mode, and changed all its settings to Taiwanese.
In theory, I'm also there to answer any technical questions the visitors ask; in reality, they rarely ask. Mostly, I sit and listen while our CEO gives the visitor a quick, filleted overview of the technology. I show him the software in action and - as is normal - at least one of the demos fails spectacularly despite having worked perfectly well earlier in the day. Most annoyingly, it is the one I wrote.
About an hour later they move onto business stuff and I'm released: I've missed my usual lunch stop with Hjalfi and Sysadmin #1, so eat lunch at my desk instead. Then it's back to swearing and glaring at C++, and trying to work out exactly where I'm supposed to start. I'm not really doing anything yet, just chasing through the paths the code might take and trying to grasp some idea of how it currently works, and how it might need to be restructured.
Throughout the day, I keep half an eye on email. I don't get a lot of mail from humans as a rule, but various machines mail me to keep me up to date on changes other people are making. Towards the end of the day, I notice some emails coming in from our bug-tracking system suggesting that there's some work needs doing on our Eclipse plug-in. Eclipse is a piece of software that people writing games might use, the plug-in allows them to develop games specifically for our platform. A number of years back I did some work on our plug-in to add branded splash-screens, icons, customised help etc to it (which Eclipse makes harder than you'd expect). Anyway, some silly bugger has done a complete re-brand and everything need updating.
One of my colleagues has duly updated all the images, but (having re-built the plug-in) it's still using the old ones. What else does he need to do? The answer is currently "buggered if I know". I dig the code out of our version control system, and have a look at the relevant project. It's a good three years or more since I interacted with this stuff and when I look at it, nothing seems in the least familiar. It also seems to be throwing weird errors all over the place. I decide to put it off until my overseas colleague is awake tomorrow morning and see if he can remember; if not, I shall have to try and piece together what needs doing.
Just before hometime, my boss comes to check how the game porting is going. Not that well, yet. He says that if I'm not making progress, we should get back to the original company and tell them the code isn't suitable. I warn him that I think it's probably me that isn't suitable, and he says he'll ask again in a few days.
So... all in all, not a terribly successful day!
I work for a company that provides a "cross-platform gaming solution". The easiest way to think of this is to liken a computer game to an mp3; if someone sends you an mp3, you don't worry about whether they were using a PC, or an iPhone, you just assume that your music player will handle it. We provide an analagous game "player" which means the file which contains the game will work on your PC, in your browser, on your Android phone, on your internet-capable TV, etc.
Monday wasn't actually all that mundane for me - I've just started work on a completely new project. I was also required to be in a meeting with our CEO as his technical demonstrator (which is something I only do around once or twice a month).
So, after the usual morning round of tea, email and checking everyone's had a nice weekend I round up the phones and tablets I'll be using for my demo, boot up the set-top box, switch on the TV, and quickly run through everything. I'm making sure that no one's installed experimental bleeding-edge versions of any software while I wasn't looking (they haven't), and that everything's behaving as expected (it is). Also that everything is fully charged (it isn't) and attached to the correct wireless network (it isn't).
I'm also working out what aspects of our software I should be emphasising - I might show a slightly different set of demos to a TV manufacturer, or a mobile phone operator, or chipset company. Today's guest is from an annoyingly hard-to-pin-down company and it's not clear what he'll want to see.
Having plugged everything in to charge up, I go back to my real job. Day-to-day I do a bunch of disparate stuff (writing games, writing demo code, writing and organising the documentation and development materials we send to games publishers) but my new project is porting a third party game to our system.
Game porting means taking an existing, working game written for a different system and converting it to work on ours. The game that has been dropped on me is huge by my standards, vastly complicated and uses features of C++ that I never use. I spend quite a lot of the day staring blankly at it in horror and confusion.
I have a C++ book on my desk, and have to keep stopping to read up on features of the language which I don't know about. A couple of times I have to be rescued by
I also spend a lot of time chatting on Skype (IM, not phone-a-like) to a colleague who's done a lot of this sort of work before. He's very good at it, but I don't seem to be doing a very good job communicating with him.
Around one o'clock, our visitor arrives and I am summoned into the meeting room. The demos should, in theory, be very simple. Show some games running on a TV, send the games to phones and tablets over wi-fi, show the same games running on them. Show some multiplayer games between different devices. It's all very easy - the only reason a demonstrator is required is because if you give any piece of electronics to our CEO, then within 30 seconds it will have crashed, rebooted into some hitherto-unseen factory-only development mode, and changed all its settings to Taiwanese.
In theory, I'm also there to answer any technical questions the visitors ask; in reality, they rarely ask. Mostly, I sit and listen while our CEO gives the visitor a quick, filleted overview of the technology. I show him the software in action and - as is normal - at least one of the demos fails spectacularly despite having worked perfectly well earlier in the day. Most annoyingly, it is the one I wrote.
About an hour later they move onto business stuff and I'm released: I've missed my usual lunch stop with Hjalfi and Sysadmin #1, so eat lunch at my desk instead. Then it's back to swearing and glaring at C++, and trying to work out exactly where I'm supposed to start. I'm not really doing anything yet, just chasing through the paths the code might take and trying to grasp some idea of how it currently works, and how it might need to be restructured.
Throughout the day, I keep half an eye on email. I don't get a lot of mail from humans as a rule, but various machines mail me to keep me up to date on changes other people are making. Towards the end of the day, I notice some emails coming in from our bug-tracking system suggesting that there's some work needs doing on our Eclipse plug-in. Eclipse is a piece of software that people writing games might use, the plug-in allows them to develop games specifically for our platform. A number of years back I did some work on our plug-in to add branded splash-screens, icons, customised help etc to it (which Eclipse makes harder than you'd expect). Anyway, some silly bugger has done a complete re-brand and everything need updating.
One of my colleagues has duly updated all the images, but (having re-built the plug-in) it's still using the old ones. What else does he need to do? The answer is currently "buggered if I know". I dig the code out of our version control system, and have a look at the relevant project. It's a good three years or more since I interacted with this stuff and when I look at it, nothing seems in the least familiar. It also seems to be throwing weird errors all over the place. I decide to put it off until my overseas colleague is awake tomorrow morning and see if he can remember; if not, I shall have to try and piece together what needs doing.
Just before hometime, my boss comes to check how the game porting is going. Not that well, yet. He says that if I'm not making progress, we should get back to the original company and tell them the code isn't suitable. I warn him that I think it's probably me that isn't suitable, and he says he'll ask again in a few days.
So... all in all, not a terribly successful day!
no subject
Date: 2013-02-05 02:43 pm (UTC)You describe exactly my problem with them. The actual concept is fine, and simple enough to understand, but the practicalities of using them can get hideous.
In fairness, I don't think this code is doing anything especially nasty or bad, it's just all very, very unfamiliar.
no subject
Date: 2013-02-05 02:53 pm (UTC)no subject
Date: 2013-02-06 07:53 am (UTC)...Well, okay, I have seen a couple of valid uses for them, but only when that usage is *obvious*. Otherwise, well, I love C++ as a language, but as I'm sure I heard somewhere, just because it offers all kinds of interesting features, it's not mandatory to use *all* of them at the same time. That way lies madness...
no subject
Date: 2013-02-06 08:55 am (UTC)Similar advice applies to most complex languages.
I do like templates in theory, though. One of the horrible things that C-like conventions have done to programming is to popularise the idea of a single return parameter. This has no reasonable justification and is invariably annoying. Returning fixed width tuples is probably the best workaround available in languages with this limitation.
no subject
Date: 2013-02-06 10:26 am (UTC)no subject
Date: 2013-02-06 10:32 am (UTC)Sure, but in the case of something like, say, rotating a point in 3D space we're used to the idea of the return value being an object instance (or something similar in non-OO languages). However, that's just a reflection of the fact that the class in question is useful for other things. If it wasn't then we wouldn't want to make a class solely for the purpose of returning three values.
I'd use Out Parameters myself
A perfectly fine solution. Of course, all that an "out parameter" does is to hack in multiple return parameter support to a language which should have had it from day one. :-P
no subject
Date: 2013-02-06 10:58 am (UTC)Certainly, and obviously you can just make that object and return an instance of it. What I was trying to get at was the underlying structure of the way that the language is put together, which apparently I can't describe any better without it sounding like nonsense. :-)
Of course, all that an "out parameter" does is to hack in multiple return parameter support to a language which should have had it from day one.
And as I apparently lack the eloquence to convey, it actually seems to me to be a much neater way of doing it than actually having multiple return values... :-)
no subject
Date: 2013-02-06 11:12 am (UTC)It's neither better or worse, it's literally identical. I suppose it would be feasible to make a language which had no return parameters at all and instead used out parameters only. That would arguably be more elegant conceptually, but there are problems since replacing "(a,b,c,d) = myFn(x,y,z)" with "myFn(x,y,z,a,b,c,d)" means that the line in isolation no longer tells you which variables are having their values changed. You could have an explicit call syntax like: "myFn(x,y,z,out a,out b,out c,out d)", but that's then extremely noisy, which isn't very nice.
What I was trying to get at was the underlying structure of the way that the language is put together
On the original BBC micro there were distinct keywords "fn" and "proc". The latter was a function with no return value. In theory useless, right? But in practice it was used far, far more than "fn", with return values often handled via global variables (!!!).
no subject
Date: 2013-02-07 07:57 am (UTC)The latter was a function with no return value. In theory useless, right?
Presumably only as useless as a void function! But, it's true, things returning void do rather break that nice orderly sense of everything having a value. I'm not sure whether to be annoyed by that or not. :)
no subject
Date: 2013-02-07 08:05 am (UTC)Yes, I agree with all of this... but ultimately none of it has bearing on the fact that out parameters remove information from the calling line. If nothing else, they mean I can't do a regexp search for calls which change the value of a variable.
no subject
Date: 2013-02-07 08:40 am (UTC)I must admit that it has never occurred to me to try such a thing. Intuitively it seems to me that you'd have to be using a horribly restrictive language for something like that to work...
no subject
Date: 2013-02-07 10:03 am (UTC)* Search my ~50000 lines of source code manually (!).
* Already know the answer (this is the best option, but not available to me).
* Make everything so modular that no variable is changed in more than one or two places at most (LOL).
* Take hours to debug every problem (this option is surprisingly popular with people who aren't me).
no subject
Date: 2013-02-07 11:01 am (UTC)But my point (this one, anyway) is that surely just doing a text search through unfamiliar code to find assignments to variables can't reliably find everywhere where that actual value is changed.
no subject
Date: 2013-02-07 11:02 am (UTC)no subject
Date: 2013-02-07 11:17 am (UTC)no subject
Date: 2013-02-07 11:24 am (UTC)Certainly C and C++ support this, but as you wisely pointed out earlier in the thread, just because a language contains some horrendous misfeature that doesn't mean it has to be used. (Actually, to be fair, passing something by reference is often completely reasonable in C. I assume there's no valid reason to ever do this in C++.)
Bear in mind that I'm arguing for multiple return parameters as part of an elegant and sensible language design, rather than proposing they should be - for example - bolted onto the shambling monstrosity that is C++!
no subject
Date: 2013-02-07 12:24 pm (UTC)But in the end, apparently I'd rather have a powerful language with useful features than a restrictive one.
no subject
Date: 2013-02-07 12:29 pm (UTC)apparently I'd rather have a powerful language with useful features than a restrictive one
Yes, that does seem to be the defining tradeoff with C++. All the features you could possibly want, with the caveat that if you aren't incredibly clean and disciplined in your coding you will also end up with all the debugging you could possibly want. 8-)
no subject
Date: 2013-02-07 04:21 pm (UTC)Imagine, if you will:
class Cat { public: Cat(char *name); } class Dog { public: Dog(); void Chase(Cat); }Then when you call:
Dog *fido = new Dog(); fido->Chase("mittens");... it goes and sneakily constructs you a Cat object.
Which isn't even a foolish thing to do, but when you're looking at unfamiliar code and don't know it does this it can quite throw you!
no subject
Date: 2013-02-07 04:32 pm (UTC)You say that, but from my perspective it's an incredibly foolish thing to do. It should require this:
fido->Chase(new Cat("mittens"));And proposing the syntactic shortcut you describe there is the sort of thing I'd expect from a schoolkid who's never written a program longer than 1000 lines. :-P
(Aside: I haven't written C++ in years, but I also suspect the code in question is bad because it - albeit implicitly - uses 'new' at all. I'm pretty sure 'new' and 'delete' are considered poor style for most purposes due to the fact that managing your own heap allocations promotes memory leaks, or something. Or I might be talking @rse!)
no subject
Date: 2013-02-07 04:35 pm (UTC)Well... following my new-found knowledge I can inform you that if I'd written
class Cat { public: explicit Cat(char *name); }... it would :)
I haven't really formed opinions or not on whether it's a sensible thing to do or not. In general, I'd rather compilers gave me helpful error messages than sneakily tried to fix my mistakes.
no subject
Date: 2013-02-07 04:37 pm (UTC)no subject
Date: 2013-02-07 04:38 pm (UTC)