On Mar 29, 1:28 am, Henry Blackman <[email protected]> wrote:
>
> I've been  
> looking for something like this for a while, and whilst I would have  
> preferred it to use Prototype and Scriptaculous,

I would strongly recommend against that.  There is no need to create a
dependency on 300KB of scripts for no useful purpose.  As written,
JAIPHO will not work if those scripts are included in the page.

[...]
> In terms of use, what license are you using?

The home page says "Published under LGPL".

[...]

> >> Don't do for..in iteration over Arrays, it is known to be problematic
> >> if you ever intend to extend Array.prototype or use other people's
> >> code in the same page as JAIPHO.  At the very least you could include
> >> a hasOwnProperty filter.
>
> > Uh, I like for..in iteration so much.

There is no problem with for..in per se, only using it with an array.
Javascript is s simple language, everything is an object, even
primitives mutate into objects when necessary.  That simplicity
shouldn't be abused.


> > Right now for jaipho, there is
> > no rush to make it another way. It hardly can be mixed with someone's
> > code in same page because it takes whole page for itself.

There are many developers who will include all scripts in every page
for simplicity on the basis that they are downloaded once and cached
after that.  One of the first goals should be to ensure your code
works regardless of what other code is included in the page, so don't
modify built-in or host objects and write your code as if you expect
others might have.

> > But I'm considering another approach anyway. Few months ago I had that
> > kind of incident on my day job, when colleague of mine included
> > scriptaculous in project we were developing.

Scriptaculous is dependent on Prototype.js, which adds methods to
Array.prototype, which will break your code.


> >> If you want an object, use an object.   Don't use arrays where an
> >> object should be used.
>
> > Yes I agree. This will be fixed soon. I'm fan of OOP and I had lot of
> > argues with my PHP colleagues which are using associative arrays for
> > almost all kind of data they are using in projects.

An issue that often occurs when developers come from a language they
know to one they don't is that they try to coerce the new language
into the same patterns as the other.  That was a motivation for
Prototpye.js and has resulted in it being a good way to waste CPU
cycles and bandwidth.


> >> There are functions that should be primitive values, e.g.
>
> >> JphUtil_Console.prototype._GetStyleHtml = function()
> >> {
>
> >>        var str         =       '';
> >>        str                     +=      '<style>';
> >>        str                     +=      '.console';
> >> [... 23 lines snipped ...]
> >>        str                     +=      '}';
> >>        str                     +=      '</style>';
>
> >>        return str;
> >> }
>
> >> That function re-creates the exact same string every time it is
> >> called, it is a very inefficient way to go about providing a static
> >> variable.
>
> > Yes and no. "Every time" in this case is actually only once per page
> > load.

I was commenting mostly on the strategy of using a function to return
a string that should be held as a string variable.  That particular
string should be in the HTML as a style element.


--
Rob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"iPhoneWebDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/iphonewebdev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to