views:

29

answers:

2

I have a javascript file that communicates to a controller class, which in turn delegates which function to run to a transactions class.

Is it better to have the transactions class broken up into multiple smaller files and then in my switch statement include which ever smaller file i need? or should i have all my transactions in one file?

I know keeping file size down is always a good idea, but will that affect my ajax functions if my transactions file starts getting pretty lengthy?

+1  A: 

I vote for smaller files, so you avoid antipattern : God Object

mere-teresa
I just wasn't sure if there would be any negative effects on the ajax. but you're right. the smaller individual files would probably be so small you wouldn't see any difference, and overall speed up everything
mlebrun15
A: 

Whether you include files or not is really up to you, and in the end they use up very minimal disk i/o unless you include like 100 files.

What I'd suggest is breaking them up into smaller files based on sets of functions (HTML functions, URL functions, etc) or classes (one class per file) just like any other script.

This is partly to save your sanity, and also because it is a good practice to simply seperate everything so you can take one file containing all of X functions over to another project that needs the same functions.

Chacha102
that makes sense. thanks for the input
mlebrun15