Welcome Guest, Not a member yet? Register   Sign In
Carabiner 1.0: Asset Management Library
#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


Messages In This Thread
Carabiner 1.0: Asset Management Library - by El Forum - 01-28-2009, 07:23 PM
Carabiner 1.0: Asset Management Library - by El Forum - 01-28-2009, 07:30 PM
Carabiner 1.0: Asset Management Library - by El Forum - 01-28-2009, 09:26 PM
Carabiner 1.0: Asset Management Library - by El Forum - 01-28-2009, 09:56 PM
Carabiner 1.0: Asset Management Library - by El Forum - 01-28-2009, 10:07 PM
Carabiner 1.0: Asset Management Library - by El Forum - 01-28-2009, 10:16 PM
Carabiner 1.0: Asset Management Library - by El Forum - 01-28-2009, 10:24 PM
Carabiner 1.0: Asset Management Library - by El Forum - 01-28-2009, 11:26 PM
Carabiner 1.0: Asset Management Library - by El Forum - 01-29-2009, 12:48 AM
Carabiner 1.0: Asset Management Library - by El Forum - 01-29-2009, 04:58 AM
Carabiner 1.0: Asset Management Library - by El Forum - 01-29-2009, 07:23 AM
Carabiner 1.0: Asset Management Library - by El Forum - 01-30-2009, 05:47 AM
Carabiner 1.0: Asset Management Library - by El Forum - 01-30-2009, 03:22 PM
Carabiner 1.0: Asset Management Library - by El Forum - 02-01-2009, 12:35 AM
Carabiner 1.0: Asset Management Library - by El Forum - 02-01-2009, 04:28 AM
Carabiner 1.0: Asset Management Library - by El Forum - 02-02-2009, 08:44 AM
Carabiner 1.0: Asset Management Library - by El Forum - 02-02-2009, 08:54 AM
Carabiner 1.0: Asset Management Library - by El Forum - 02-06-2009, 12:07 PM
Carabiner 1.0: Asset Management Library - by El Forum - 02-06-2009, 04:00 PM
Carabiner 1.0: Asset Management Library - by El Forum - 02-07-2009, 01:06 AM
Carabiner 1.0: Asset Management Library - by El Forum - 02-09-2009, 01:11 AM
Carabiner 1.0: Asset Management Library - by El Forum - 02-11-2009, 09:12 AM
Carabiner 1.0: Asset Management Library - by El Forum - 02-13-2009, 02:31 PM
Carabiner 1.0: Asset Management Library - by El Forum - 02-13-2009, 03:05 PM
Carabiner 1.0: Asset Management Library - by El Forum - 03-08-2009, 07:40 AM
Carabiner 1.0: Asset Management Library - by El Forum - 03-08-2009, 08:57 AM
Carabiner 1.0: Asset Management Library - by El Forum - 03-08-2009, 09:20 AM
Carabiner 1.0: Asset Management Library - by El Forum - 03-08-2009, 09:46 AM
Carabiner 1.0: Asset Management Library - by El Forum - 03-08-2009, 10:38 AM
Carabiner 1.0: Asset Management Library - by El Forum - 08-25-2009, 04:00 PM
Carabiner 1.0: Asset Management Library - by El Forum - 08-27-2009, 06:39 AM
Carabiner 1.0: Asset Management Library - by El Forum - 08-27-2009, 07:46 AM
Carabiner 1.0: Asset Management Library - by El Forum - 08-26-2010, 01:00 AM
Carabiner 1.0: Asset Management Library - by El Forum - 08-26-2010, 07:58 AM
Carabiner 1.0: Asset Management Library - by El Forum - 08-27-2010, 01:54 AM
Carabiner 1.0: Asset Management Library - by El Forum - 08-27-2010, 02:04 AM
Carabiner 1.0: Asset Management Library - by El Forum - 08-27-2010, 05:33 PM
Carabiner 1.0: Asset Management Library - by El Forum - 08-27-2010, 08:37 PM
Carabiner 1.0: Asset Management Library - by El Forum - 08-28-2010, 09:53 PM
Carabiner 1.0: Asset Management Library - by El Forum - 09-11-2010, 05:35 AM
Carabiner 1.0: Asset Management Library - by El Forum - 08-22-2012, 08:09 AM
Carabiner 1.0: Asset Management Library - by El Forum - 11-09-2012, 07:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB