Welcome Guest, Not a member yet? Register   Sign In
Main difference between Library and Helper?
#1

[eluser]Rey Philip Regis[/eluser]
Hi guys,

Well, this question sprung to my mind. What is the main difference between a library and a helper? Ok....when it comes to coding yes, a library is an OO while the helper is procedural and it is stated in the manual. How about other differences?

Ok let me change the question? What's the advantage of creating a library than of the helper? Or why do create a helper when you can create a library? Or more specifc question, why did the CI developers create helpers, why dont they create a library for those helpers like make a form class not form helpers or an array class rather than array helpers and like what I said library is OO and helpers are procedural and for me its better to code OO than procedural. I know there are reasons behind this, so can someone explain to me the advantages of creating helpers rather than a library.

Good day.
#2

[eluser]GSV Sleeper Service[/eluser]
for me, the main advantage of helpers is less code in the views. which of these looks less daunting for a designer/non-programmer?
Code:
//library
<?php echo $this->form->form_open('email/send'); ?>

//helper
<?php echo form_open('email/send'); ?>
#3

[eluser]Jelmer[/eluser]
To be honest I don't really know, if it's a set of functions I prefer to use a library - especially if I need DB access (even though I have to load the CI superobject the same as if it where a helper).

The point about the amount of code I never considered an upside, because the extra code $this->library helps me remember where the function comes from - which is sometimes usefull if you load helpers/libraries in the class constructor or from autoload. Also it keeps the general namespace clean, though I must admit I never really cared about that...




Theme © iAndrew 2016 - Forum software by © MyBB