General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
p11
Continuous Delivery
comments
Comments by "p11" (@porky1118) on "5 Ways to Improve Your Code" video.
I also try to make my functions/methods as short as possible, but sometimes it might be better to write longer methods for redability. It's not a good thing if you always have to look up some method, which is just used in this one method and does not even make sense in a different context, and then just go back to the original method.
5
@LarryRix I didn't talk about function names not making sense in a different context, but the function itself being so specific, it would only be used in the one place anyway. I don't get, what the rest is about. I didn't even mention inheritance.
2
I only comment: * functions/types I defined, if the name is not obvious (or if I use them to generate documentation, also the obvious ones) * difficult segments, mostly math, which I often forget myself * things that seem like some mistake, but actually have to be this way ("don't remove this assignment. It does not just redefine an existing variable, but accessing the original variable implicitly invokes a non-performant calculation")
1
I agree about many parameters. You should pack multiple related parameters into structs. For example a vector instead of (int x, int y), especially if you have multiple of them. Same for structs/classes with many fields: If some belong together, pack them into a substruct, especially if you might need multiple of them.
1
In Games and Graphics programming, especially when using engines like Unity, I'm not sure if writing tests would be that useful. If you can extract a subsystem, which works by itself, writing tests seems like a good idea, but else they won't help that much. The best "test" is playing the game.
1