Actually, it varies from project to project. There is no guaranteed โright wayโ to group anything; it all depends on your needs. It's about manageability, which means how easily you can read and update old code. If you can keep all your games in one class of "games", then there is nothing wrong with that. However, if your games are very complex with a lot of subtitles and variables, it might be easier to control them moving to their own class.
Thus, there are ways to group elements logically. For example, if you have many solo functions that are used for manipulation (char to string, string to int, html encode / decode, etc.), you may decide to create a class of "helper functions" to hold them all, Similarly, if your application uses a database connection, you can create a class to store and manage the general connection, as well as have methods for receiving query results and executing non-queries.
Some people try to break a lot. For example, instead of having the database engine mentioned above, they can create one class to create and manage the database connection. They will create another class, then use the connection class to process requests. Not that this method does not work, but it becomes very difficult to control when the elements are separated too small.
Not knowing exactly what you are doing, there is no way to tell you how to do it. If you reuse the same methods in every project, then maybe you can place them somewhere so that they can share. The best way I've found to figure out what works best is to simply try it and see how it reacts!
source share