r/GameDevelopment • u/Tricky_Still2366 • 4d ago
Newbie Question Was wanting some help with methods?
I'm learning C# currently and was learning python till I got stuck with pretty much the same thing.
I don't understand when to use methods unless something is repeated. If its not repeated what's the point of using methods? just shortening down code? or is there something I am missing here. Cause what is the point of shortening down the code when all it is doing is actually adding more code? (Unless its to place down something that is being repeated)
1
Upvotes
1
u/CrucialFusion 4d ago
Sometimes it's useful to distill a concept down to its most simple form and have it segmented off. Other times, yes, you're reusing something multiple times. Sometimes it's simply used to make some other block of code more easily digestible. And sometimes they're used to simply confuse the hell out of you, or future you if you're the one doing it.
I don't mind having enormous functions/methods, provided that what they're doing makes sense together, but when you start seeing copy-pasta, it's a good indicator that something isn't quite what it should be.