Welcome Guest, Not a member yet? Register   Sign In
Should I go about this another way? Currently a Library, Should be Model?
#7

[eluser]TheFuzzy0ne[/eluser]
Welcome to the CodeIgniter community, haloweb!

I too struggle to understand what a library should be used for. Generally, all of the libraries I make are independent. I see MVC as, well MVC. The controller utilises models and views. I don't feel that a library fits in there, which is why I tend to make them self contained, and non-dependent on views or models. Generally, they're only accessed by the controller.

I'd have to say that a library isn't a model. If it was, then it should be a model not a library. For me, a library represents an object, or a collection of methods and properties that all have something specific in common. It can handle just data, or it can handle the visual aspects to do with that. However, I still try to ensure that my libraries don't output data directly, they only return it. With that said, I'm sure there may come a time when I will have to have a library that outputs HTML, but I've not yet found the need to do so.

I would like to hear other peoples views (no pun intended), on libraries, and what they should and shouldn't do.


Messages In This Thread
Should I go about this another way? Currently a Library, Should be Model? - by El Forum - 03-09-2009, 06:43 PM



Theme © iAndrew 2016 - Forum software by © MyBB