iPhone application development - Native app vs Web app

Pros and cons of a web app over a native app from a web developers perspective

Native app

Pros:

  • Millions of registered credit card owners are one click away.
  • Xcode, Interface Builder, and the Cocoa Touch framework constitute a pretty sweet development environment.
  • You can access all the cool hardware features of the device.

Cons:

  • You have to pay to become an Apple developer.
  • You are at the mercy of the Apple approval process.
  • You have to develop using Objective-C.
  • You have to develop on a Mac.
  • You can’t release bug fixes in a timely fashion.
  • The development cycle is slow, and the testing cycle is constrained by the App Store’s limitations.

Web app

Pros:

  • Web developers can use their current authoring tools.
  • You can use your current web design and development skills.

Read the rest of this post »

jQuery multiple selector

This is a feature included in jQuery API v 1.0+. I have noticed this when I was working on multiple select boxes which has to do the same job on its onChange event. When I noticed that the code seems a bit ugly -

$('#start_time').change(function(){        showTimeDiff();});
$('#end_time').change(function(){        showTimeDiff();});

Then I implemented Multiple Selector feature to avoid the repetition of showTimeDiff() function call

$('#start_time, #end_time').change(function(){        showTimeDiff();});
and this is a simple alternative for the above repeated function call.

Introduction to Object Oriented JavaScript

Lets see how can we write JavaScript object oriented with a simple example.

(function(){
         // Initialize namespace
         window.foo = window.foo || {};

         // create a class named alerts for foo
         foo.alerts = (function() {

                 // here you can write the constructor stuffs
                 var windowAlert = "this is window alert";                //instance variable
                 var anchorAlert = "you clicked on anchor tag";         //instance variable

                 return {
                         // write member functions here
                         showWindowAlert : function() {
                                 // this is a member function
                                 // and can be called as foo.alerts.showWindowAlert();
                                 alert(this.windowAlert);
                         },
                
                         showAnchorAlert : function() {
                                 // this is anoter member function
                                 alert(this.anchorAlert);
                         }
                 };
        })();
})();

This JavaScript will be called in page load. To call fist member function showWindowAlert(), you have to call like this,

foo.alerts.showWindowAlert();

The second function showAnchorAlert() can be called like this,

foo.alerts.showAnchorAlert();