Recently, the anonymous submitter of the following code had been mentoring novice developers in the use of design patterns.  I'm sure one of the things he stressed was creating a reusable template for how to solve a problem that can be used in many many situations. All good stuff.

Well, the submitter took a peek at the work of one of the developers and felt that the author of the below code may need some coaching on what "reuse" means.

case SOME_CONST1:
        _panelInstance  = DetailPanelFactory.getInstance(type);
        _panelInstance.parseXML(panelList);
        // add the new panelItem to the panelCollection
        _panelCollection.addItem(_panelInstance);
break;

case SOME_CONST2:
        _panelInstance  = DetailPanelFactory.getInstance(type);
        _panelInstance.parseXML(panelList);
        // add the new panelItem to the panelCollection
        _panelCollection.addItem(_panelInstance);
break;

case SOME_CONST3:
        _panelInstance  = DetailPanelFactory.getInstance(type);
        _panelInstance.parseXML(panelList);
        // add the new panelItem to the panelCollection
        _panelCollection.addItem(_panelInstance);
break;

case SOME_CONST4:
        _panelInstance  = DetailPanelFactory.getInstance(type);
        _panelInstance.parseXML(panelList);
        // add the new panelItem to the panelCollection
        _panelCollection.addItem(_panelInstance);
break;
 

 

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!