Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

[Code Organization] What should I do with private static methods that does not access instances variables?

$
0
0
I've recently started reading Clean Code: A handbook of Agile Software Craftsmanship. The concepts in there threw me in some occasional code refactoring. While making changes, I end up with methods that are entirely helper methods and does not make any sense in being exposed as public. I make them private. Some of these methods also does not need to access instance or class variables or methods even while still being tightly coupled to the class itself (i.e a helper method to ensure consistent text format related to the instance, for debug logging). I make them static. On the Header file, I declare those private static methods in the class declaration. They feel like useless noise, since they are so "private" and "coupled". In this situation, is there something that is believed to be a good way of action? I thought of moving them to anonymous namespaces into the source file as functions, but then it feels like I'm hiding functionalities.

Viewing all articles
Browse latest Browse all 17825

Trending Articles