Oh he's aware, but I agree with his logic: he needs to make stuff work for 1 maybe 2 streams, average 5 hours ish, in what world does it make sense to not take the easiest way out? Lord knows it's not getting maintained, and it functions for what he needs then is forgotten, lost to the eather, clean or not. For context all this does is grab random chat messages and convert it to a game input.
That is true, but this is not the easiest way. I'm almost 100% sure that you can use a dictionary or something to speed up the development. Copying, pasting and changing some things repeatedly is not only slower, but also more error prone
I kinda see his point. Sure, you could use a dict filled with lambdas, but does that really improve the workflow?
It's throwaway code, rapid prototyping only, performance doesn't matter, and copy paste gets the job done faster than "doing it right".
Wasting time to code for looks or only to comply with some paradigms goes completely against the spirit of why the paradigms were invented in the first place: to save time.
Mind you, this all goes out the window once you keep it around and start building stuff on top of it. Then it will bite your ass and you only have your poor foresight to blame.
I’m pretty sure that writing a simple loop or dict would have taken the same amount of time as copying/editing a ton of rows. Especially if a typo causes a bug that needs to be tracked down through hundreds of lines because you forgot to update a value somewhere.
I’d argue that using the proper tool for the situation will still ultimately get the job done faster.
I'm not to sure it's fully throwaway, after all he's done quite a few simlier streams. He could make a good working code structure and then adapt it as needed rather than rewrite it out again to be thrown away.
Doug (the streamer) wrote this program very soon after he started streaming, and according to him at that time he actually had almost no knowledge of Python.
So if anything it’s a feat on its own that this hot pile of ramen worked for him for so long.
And of course many people have suggested him to use at least dictionaries, but there’s a certain meaningfulness in using if statements, in that when he has to explain the code to the viewers (so that people know how to control the game), showing that
“if (you type) commandthen (the program will type) key x”
would be a lot more accessible to non-tech people than looking at a massive dict literal (and for-loops are just not intuitive at all).
People in this sub might say that dictionaries are equally as legible, yet that is not necessarily true for people not working in this field; to him it’s more imperative that people easily understand how the stream works, big-O is secondary.
I agree with you. Even if you're looking for the quickest, easiest way it really feels strange to land on this. I dunno, though, I hardly ever finish anything lol.
it's not a coding stream. It's a script for the twitch chat to interact with the mod menus in his games, and chaos ensues as he's trying to finish some mission he came up with. It's actually pretty entertaining, dougdoug on youtube
I mean, there's certainly more to it than that. You probably also want your code to be reliable and maintainable. And good code is not necessarily readable to someone who doesn't know how to code, so if that's a concern then there is an argument in favour of this kind of code structure.
Of course the code is horrible (and certainly not easily maintainable...), but it's also sort of become a meme at this point in his streams. He knows it sucks, he often calls himself a bad programmer (despite his having a CS degree), and it works so it works.
The point I was trying to make, is that if you aren't accustomed to it, it's really not that readable, and it gets worse for good code. I don't think you should write code unreadable, but it not being readable to people not accustomed to a language doesn't make it bad code. There is much more to good code than readability.
And so on, because then you could just unpack it into the function like:
HoldAndReleaseKey( *mapping[randomCommand] )
But, for something that's prolly only got to work for a few streams for a few hours...eh, its not bad. For production code, absolutely, but some "sling it together and get shit going" like that? Yeah, nothing amiss here.
370
u/A_Guy_in_Orange Oct 16 '21
Oh he's aware, but I agree with his logic: he needs to make stuff work for 1 maybe 2 streams, average 5 hours ish, in what world does it make sense to not take the easiest way out? Lord knows it's not getting maintained, and it functions for what he needs then is forgotten, lost to the eather, clean or not. For context all this does is grab random chat messages and convert it to a game input.
67
u/johnbarnshack Oct 16 '21
can I ask what's fun about watching this kind of stream?
49
u/Toxin_X Oct 17 '21
It’s not supposed to be good, it’s supposed to be readable by someone who has never seen code so that chat can’t say he cheated
31
u/RavynousHunter Oct 17 '21
Personally, I'd use a nested tuple, something like:
And so on, because then you could just unpack it into the function like:
But, for something that's prolly only got to work for a few streams for a few hours...eh, its not bad. For production code, absolutely, but some "sling it together and get shit going" like that? Yeah, nothing amiss here.
2
u/MorphTheMoth Oct 17 '21
the left part is fine for a prototype, but the right one can't be excused
1
u/[deleted] Oct 21 '21
I love DougDoug so much
1
u/Spynder shameless stealing content to r/YandereTechnique Oct 17 '21
r/YandereTechnique
-1
u/ekz255 Oct 17 '21
his face says it all