views:

107

answers:

2

I am developing a CMS based on Zend Framework which have many modules, for example News and Gallery. Each module has some part with same function as manage categories and comments (Categories and comments for News, Photos, Albums - cames from News and Gallery modules - are separate). Can somebody give me the advise to avoid making duplicate code?

Thanks.

+1  A: 

Write classes to abstract the logic to a central source file. Basically, use encapsulation.

Antony Carthy
A: 

Separate the part of your application that should be reused. It's a good strategy to begin by copy-pasting, and only refactor it out into a shared component once you have at least two concrete uses for an abstraction.

troelskn