|
hieronymus posted:Another good example is the code for the std::vector class itself, which gets my vote for the most difficult to read widely-used class ever. I find pretty much everything in the C++ STL to be hard as hell to read.
|
# ? Sep 21, 2012 14:53 |
|
|
# ? Jun 1, 2024 08:14 |
|
Golbez posted:Can you elaborate on this please? Yeah it's simple, his thing is named <span id='"> (I want a sparklee CSS attribute so bad) Amarkov fucked around with this message at 15:17 on Sep 21, 2012 |
# ? Sep 21, 2012 15:14 |
|
Golbez posted:Can you elaborate on this please? JavaScript code:
Now, that name has been in our development DB for a while. We just updated our data fetching to using JSON and the guy who wrote the server component probably just hand-rolled his JSON encoder, because the quotation marks in the name are not escaped, so the json fragment looks like JavaScript code:
code:
|
# ? Sep 21, 2012 15:16 |
|
Amarkov posted:It's just a standard injection vulnerability check? If you do not sanitize inputs, your webpage is CSS code:
|
# ? Sep 21, 2012 15:25 |
|
Optimus Prime Ribs posted:I find pretty much everything in the C++ STL to be hard as hell to read.
|
# ? Sep 21, 2012 16:07 |
|
Plorkyeran posted:It doesn't help that dinkumware's implementation (used by visual c++) is written in a really weird style that I've never seen anywhere else. Yeah I don't really get it: C++ code:
|
# ? Sep 21, 2012 16:54 |
|
It looks like some Whitesmiths variant.
|
# ? Sep 21, 2012 17:19 |
|
plashy posted:long post Is this an Asian-based company with offices in the Bay Area? (That may be all of them though)
|
# ? Sep 21, 2012 18:47 |
|
Strong Sauce posted:Is this an Asian-based company with offices in the Bay Area? (That may be all of them though)
|
# ? Sep 21, 2012 21:20 |
|
plashy posted:I was taking an interview for a potential new company, mobile games stuff, nothing too complicated. I've been a lead/senior engineer on games for some time now and already have a year of experience at a company in S. Korea where I'm living. If you didn't realize already, they probably stole your code and are using it in their next mobile game. The whole point of the point deduction thing was to turn you off of the company, so you wouldn't try to press more for a job if you needed one badly.
|
# ? Sep 22, 2012 04:35 |
|
Thern posted:This is the part where I would have walked out. If they can't respect you before they hire you, you can bet they won't respect you while working there. Being a white guy I don't have much to get upset about culturally, I decided to give them something trickier after that though, the position did require a decent amount of authority. Suspicious Dish posted:If you didn't realize already, they probably stole your code and are using it in their next mobile game. I'll go with Hanlon's razor on this one I think.
|
# ? Sep 22, 2012 05:23 |
|
plashy posted:I'll go with Hanlon's razor on this one I think. I usually would too, but why else would they ask him to code an entire minesweeper game for a work sample? That raises a red flag. Minesweeper is a simple game to code, but not as simple as of tic tac toe or pong. The issue about berating him specifically for bad code rather than just ignoring someone not worth your time also is a red flag.
|
# ? Sep 22, 2012 05:55 |
|
Suspicious Dish posted:I usually would too, but why else would they ask him to code an entire minesweeper game for a work sample? That raises a red flag. Minesweeper is a simple game to code, but not as simple as of tic tac toe or pong. If that's true, he could always keep watch on the company and see if they release some kind of minesweeper-like game and then take some kind of legal action.
|
# ? Sep 22, 2012 06:05 |
|
That Turkey Story posted:If that's true, he could always keep watch on the company and see if they release some kind of minesweeper-like game and then take some kind of legal action.
|
# ? Sep 22, 2012 06:48 |
|
Suspicious Dish posted:I usually would too, but why else would they ask him to code an entire minesweeper game for a work sample? That raises a red flag. Minesweeper is a simple game to code, but not as simple as of tic tac toe or pong. While it would be trivial to make it complete, it's not much to look at honestly, there's no effort made to alert you if you won for example. Also I didn't make graphics for numbers greater than four but they didn't notice that. Could brush it up and dump it on the app-store myself I guess. http://goo.gl/0FWZq
|
# ? Sep 22, 2012 06:57 |
|
Plorkyeran posted:It doesn't help that dinkumware's implementation (used by visual c++) is written in a really weird style that I've never seen anywhere else.
|
# ? Sep 22, 2012 22:00 |
|
This guy is just all kinds of craziness. He implements a customized version of LISP that, upon his departure from Naughty Dog, is essentially unmaintainable.
FamDav fucked around with this message at 08:18 on Sep 24, 2012 |
# ? Sep 24, 2012 08:16 |
|
FamDav posted:guy is just all kinds of craziness. He implements a customized version of LISP that, upon his departure from Naughty Dog, is essentially unmaintainable. While it's interesting from an outsider's perspective, his pattern of doing everything from scratch -- particularly to the point of writing a custom language for things that one wouldn't expect it to be necessary -- strikes me as "I'm difficult to work with and can't reasonably function in a team environment". In my limited experience, I've found that to be a fairly common issue among sperglords.
|
# ? Sep 24, 2012 08:28 |
|
The people that founded Naughty Dog were very big into LISP (they came from the MIT labs). The issue was that current LISP implementations at the time didn't meet their requirements, the biggest one was performance on a specialized embedded system. Even EA wrote their own STL replacements because the ones included were causing real performance issues on the hardware they were supposed to run on. Designing a new LISP implementation that fit the very specific requirements in a time when there weren't a lot around doesn't seem like that much of a horror. Suspicious Dish fucked around with this message at 08:38 on Sep 24, 2012 |
# ? Sep 24, 2012 08:35 |
|
Yeah I suppose it depends on the context. I myself once hit an issue with the fstream implementation in libstdc++ where it decided to completely ignore any buffering that one had set whenever it received a write >= 1024 bytes. Ended up sidestepping the issue by just using the somewhat lower-level fopen/setvbuf instead, which worked as intended. This wasn't even trying to get things to work on a system with restrictive hardware like what a console game company would've had to deal with -- the production hardware was quite fancy, but it regardless choked on the dozens of inefficient small writes it was being handed as a result of the following "optimization" from xsputn() in fstream.tcc: libstdc++ : fstream.tcc posted:// Optimization in the always_noconv() case, to be generalized in the ("sufficiently large", as defined by __chunk a few lines down, is 1024B) After experiencing that particular little gem and others like it, I'm definitely no longer of the opinion that general libraries are necessarily the best solution to specialized problems. Sometimes they really are just doing things inefficiently to support auxiliary functionality that you don't want or need. But that said, I think it's still best to go with them by default until they're actually causing noticeable problems. But if LISP was too slow, perhaps they should've considered other languages? Smells of eg Facebook deciding to solve their PHP scalability problems by writing a new PHP interpreter from scratch rather than by just switching to a more suitable language.
|
# ? Sep 24, 2012 09:10 |
|
With game dev, rapid iteration is important. So switching to a "fast" language with slow turnaround isn't necessarily a win. You don't really need "fast" for coding game logic, all you need is "fast enough".
|
# ? Sep 24, 2012 09:37 |
|
FamDav posted:This guy is just all kinds of craziness. He implements a customized version of LISP that, upon his departure from Naughty Dog, is essentially unmaintainable. This is what happened to yahoo! stores, they replaced paul graham's unmaintainable lisp for perl.
|
# ? Sep 24, 2012 09:39 |
|
Ah HFTs: http://www.economicpopulist.org/content/chicago-fed-study-blasts-lid-high-frequency-trading
|
# ? Sep 24, 2012 09:58 |
Don't know C++, but I hope to god this isn't an idiom (from the Dungeon Crawl source).code:
|
|
# ? Sep 24, 2012 16:44 |
|
That's a pretty standard way of doing an if else-if chain, though perhaps a lookup table would be a neater solution there.
|
# ? Sep 24, 2012 16:52 |
|
That code is perfectly readable, and a lookup table wouldn't be any simpler or meaningfully faster unless the table could easily be cached.
|
# ? Sep 24, 2012 17:24 |
|
oiseaux morts 1994 posted:Don't know C++, but I hope to god this isn't an idiom (from the Dungeon Crawl source). I think code written like that is far less readable and would much rather expand it to a switch. But some people love conditional operators. I've become okay with it in simple scenarios, like var result = a > b ? x : y;, but anything more complex than that and it drives me batty.
|
# ? Sep 24, 2012 17:24 |
|
Yeah, its a style thing. An advantage that version (or the bookname = table[prayertype] version) has is that you can declare bookname as const.
|
# ? Sep 24, 2012 17:39 |
|
Ithaqua posted:I think code written like that is far less readable and would much rather expand it to a switch. But some people love conditional operators. I've become okay with it in simple scenarios, like var result = a > b ? x : y;, but anything more complex than that and it drives me batty.
|
# ? Sep 24, 2012 17:42 |
|
MarsMattel posted:Yeah, its a style thing. An advantage that version (or the bookname = table[prayertype] version) has is that you can declare bookname as const. This. You usually use the ternary operator like that when you need to get the result in a single expression, such as for initialization of a const object. An alternative is to put the logic into a separate function that returns the result, and then call that function, but that implies... creating another function. You could use lambdas for that now to get it all in one place, but using the ternary operator works fine too. E: I did this once on a project and was asked why I did it and after explaining it, I was told to never do it again and just don't use const in those situations. I can't say I agree with that at all, but it happens! It seems as though only half the team wrote const-correct code anyway, so working with const objects tended to have you run into compilation issues because people didn't label member function as const. That Turkey Story fucked around with this message at 18:00 on Sep 24, 2012 |
# ? Sep 24, 2012 17:52 |
|
Zombywuf posted:Ah HFTs: http://www.economicpopulist.org/content/chicago-fed-study-blasts-lid-high-frequency-trading As interesting as this article is, why does he keep spouting AMERICA? Being from the US doesn't somehow make you immune to being a terrible programmer. Or an idiot. Or an idiot terrible programmer.
|
# ? Sep 24, 2012 18:32 |
|
UraniumAnchor posted:As interesting as this article is, why does he keep spouting AMERICA? Being from the US doesn't somehow make you immune to being a terrible programmer. Or an idiot. Or an idiot terrible programmer. I dunno, force of habit? They're like that over there.
|
# ? Sep 24, 2012 18:34 |
|
UraniumAnchor posted:As interesting as this article is, why does he keep spouting AMERICA? Being from the US doesn't somehow make you immune to being a terrible programmer. Or an idiot. Or an idiot terrible programmer. 'populist' is right there in the site name but it's still really silly and off-putting, even to an American. how-to-undermine-an-article.txt
|
# ? Sep 24, 2012 19:11 |
|
Ithaqua posted:I think code written like that is far less readable and would much rather expand it to a switch. But some people love conditional operators. I've become okay with it in simple scenarios, like var result = a > b ? x : y;, but anything more complex than that and it drives me batty. I'm always baffled when people claim that idiom is anything less than perfectly readable. What's confusing about it?
|
# ? Sep 24, 2012 19:30 |
|
oiseaux morts 1994 posted:Don't know C++, but I hope to god this isn't an idiom (from the Dungeon Crawl source). This is only a horror if you try it in PHP.
|
# ? Sep 24, 2012 19:32 |
|
GrumpyDoctor posted:I'm always baffled when people claim that idiom is anything less than perfectly readable. What's confusing about it? Same. It's pretty much immediately clear what's going on. I think the problem is probably just that a lot of people don't use ?: so it is therefore intrinsically weird to them.
|
# ? Sep 24, 2012 19:33 |
|
GrumpyDoctor posted:I'm always baffled when people claim that idiom is anything less than perfectly readable. What's confusing about it? There's nothing confusing about it, it's just less readable, and the second you start stacking them it turns into a mess. I submit for your consideration: http://stackoverflow.com/questions/9101719/im-looking-for-a-free-tool-stand-alone-or-add-in-that-can-decompose-ternary-ex/
|
# ? Sep 24, 2012 19:41 |
|
Ithaqua posted:There's nothing confusing about it, it's just less readable, and the second you start stacking them it turns into a mess. I submit for your consideration: http://stackoverflow.com/questions/9101719/im-looking-for-a-free-tool-stand-alone-or-add-in-that-can-decompose-ternary-ex/ That is a very different usage than what we are talking about.
|
# ? Sep 24, 2012 20:01 |
|
It's because some people are afraid of functional programming.
|
# ? Sep 24, 2012 20:06 |
|
|
# ? Jun 1, 2024 08:14 |
|
qntm posted:This is only a horror if you try it in PHP. That was my first thought. I've gotten used to just wrapping all of those expressions in their own set of parenthesis just to make sure the chances of something unintended cropping up is minimized, e.g. $xxx = ($yyy == true ? "yep" : "nope") .", php."; It's really not a bad operator as long as you keep it simple. When doing really long, complex poo poo, that's the job of a real if/then or switch.
|
# ? Sep 24, 2012 20:17 |