I recognize that some classes come in all sizes. But is there a guideline that people use for when they start thinking "This object is too big, should I break it into smaller pieces"?
Maybe what I am asking here can't be answered in a completely general way. I have this feeling that an object is an abstract entity that can be understood in a single thought. A class is an object. Therefor a class is something that
you should be able to keep in you head conceptually for at least as long as you are actively trying to expand/maintain it. That has worked well for me in the past, but I am struggling on my current project.
I am working on a project with maybe 60 or so classes (currently). I have one class that doesn't seem to fulfill the "all in your head" rule. If I had to call this class an object I would say it is the "flow control center" of my application. It runs in its own
thread; sets up the initial GUI, connects requests from the current GUI to appropriate behavior; monitors a background task queue; organizes and/or prioritizes tasks, and spools off background threads to handle tasks that might otherwise tie up the task queue monitor for too long. It also has a growing "logic" section that makes decisions about application's final output to the remote server. At the moment this class is (only) 2000 lines long, and the logic section is just getting started. But even at just 2000 lines this "control center" class is already cumbersome dig through in an editor, and getting it all in my head at once is challenging. At the rate things are growing, this class could have a 150 methods before I am done. It will be unwieldy at that point. Moreover, I don't want the guy who takes my place to be confronted with 4000 lines of code in order to figure out how to change the permissions of how files are downloaded.
Maybe that means I am NOT writing it correctly! And thus my question, "How big, is too big?". is the "in your head all at once" rule a valid one? Can someone point me to something that will help me to learn how to break down these jumbo classes into smaller ones?