CodeIgniter Forums

Full Version: ways of developing robust libraries
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was thinking few weeks ago on how to build libraries in order to have easier time testing them and to enable them to hold more information (hold information such as: what has happened, rather than putting log_message or similar to know where the issue is , i.e. have some error reporting built in). Additionally to that it would be great to save the action that have happened in the system.

While developing the library I have followed couple of rules:
- Function in the class should return a resource or we have an error (FALSE)
- I don't use form_validation inside the class. I think it's controller related. I guess, if to do it in the library, the best way to do it would be using magic methods?

In the library that I have attached we have 2 main functions to fetch list of messages and fetch a message itself.
Also we have 4 support functions to enable you to set / fetch system code / status.
And also we have __construct and setUserId which are self-explanatory.

It would be great to see what you guys think and if there is something similar out their?