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

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 12:50:45
Script start
Timing: Jan 19 2025 12:50:45
Module start 'layout'
Timing: Jan 19 2025 12:50:45
Module start 'content'
Timing: Jan 19 2025 12:50:45
Module end 'content'
Timing: Jan 19 2025 12:50:45
Script end

Main resources:

Total runtime0.0146 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0051 589.4141152.6563
Module start 'layout' 0.00510.0025 742.070339.5078
Module start 'content' 0.00760.0050 781.578193.3984
Module end 'content' 0.01260.0020 874.976634.3047
Script end 0.0146  909.2813 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002517.4264140.0002
Check MTime0.00117.2917140.0001
Mysql Total
Database connection0.00085.584710.0008
Mysqli_queries0.002114.265230.0007
Looping result0.00000.075110.0000
Template Total0.001611.110.0016
Template load0.00096.413710.0009
Template processing0.00074.620210.0007
Override
Cache load0.00074.703410.0007
General
dbfile0.00032.079280.0000
String conversion0.00000.027740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs