Welcome Guest, Not a member yet? Register   Sign In
User Guide: Libraries vs Core Classes
#11

[eluser]oribani[/eluser]
[quote author="BrianDHall" date="1252647614"]Actually, I don't know that I understand the real difference between a plugin and a library.

I think the idea of a helper is just that its suppose to be some useful functions that are useful everywhere - the reason for the destinction is that they are not object oriented. Once loaded they behave like a native PHP function, that is to say you can just call sha1() or md5() or trim() anywhere.
[/quote]

Yeah, that's their justification for the difference between "library" and "helper", but why? I'm not sure there is a definitive definition of a "library", but to me procedural functions ring more true to the definition, or at least not less so than object oriented code. In the end, procedural versus object oriented has NOTHING to do with "library" as far as I know.

[quote author="BrianDHall" date="1252647614"]Libraries and plugins, to my understanding, are more object oriented and they are more tightly integrated and organized. For instance in file uploads $this->upload->data() is meaningless and useless unless you are using the other functions of the upload class, or the Session class - their functions only work if you use the whole library. Meanwhile the HTML helper function img() is just handy in all sorts of places.

Core classes mean they are available on all CI systems.

Plugins is what I flat don't know about - what's the difference in a plugin and a library?
[/quote]

No. See: http://ellislab.com/codeigniter/user-gui...ugins.html
"Plugins work almost identically to Helpers. The main difference is that a plugin usually provides a single function"

A plugin is basically synonymous with a helper except that it's supposed to contain just one function. Not sure why that is, since the loading mechanism for both seems to just be a simple include_once.

[quote author="BrianDHall" date="1252647614"]The manual does need cleaned in this respect, but we must first know and agree what is correct before we can attempt to explain it to others.

EDIT:

On extending core classes, you are not 'supposed' to ever change a core class, because you become locked into those changes and cannot easily upgrade to newer versions of CI, and if you run into a problem it may be hard to get help from others because they have different code than you do.

Hm, is this the difference with what a plugin is? Is a plugin what you put in the same directory as the core classes that automatically over-ride the underlying classes automagically?[/quote]

No. See above - plugins are not related to core classes. And extending or replacing core classes IS SUPPORTED. It's the same thing as extending or replacing libraries (there is no difference from what I can tell, which is the subject of this thread). You don't edit the core class code - you put your override/extension in the application/libraries/ directory.

[quote author="BrianDHall" date="1252647614"]Then extending a core class is different because it is not automatic. You can make a MY_Controller class, but if you don't explicitly make a controller that extends "MY_Controller" instead of "Controller", then your special controller class doesn't get used.

Am I on the right track?[/quote]

Yes, from what I can tell, you need to make sure you extend "MY_Controller" in your controller files, but you are not correct about how core classes are overridden and supported.


Messages In This Thread
User Guide: Libraries vs Core Classes - by El Forum - 09-10-2009, 05:01 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-10-2009, 05:29 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-10-2009, 05:36 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-10-2009, 06:17 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-10-2009, 06:25 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-10-2009, 06:27 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-10-2009, 06:31 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-10-2009, 06:40 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-10-2009, 06:45 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-10-2009, 07:29 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-10-2009, 07:45 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-10-2009, 08:43 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-10-2009, 08:53 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-10-2009, 09:06 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-10-2009, 09:56 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-10-2009, 10:54 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-10-2009, 11:38 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-11-2009, 01:06 AM
User Guide: Libraries vs Core Classes - by El Forum - 09-11-2009, 02:17 AM
User Guide: Libraries vs Core Classes - by El Forum - 09-11-2009, 02:36 AM
User Guide: Libraries vs Core Classes - by El Forum - 09-11-2009, 12:49 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-11-2009, 12:59 PM
User Guide: Libraries vs Core Classes - by El Forum - 09-11-2009, 01:10 PM



Theme © iAndrew 2016 - Forum software by © MyBB