Welcome Guest, Not a member yet? Register   Sign In
ways of developing robust libraries
#1

(This post was last modified: 04-27-2015, 11:44 PM by Spiker. Edit Reason: I have attached an incorrect .zip file, this is a replacement. )

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?

Attached Files
.zip   messages_controller.zip (Size: 1.71 KB / Downloads: 78)
Reply




Theme © iAndrew 2016 - Forum software by © MyBB