r/badcode • u/domtriestocode public static • Apr 05 '23
c# Refactoring some public static field ridden code. Everything important is in public static lists in Global.cs and it all looks like this to a degree. Almost no OOP in sight
282
Upvotes
16
u/SanianCreations Apr 06 '23
The problem here is that they don't use loops. Public static methods are fine, they are basically just what regular old functions are in other languages, which is quite fine.
3
u/Shai_the_Lynx Apr 06 '23
OOP is overrated
78
u/robottron45 Apr 06 '23
loops seem to be hard ._.
My fingers would actually hurt writing this code, even with copy+paste
44
u/AdOtherwise3874 Apr 06 '23
My first job was in a desktop app written in VB6 with global variables named things like g_temp
For a variable named temp, it did a lot of heavy lifting
21
u/juicewr999 Apr 06 '23
Okay, I lurk here and see some code that’s not terrible but this is an absolute monstrosity.
11
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Apr 06 '23
Image Transcription: Code
I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!
2
u/Sauermachtlustig84 Apr 06 '23
I am no fan of WPF, but I really abhor this "lets program wpf via code behind" style. Sure it can be necessary, but here it just poor practice.
2
u/santas Apr 06 '23
FWIW, I've heard the runtime is really optimized well for static objects. That said, this is still bad.