Difference between Library and Helper

7

What sets the helper of a library ? For example: Let's say I have a class for URL handling. I call her and she fills out the URL with the site path. Would this be a helper ?

    
asked by anonymous 18.03.2015 / 19:36

1 answer

7

I've never seen the term library , or library , applied in context specific MVC technology, even a specific technology using MVC. I've already seen the term being used in generic contexts, which obviously includes the MVC. A library is a solution of structures and algorithms, a set of related features. No doubt it can contain helpers . Eventually a library may consist of helpers only.

In the MVC context the helper is something that should be used to organize the application. It is a way of creating a canonical version of what needs to be used. It is very common to make a helper when it will be used several times in the application. But eventually it can be used only and it is created to simplify its use by abstracting the content. This is important when you are going to create views , which should have very little logic, so you "hide" this logic in these helpers

At least in the context of MVC these helpers , roughly, usually work as snippets to use within views .

The helper has a better defined function, although it is essentially used for organization. The library is a concept and technique of organization and this is its main function: to organize. It changes little in the application if you do not organize libraries. But it changes much more if you do not use helpers . Without helpers you may have redundancy, inconsistency, illegibility, just to name a few problems, as well as specific problems due to lack of organization.

It may be that some MVC-specific technology has a more specialized use and definition. For example:

In Daniel Omine's commentary he has an article showing the difference between a classic helper used exclusively in view of ASP.Net MVC ( Razor ) and a function that can even be used as a helper . In addition to having a semantic reason to choose each one there is a difference in the type of data that each one returns. Certainly the helper has a stricter pattern because the framework knows how to do something specific with that.

I did not exactly answer the difference because, as far as I know, these concepts are not directly comparable. At most one can be part of the other.

I think your example is a helper but you need to see how it was written, used, and what technology is used. Although it seems unlikely, this class may not have a helper function in the sense we usually understand.

    
18.03.2015 / 20:26