• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Carabiner 1.0: Asset Management Library

#21
[eluser]Henry Weismann[/eluser]
Let me know if I have this correct. So this does not load php to output the js and css. It uses php only when it needs to build the cache and does so by taking the files you add minifies and caches them and outputs a direct link to the minified cached static file.

If that is the case then this might be useful for my project. I had been using a custom assets library but someone clued me into the fact that even though it is cached I was still loading php and using memory to output a simple file static file.

#22
[eluser]jrutter[/eluser]
Im not sure how to set this up, where do I put the config stuff? In my controller?

Great work by the way!

#23
[eluser]tonydewan[/eluser]
@umefarooq: I'll look into writing up my implementation of GZIP. I don't have plans to add it to Carabiner directly, however.

@Henry Weismann: That is correct.

@jrutter: Yes. You'll need to apply the config once you've initialized the library. That'll be happening in your controller, most likely.

#24
[eluser]tonydewan[/eluser]
I've updated Carabiner to include css media type association. See the new thread for more info and to download!

#25
[eluser]meteor[/eluser]
Hi,
Just wanted to say a few words on the carabiner library.
In my opinion, it would be much better if library used config file. CI provides very good means of loading configs at initialization time to libraries. It is good to use it. Writing more than one line of code in __construct for a library and more than one line per method of a class is too much to me. Another thing, writitng configs in a cnstructor function is just asking for troubles, library should have one separated config. Next, files should be loaded per class and method, combination of class and method is unique for each aplication so you can use it to index files you want to load like so
class_method = array('js' => array('files_here'),'css' => array('files_here'));
Next, default set of files should be specified, it means , if no configuration for a given method and class is provided, load default js set, for example nothing, and defualt css file , say with media specified for screen ...
adding extra params per class and method can be specified in the config like so: default_set_of_files +js_file_1 +js_file_2 etc ... removing files default_set_of_files -js_file_1 -js_file_2, this way you do not have to look for ceratin things every time you start new project ...

Next ... Your functions are too elaborate ... I come from ruby world, and my opinion is that, function should do one thing, no data types checking, nothing(a developer is repsonsible for providing correct data ), no extra checks, one function one thing to do. These are not methods for customers but for developers so overhead should be taken into account and simplicity should not be the main criteria ... your function are monstrous, they should not ... libraries should not mix php and html, it is not very professional. Next. no tests are provided with your library, why ? I noticed this is the standard way this community provides libraries. How can you extend code if you are not sure if you just have not broken something else ... no comment.
All in all this library presents not much value to me, there is a lot of code in it but not much is attained with it... It would be much better to exclude certain files from the given class method by not including them instaed of minify them ... Configuration is poorly designed, configuring things for every class in the constructor is asking for troubles, you have to remember what you placed and where , with 20 controllers it is not practical at all, honestly it brings more trouble than benefits.

I think this library is not much better than the assets helper ... Try harder man ... One day it might be a decent piece of code but it still lacks a lot to reach ceratain level of quality

#26
[eluser]tonydewan[/eluser]
@meteor Thanks for the feedback. I'm sorry you don't like Carabiner. I'll certainly take some of the criticisms you've provided into account in the future. However, you certainly don't need to use Carabiner. If it's not for you, don't use it. As you mentioned, there are other options available. If you don't like those, you can certainly write your own.

I would like to respond to a few points.

[quote author="meteor" date="1236537626"]it would be much better if library used config file.[/quote]

This is something I'm considering for a future release. I modeled the current config setup after the several of the older libraries by Elliot Haughlin. As I've said before, I think a config file is overkill in this instance. However, I can certainly see it being useful.

[quote author="meteor" date="1236537626"]writitng configs in a cnstructor function is just asking for troubles[/quote]

There is no configuration in the Carabiner constructor. The configuration happens with a separate config function.

[quote author="meteor" date="1236537626"]Next ... Your functions are too elaborate[/quote]

I assume your talking about the display function. I agree wholeheartedly. That's on my list of things to redo. I'm optimizing Carabiner as I add functionality.

[quote author="meteor" date="1236537626"]I come from ruby world, and my opinion is that, function should do one thing, no data types checking,[/quote]

The only data type checking is in the js and css functions. The only reason I do this is to allow arrays or arrays of arrays to be passed to these functions. That way, the library adapts to how the developer wants to use it. This is customization over convention, in opposition to the rails mentality of convention over customization. The extra overhead, in my opinion, is negligible, particularly compared to the functionality gains.

