Forums / Developer / Large Classes

Large Classes

Author Message

Camilo Cienfuegos

Monday 27 November 2006 10:18:02 am

Hello,
Will my eZ Publish application suffer in any way, if I create large classes - one class has 38 attributes (so far no problems, but what will happen in 1000 objects time). Might it be better to break the classes up?

Thanks,
Camilo

Claudia Kosny

Wednesday 29 November 2006 1:28:19 pm

Hi Camilo

I think having one large class is better, although this might depend on your exact requirements. Here my reasons:
- The setup for creating an object of this class is easier, with several small classes you need make sure that if the user cancels the create/edit on the second partial object, the changes on the first partial object are undone as well.
- If you display an object you just need one fetch, with several partial object you need at least one more fetch operation.
- Searching is easier.
- You have less cache files (I think)

Claudia