Forums / Setup & design / large classes--what is a good maximum number of attributes?

large classes--what is a good maximum number of attributes?

Author Message

Greg McAvoy-Jensen

Saturday 26 April 2008 10:52:09 pm

How big can a class be and still work well? I'm working on a project in which one class has surpassed 100 attributes. Some of the items could be grouped into classes and connected via the object relations datatype. However, the content model doesn't require it.

To further complicate things, the client would like to import information into this class using ezodf import. To make this as easy as possible, this class should stay intact, as ezodf can't import one document into several related objects of different classes--right?

If I keep it as one huge class, will I encounter performance problems?

If we end up NOT being restricted to one class by the ezodf limitation, should I break this large class into several smaller ones? What's a good guideline for a maximum class size?

Incidentally, the class consists mainly of text lines and XML blocks, with a few matrices, 10 images, etc.

Many thanks!

Granite Horizon, Certified Developer of eZ Publish Web Solutions
Provider of the SaaS Solution Granite Horizon In The Cloud | http://granitehorizon.com/cloud
http://granitehorizon.com | +1 916 647 6350 | California USA | @granitegreg
Blog: http://granitehorizon.com/blog

Piotrek Karaƛ

Sunday 27 April 2008 12:56:20 am

Hi Greg!

Wow. 100 attributes is something. I mean we've already gone above 50, but that's about double that.

I cannot provide you with a definite answer to you question, but would like support you postulating an answer ;)

I expect, that in such case everything comes into play:
- the kind of datatypes you use (textlines and XML blocks probably are on two opposite poles of processing cost),
- the kind and frequency of operations you will the objects for,
- the kind of caching, fetching etc. in relation to these giant objects...
- server's ability to cope with those objects with a solid margin before timeouts...

BTW. is there no way to reduce the amount? For example, by joining several XML Blocks and/or text lines into one, formatted XML Block?

Cheers,
Piotrek

--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu

Maxime Thomas

Sunday 27 April 2008 11:53:23 pm

For one of our project we went on 130 atributes.
It was usefull to have all in one classe because make a comparator between object of these classes.

Maxime Thomas
maxime.thomas@wascou.org | www.wascou.org | http://twitter.com/wascou

Company Blog : http://www.wascou.org/eng/Company/Blog
Technical Blog : http://share.ez.no/blogs/maxime-thomas