[quote author="meteor" date="1236537626"]libraries should not mix php and html[/quote]

I assume now that your talking about the _tag function. That's not really mixing PHP and HTML. That's PHP writing HTML. Is there a better way to do it? I'm open to ideas.

[quote author="meteor" date="1236537626"]Next. no tests are provided with your library, why ?[/quote]

I'm truly not sure what you're talking about. Can you give me an example?

[quote author="meteor" date="1236537626"]All in all this library presents not much value to me, there is a lot of code in it but not much is attained with it...I think this library is not much better than the assets helper [/quote]

I'm sorry you feel that way, but there's a simple solution: don't use it.

Thanks again for the feedback. You might also check out the newer (1.2) version of Carabiner.

#27
[eluser]meteor[/eluser]
Don't take me wrong man... Criticism is supposed to be constructive, I just mentioned what i did no like in your code Wink)
It could be good stuff in the future, but it definitely needs changes ... fingers crossed you will change a few things i have mentioned.
I do not use carabiner, I use my library dealing with document head stuff.. It takes just one config, one line to initialize data, and one line to return full document head related data ... Programming is supposed to make life easier, and let us forget about one written details...
Please provide unit tests for your code with next packages ... that's what is interesting form me ... tests instaed of code ...
I hope you have not take my words personally.
Good luck man

#28
[eluser]tonydewan[/eluser]
[quote author="meteor" date="1236543616"]Please provide unit tests for your code with next packages ... that's what is interesting form me ... tests instaed of code ...[/quote]

Do you mean performance test results? As in, improved page load times using Carabiner? If not, can you elaborate more?

Thanks!

#29
[eluser]meteor[/eluser]
phpunit tests or simpletest tests file at worst if you have one ... this way it will be easier to assess memory usage and general performance of your lib ... haven't looked into structure of this lib at an angle of testing, but i hope it is possible to test it as a stndalone code($CI-> ...).

Do you use anything to test your lib as a whole?

Sorry, I'm mad about tests because it is very difficult to add code or test new functionality without test for all methods and at least half of properties of libraries. Often people write something, release it, and ... well let others rely on code only ... I hate to use anything new without running test suite for the code first ... It is essential to me, it is better to find surprises as quickly as possible ... In this community nobody releases libs with tests, I can understand this as it comes to plugins, but libraries and helpers are standalone pieces of code, even if they are not, it is posible to separate them at testing time ... if you use a new library you do this on your own risk, without provided tests it takes hours to write new tests for bigger libs ...

As to html, i add html in views, as I said libs are for developers not for ordinary people, it is not that difficult to add some html in a view instaed of including it in the lin ... you might add your html as a property, what if someone wants to do something rare with the code ... In my opinion no html, javascript or anything else should be in php lib , i know it is difficult to obtain sometimes ... but this way you avoid situation when, lib has 800 lines and then you come up against a situation when your data is not atomic ...
Next , i think methods should not echo anything ... it is so simple to echo something outside a library that you should leave this to the code contained in a view ... this way you still have open road what to do with results of your methods ... results should be assigned to a property of the main object instaed of being echoed, you are using oop, so take advantage of possibilities it brings ...

Next, I don't like this line
$this->CI->load->helper('file');
this is going to make it more difficult to test your code, you should add this code to your library as a standalone method(s) ... or at least prepare your method for some extra returned external code by giving extra parameter to it.

Agian, when you use oop, why do you use return statement instaed of assign result of a function to a property of the main object ... this way your code will be more compact in places outside your lib, functional programming is good for C or Haskell, php5 brings some better possibilities ... use them ...

Regards

#30
[eluser]MindFeed[/eluser]
Hey that's awesome library, thanks for thinking about and creating it. I recently started using your library, except for first time when it cache the files, it has a drastic effect on JS/CSS transferring time.

Initially I implemented the library on stand alone server and it worked exactly what we have expected. But when we have tried it on Load Balancer, it failed because of different name of file on each server and request being distributed among several HTTP servers. By the way do you have any thoughtful way out to resolve Load Balancer issue ?

It will be great if you have any patch ready to implement this library on Load Balancer, looking forward to it.

Thanks,
Bhargav Khatana


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.