I am developing a video player for our department using C++.
This video player has three core modules: Reader(for reading data packets), Processor(decode the raw data), Display Handle(draw data on the screen). They are not close-coupled classes, which means they perform their jobs sort of independently.
However, I have a GUI module that interfaces these three modules and the client. It will retrieve the commands from user, such as pause, continue, jump to a particular location in the video clip. This GUI module will then delegate the jobs to the three modules mentioned above.
As a result, this GUI module grows fairly big as it contains many functions that the client will interact with. Though again, I am really careful that I don’t let this GUI module do any real processing tasks(they are done on the three core modules), I am afraid this GUI module becomes a God Object or “Blob” which is an anti-pattern in Object-oriented design.
This is the sample declaration for the GUI module here:
class CorePlayer
{
public:
CorePlayer();
~CorePlayer();
public:
void start();
void pause();
void continue();
void jumpToFrame(int frameNum);
void toggleFullScreen();
.........
private:
Reader* rModule_;
Processor* pModule_;
DisplayHandle* dspHandle_;
}
There are a lot more functions in the …….. area. They are functions people need for the media player. They don’t perform the real processing, they delegate jobs to the modules.
Can anybody help to clarify my concerns that this GUI module is a “Blob” using the design described?
That doesn’t look like a blob to me — it’s just a feature-rich GUI controller for a playback module. It would become a blob though, were it stuffed with additional functions unrelated to playback, like “Settings”, “Plug-in Management”, etc.