Great feedback, Rob. I'm not a coder so I wouldn't know about this
stuff....perhaps he should start a forum on his site specifically for
Jaipho.

On Sat, Mar 28, 2009 at 7:51 AM, RobG <[email protected]> wrote:

>
>
>
> On Mar 26, 7:28 am, Tole <[email protected]> wrote:
> > Hi all,
> > Some 8 months ago (3G release in Europe), I was programming the iPhone
> > optimized news portal (based on iui, off course), and I had to
> > implement gallery feature too. I was very surprised when I realized
> > that there is no usable javscript component. So, I had to create quick
> > and dirty workaround solution.
> > Few months later, I decided that I'll make that kind of component, and
> > now, here it is.
> > It is called JAIPHO (Javascript iPhone Photos), and by functionality
> > it attempts to be close to original iPhone Photos application as much
> > as web can offer. It is written in javascript so it is easy o
> > implement. Also to mention it is in beta release and published under
> > LGPL.
> >
> > Ok, that's it. Hit me ;)
> > I would like to hear group opinion
>
> 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);
>
>
> 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.
>
> If you want an object, use an object.   Don't use arrays where an
> object should be used.
>
> 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.
>
> 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.
>
> There is like quite a bit more that can be improved.
>
>
> --
> 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