|
Beef posted:I'm still afraid to ask why there's an extra space in front of semicolons. It's for Jesus
|
# ? Jun 5, 2023 16:08 |
|
|
# ? Jun 8, 2024 01:15 |
|
Toshimo posted:This post could have been an email. The email could've been a Teams call that keeps ringing on my phone even though I already picked it up on my laptop.
|
# ? Jun 5, 2023 17:05 |
|
Just deserts for allowing Teams near your phone, imo
|
# ? Jun 5, 2023 17:29 |
|
CPColin posted:It's for Jesus Make space for Jesus in your code.
|
# ? Jun 5, 2023 17:32 |
|
Beef posted:I went into a video call expecting a tabs vs spaces discussion when I raised the issue of the baffling seemingly random C code style on a project I'm working on. Sometimes there would be a space between the function name and arglist, sometimes where wouldn't. There are occasional superfluous space after an open brace, which my emacs setups paints in angry red, that I would have to sweep up using whitespace-cleanup before commits. We do the space in definitions, not at call sites where I am now (and I actually like it, though wouldn’t really fight for it), but your mention of test coverage even being a thing tells me we’re not at the same place. e: At the risk of being called a horror myself, I’ve been programming professionally since 2007 and have written precisely 0 unit tests on the job. Game development, so not especially unusual. chglcu fucked around with this message at 17:56 on Jun 5, 2023 |
# ? Jun 5, 2023 17:35 |
|
chglcu posted:e: At the risk of being called a horror myself, I’ve been programming professionally since 2007 and have written precisely 0 unit tests on the job. Game development, so not especially unusual. Now I'm wondering if there are games out there that simulate a player going through the game.
|
# ? Jun 5, 2023 18:31 |
|
Beef posted:Now I'm wondering if there are games out there that simulate a player going through the game. the players are the unit tests
|
# ? Jun 5, 2023 19:10 |
|
Beef posted:Now I'm wondering if there are games out there that simulate a player going through the game. Just generally, or in the context of testing?
|
# ? Jun 5, 2023 19:24 |
|
Beef posted:Now I'm wondering if there are games out there that simulate a player going through the game. The Talos Principle has this.
|
# ? Jun 5, 2023 19:25 |
|
Beef posted:Now I'm wondering if there are games out there that simulate a player going through the game. Factorio has some really cool tests https://youtu.be/TCxIghf4Z_0
|
# ? Jun 5, 2023 20:04 |
|
Putting a newline between the return type and function definition was an old school C thing to make function definitions easily greppable (with ^foo). I think I hate it less than spaces between the name and parentheses.
|
# ? Jun 5, 2023 20:06 |
|
Sometimes your return type has 400 characters and giving it (multiple) lines on its own is best way to format it. Splitting int foo() onto two lines can gently caress right off though.
|
# ? Jun 5, 2023 20:21 |
|
Beef posted:Now I'm wondering if there are games out there that simulate a player going through the game. Minecraft has a sort of QA-world-on-demand filled with all sorts of “tests” are lined up in a giant matrix, and each one shoot a light in the sky. If a “test” passes, it’s a green light, otherwise it’s red. https://youtu.be/vXaWOJTCYNg
|
# ? Jun 5, 2023 20:30 |
|
Xarn posted:Sometimes your return type has 400 characters and giving it (multiple) lines on its own is best way to format it. Sometimes you need a typedef, or 3 or 4 levels of typedefs.
|
# ? Jun 5, 2023 23:19 |
|
Beef posted:Now I'm wondering if there are games out there that simulate a player going through the game. I built QA tooling and process for a few years, and this was kind of the holy grail for at least a few cases you cared about. The problem is that the game kinda needs to be built with those kinds of hooks in mind from the beginning to make that process easy. If it's not something you can easily just hook, it becomes hard though. There is actually a pile of things you should do with your New Game to set yourself up for production success - if it's possible, this is one of those things.
|
# ? Jun 5, 2023 23:25 |
|
Beef posted:Now I'm wondering if there are games out there that simulate a player going through the game. on some network games, the network traffic can be recorded and played again infinite times, can be used to test the client
|
# ? Jun 5, 2023 23:40 |
|
Canine Blues Arooo posted:I built QA tooling and process for a few years, and this was kind of the holy grail for at least a few cases you cared about. The problem is that the game kinda needs to be built with those kinds of hooks in mind from the beginning to make that process easy. If it's not something you can easily just hook, it becomes hard though. There is actually a pile of things you should do with your New Game to set yourself up for production success - if it's possible, this is one of those things. And end up scrapping it because the game design and tech changed drastically during production?
|
# ? Jun 6, 2023 08:42 |
|
Beef posted:Make space for Jesus in your code. Any C I write is in desperate need of saviorship from above so I can understand this line of thinking.
|
# ? Jun 6, 2023 09:24 |
|
zergstain posted:Sometimes you need a typedef, or 3 or 4 levels of typedefs. I don't think you can typedef enable-ifs
|
# ? Jun 6, 2023 17:04 |
|
I knew this was template bullshit. Guessing there's a level or two of nested template arguments. Can't typedef any of those either? Maybe a proposal should be submitted to the standards committee if one doesn't exist already.
|
# ? Jun 7, 2023 01:06 |
|
Get rid of the enable_if return type and slap a big ol' static_assert inside the function.
|
# ? Jun 7, 2023 01:47 |
|
You can extract out a template using that checks a complex condition for a type. I’m not sure what we’re arguing about anymore, though. Also, never base your code style around the crankiest member of the team. You’re just feeding their crankery, and eventually they’ll be spending a summer rewriting all your code to use their own arcane system of typedefs.
|
# ? Jun 7, 2023 01:52 |
|
Xarn posted:I don't think you can typedef enable-ifs #define doesn’t care about your templates
|
# ? Jun 7, 2023 11:05 |
|
This isn't exactly a horror but it is very irritating to me and has been driving me crazy, and the thread's been dead for a while. I'm working on a project that's a python based CLI tool; using click as the main framework. The guy who put the design together for it did a reasonably good job, except that he's clearly a Java dev, and he's implemented some patterns that are driving me crazy. Some background for those of you not familiar with Python: Python is an OOP language, but it's not as strict as Java or C#, and it has a lot of odd quirks if you're coming from those languages. For example, in Java (and many other languages) you have private object attributes, generally denoted by a _ before the name. If you create a ThingHandler object, you won't be able to access any private object attributes at all, only the object itself can interact with these. To expose one of these attributes, you generally use a getter/setter pattern where you have a public attribute that then gets or sets the private attribute. Python retains this practice, but there's no actual implementation; you still preface all messy internal logic stuff with _ but it just mostly is there as a warning - 'Hey, please do not gently caress with this, even though I cannot stop you.' and is a good way to get your Github issue closed quickly. So what does that have to do with coding horrors? Well, dear friends, here is how he set up the very first example class in the suite: Python code:
Python code:
I should note that I am not exaggerating. None of them have any side effects. None of them do anything useful. They just expose the "private" variables through this pattern - and on top of that, these aren't inherited anywhere! They're not for reuse! Nobody else other than this program will ever use or touch them! I raised concerns early on and was told "oh no this is the best way to write this, because it doesn't evaluate on creation" and I backed off because I was very new to the team and didn't want to ruffle any feathers. I should have set something on fire. We have about a dozen people working on this project, many of them just for one feature and then leaving, and everyone has cargo culted this into their code as well. I've given up trying to get them to fix it either. People just refuse. They can't explain why, they just go 'well I already put it in.' We're just hitting feature complete for the phase and I'm going to go in and remove every single loving instance of this in a PR here shortly and by god if anyone argues with me I'm pushing them out a window and finding another reviewer, until we either run out of developers, run out of windows, or it gets merged. Edit: oh also he didn't use type hints anywhere at all, and so not only is this all extremely verbose, it's impossible to parse through an IDE. I've been going through and adding them everywhere as I push changes, but it's a huge pain in the rear end.
|
# ? Jul 1, 2023 03:52 |
|
Falcon2001 posted:OH AND ALSO WE DON'T HAVE FOUR VALUES, WE HAVE LIKE EIGHT. IT'S A HUNDRED loving LINES OF CODE THAT DOES NOTHING AT ALL. Yup, that's a Java developer
|
# ? Jul 1, 2023 04:48 |
|
Another cargo cult Java dev brain damage story: I was told once that I should put each of my python functions in a separate file, because that's more modular.
|
# ? Jul 1, 2023 10:57 |
|
Beef posted:Another cargo cult Java dev brain damage story: In C putting each function in a separate translation unit helps with code size reduction
|
# ? Jul 1, 2023 11:01 |
|
Falcon2001 posted:
just so you know, and obviously it might not be present in the real thing since this is just an example, but that `if` will fire if the bool is false as well as none
|
# ? Jul 1, 2023 12:04 |
|
Love mixing snake case with underscore prefixes. Super clear code.
|
# ? Jul 1, 2023 16:26 |
|
smackfu posted:Love mixing snake case with underscore prefixes. Super clear code. That's fine and common python style.
|
# ? Jul 1, 2023 16:48 |
|
quote:in Java (and many other languages) you have private object attributes, generally denoted by a _ before the name. This is actually not true for Java, although it may be for some other languages. The official Java style guide states: quote:Variable names should not start with underscore _ or dollar sign $ characters, even though both are allowed. Your coworker is just brain poisoned by C.
|
# ? Jul 1, 2023 16:51 |
|
It’s wrong in most languages as an underscore prefix is reserved for the compiler vendor
|
# ? Jul 1, 2023 16:54 |
|
Well poo poo that underscore part is probably me being wrong. Or if it they way in csharp?
|
# ? Jul 1, 2023 17:23 |
|
Falcon2001 posted:Well poo poo that underscore part is probably me being wrong. Or if it they way in csharp? This is a C# thing, yeah. Dijkstracula fucked around with this message at 17:42 on Jul 1, 2023 |
# ? Jul 1, 2023 17:38 |
|
I've seen leading (or trailing, lol c++) underscore as a marker for "private" in all the languages mentioned so far. Seemed common to me, though not at all universal.MrMoo posted:It’s wrong in most languages as an underscore prefix is reserved for the compiler vendor C++ contains multitudes but calling it "most languages" is a bit much.
|
# ? Jul 1, 2023 17:40 |
|
Beef posted:Another cargo cult Java dev brain damage story: that’s not even a thing in java!
|
# ? Jul 1, 2023 18:16 |
|
Soricidus posted:that’s not even a thing in java! I mean the one class per file is a Java thing though right? And in Java you can't have just a function hanging out by itself, it has to be contained within a class, so probably that's where that particular brainworm comes from.
|
# ? Jul 1, 2023 20:02 |
|
I guess there was the "one method per class" idea which would result in one method per file, but that was one of the more insane OO things that didn't catch on.
|
# ? Jul 1, 2023 20:40 |
|
pokeyman posted:I've seen leading (or trailing, lol c++) underscore as a marker for "private" in all the languages mentioned so far. Trailing underscore precisely because of the conflict with the vendor, i.e. random poo poo in headers. Other languages often carry the baggage of C and C++ in mindset, which also includes the silly m_ prefix. Fortran posted:All Fortran library procedure names have double leading underscores to reduce clashes with user-assigned subroutine names. Python posted:__var__ : double leading and trailing underscore variables (at least two leading and trailing underscores). Also called dunders. This naming convention is used by python to define variables internally. Avoid using this convention to prevent name conflicts that could arise with python updates. I've seen a superbly amazing ex-Googler use underscores for all variables in bash of all things, Ironically underscore as a leading prefix for private scope comes from C itself, Perl posted:A utility subroutine exists only to simplify the implementation of a module or class. It is never supposed to be exported from its module, nor ever to be used in client code. MrMoo fucked around with this message at 21:00 on Jul 1, 2023 |
# ? Jul 1, 2023 20:48 |
|
|
# ? Jun 8, 2024 01:15 |
|
MrMoo posted:Trailing underscore precisely because of the conflict with the vendor, i.e. random poo poo in headers. Other languages often carry the baggage of C and C++ in mindset, which also includes the silly m_ prefix. C has static for TR-scoped things, it doesn't need dumb underscore rules for fake static.
|
# ? Jul 1, 2023 22:14 |