You need to sign in to do that
Don't have an account?
Cindy Norman
Splitting Source code into multiple files
What is the best way to split large Apex Source Code (for 1 controller) into separate source files?
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
- I create thin Controllers that only deal with getting variables to-and-from a VF page. These controllers reference one or more...
- Manager classes which contain the specific business logic details and handle the saving. They rely on...
- Data Access Classes which essentially wrap SOQL statements/queries for a particular SObject.
This seems to remove a lot of the clutter, keeps files compact/focused and helps create a nice separation of concerns. It also makes testing pretty easy...To avoid an alphabet soup, since APEX doens't support folder in Eclipse, we prefix files with a naming convention:
- ctr_myController: CTR for controller classes
- mgr_accountManager: MGR for manager classes
- dao_account: DAO for data access...
Hope that helps?All Answers
- I create thin Controllers that only deal with getting variables to-and-from a VF page. These controllers reference one or more...
- Manager classes which contain the specific business logic details and handle the saving. They rely on...
- Data Access Classes which essentially wrap SOQL statements/queries for a particular SObject.
This seems to remove a lot of the clutter, keeps files compact/focused and helps create a nice separation of concerns. It also makes testing pretty easy...To avoid an alphabet soup, since APEX doens't support folder in Eclipse, we prefix files with a naming convention:
- ctr_myController: CTR for controller classes
- mgr_accountManager: MGR for manager classes
- dao_account: DAO for data access...
Hope that helps?Here's a silly question but i can't seem to find the syntax for including one file in another...maybe its because i come from the C++ world and am looking for the wrong thing.
Regarding "includes" - so you're talking like .h file macros and includes... Yeah, that won't work here... APEX is much more like Java.
Just think of each class as publishing API's for use via the methods. Other classes just leverage those methods by calling them directly.
If this is still unclear, ping me back, maybe I can help via a better example...