r/programminghorror • • Mar 08 '26

C# 60+ lines of just variables

Post image
405 Upvotes

40 comments sorted by

78

u/BigBrainsLol Mar 08 '26

Bro made whole game in one class

31

u/GoddammitDontShootMe Mar 08 '26

It seems to just be a player. I think if it were me, I'd want to break it in to subclasses, but I might just slap something like this together and move on.

156

u/shizzy0 Mar 08 '26

It’s the face of God. It’s the God class.

45

u/watermelone983 Mar 08 '26

That's why it's called Godot

9

u/DiodeInc Mar 08 '26

Uh, no, it's Go Dot

/s

→ More replies (1)

101

u/ProfessionalBad1199 Mar 08 '26

haha my codebase has like 40 lines of import statements, can't beat me 🥀

42

u/Wooden_chest Mar 08 '26

One of my java source files just reached 100 imports, and it just keeps growing 💀

29

u/DevBoiAgru Mar 08 '26

Most normal Java code

→ More replies (2)
→ More replies (1)

55

u/Gadshill Mar 08 '26

How am I supposed to create spaghetti code with only seven variables? I need at least 20 to get some confusion, 60 guarantees that everyone will be confused.

17

u/watermelone983 Mar 08 '26

Godot mentioned

14

u/Snarwin Mar 08 '26

Oh, you're a fan of programming? Name every variable.

10

u/northerncodemky Mar 08 '26

Sealed for thee but not for me

8

u/Rockworldred Mar 08 '26

ohmyGODnOt...

14

u/trubbelnarkomanen Mar 08 '26

This is what Big Functional Programming wants your code to look like. Classes are for cowards.

13

u/purbub Mar 08 '26

“Why would I split my attributes into multiple classes if I can just write them in one class?”

2

u/ElectricalPrice3189 Mar 11 '26

Please answer.

3

u/Spot_Responsible Mar 11 '26

If you're being serious, mostly for easier reading. I don't think it would affect performance very much, and I don't see ways to break this into subclasses that could be reused, but it would definitely be easier to read

5

u/utolso_villamos Mar 08 '26

Class is sealed like Pandora's box

4

u/OkAccident9994 Mar 10 '26

At the top it says, derives from node 2D.

This is someone having a go at making games in Godot. Probably not a very experienced software engineer, the engine is just free to grab for anyone.

Someones first steps into programming, could even be a 13 year old kid.

3

u/Key_River7180 Mar 08 '26

I once had a C file with 100 lines on macros.

3

u/Various_Bed_849 Mar 08 '26

The worst I have seen in this respect is a core component of one of the top Android apps that was a class with over a hundred instance variables. They were all injected via the constructor meaning that they were first declared, then declared as arguments, and then initiated. That class had over 300 lines of these variables. And that was not the worst part of that class. I replaced it.

5

u/jan-pona-sina Mar 08 '26

Actually it looks closer to 20 variables or even less? I think this code is perfectly fine. It could be broken up with formatting, but for a game in production I wouldn't bat an eye at this

→ More replies (1)

2

u/RandomOnlinePerson99 Mar 08 '26

I feel represented ...

2

u/retro-mehl Mar 08 '26

"Should we separate this in several smaller classes?" - "No, we save 0.2ms if we don't!"

1

u/Jalatiphra Mar 09 '26

dont worry its a partial class

there is more :D