Hi,
I have the a doubt on how what is the benefit on separating the abstraction and implementation.
The below code
Code:class FileProcessor { public: virtual void processFile(); }; class DocProcessor : public FileProcessor { public: void processFile();// Implementation is given it will implement to process the doc files }; class ExcelProcessor : public FileProcessor { public: void processFile();//Implements to process the excel files }; Till now it is fine suppose DocProcessor and ExcelProcessor uses two big algorithm to process these file types then I still can have subclasses like class Algorithm1 : public DocProcessor { public: void algorithm(); //which will be called as per the algorithm class instantiated for to process }; class Algorithm2 : public DocProcessor { public: void algorithm(); //which will be called as per the algorithm class instantiated for to process }; same for ExcelProcessor class
Here everything looks fine to me. [ I have not used the bridge pattern to separate the abstraction and implementation]. The only thing i can achieve using bridge is that the number of classes will be reduced if new class like jpgProcessor is introduced or new algorithim is introduced.
Then why it is recommended that always separate the abstraction and implementation
please help
Regards




Reply With Quote