Hi Rob,

First, thanks for realy great feedback. I realy apriciate it, and I
will implement most of the things you mentioned.

Second, I'll try to excuse myself just a bit.
Yes, there are more things that could be improoved and optimized.
Actualy that is my way of programming - something like getting real
philosphy. I'm trying to cover all project requirements in firts stage
at any cost. In this phase I'm also concentrated on interfaces but the
implementations are something I don't spend much time on. Anoher thing
I try to do is to copy/paste optimize which explains useles lines like
"var str = '';"
My last independent project took me 3 years of development and at the
end I didn't even published it. So with this one I didn't wanted to
make that mistake.

> I think it could do with quite a bit of work to clean up the code.
>
> I don't understand why eval is used, e.g.
>
>  var str        =       '';
>  str += 'var ret = master.' + method + '(e, argument);';
>  eval( str);
>
> The first assignment to str is useless, the two lines are equivalent
> to:
>
> var str = 'var ret = master.' + method + '(e, argument);';
>
> All 3 lines can be replaced by:
>
>   var ret = master[method](e.argument);
>

Tried, and works perfect!

> 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. 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.
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.

> 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.

> 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.

> Similarly, there are calls like:
>
>   var arr = this._GetArray( this.maListeners, name);
>
> where _GetArray is:
>
> obj._GetArray = function( arr, name) {
>   if (arr[name] == undefined)
>   arr[name] = new Array();
>   return arr[name];
>
> }
>
> consider:
>
>   var arr = this.maListeners[name] || [];
>
> No function call, no simplistic _GetArray method.
>
Yes, that is one of "dirty" implementations. But anyway working inline
solution is:
var arr =       this.maListeners[name] || (this.maListeners[name] = []);

> There is like quite a bit more that can be improved.
>
> --
> Rob


Thanks again for feedback Rob

Tole
--~--~---------~--~----~------------~-------~--~----~
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