Life Cycle in depth...

Dear Readers,
I hope my last blog was exciting enough for you to get till here. Remember, you can always ask me anything (in comments) or correct me or give some constructive feedback or even discuss some relevant topics, so we could be up-to-date on the latest things going on.I would love to hear some great feedback!
Let us look at the lifecycle right here:

As shown in the figure, the application lifecycle goes through 6 stages.

Launch Application:
It is the first stage where the application is launched(obviously).How does it go through this stage is something we have to deal with in detail.


Application Initialization:
This is the stage where the application reaches the most important phase of its lifecycle where values and functions associated with its parameters come to life.

Load Main Nib/Xib:
Loading of the main nib file or xib file takes place in this stage, where the main view of the whole application is set for loading the interface for display.

Wait for event:
This is the in-line stage where the given functions wait for the event to occur or as some of you might say, where the target wait for the event to be triggered so as to take the associated action.

Handle Event:
This is the stage where the actual action associated with the event is handled and executed, or as you might say, this is the heart of the application.

Exit Application:
Finally when all the events are taken care of and the actions executed, and the user decides to close the app., all associated actions like release etc are executed and the application finally dies out/closes.




Life Cycle of an iPhone

Hello Readers,
Today on Thanksgiving, I decided to write a new blog for all the things we can be thankful for...
Family
Friends
iPhones :)
While we surely get to meet our friends and family often and learn more about them at some point of our lives, do we get to learn in depth about our iPhones?
or let me reframe the Question, do we know the Architecture of our iPhone really well?
Let's begin with a few basics of Architecture...(Warning: This blog is going to be all informative and amazing, so be prepared to read a lot here! nonetheless, I shall try my best to make it as interesting as possible)
The iPhone internal structure is made up of 4 layers( like 7 layers of web platform)
1) Core OS( the bottom layer)
It comprises of OS X Kernel, Power Management,MACH 3.0(UNIX Based, actually iPhone uses UNIX based platform,surprise!!), Keychain,Access,BSD,Certificates,Sockets,File systems,security,Bonjour(we shall see these in depth as we tread along our iPhone journey)
2)Core Services(the second most layer from the bottom)
It is made up of Collections,core-location,address book,net services,threading,networking,SQLite,File Access,Preferences,URL Utilities(note that this layer uses object oriented scenario and uses mechanisms like grand central dispatch for threading, and can also be used to open HTML and related pages and guess where your location is at etc etc)
3)Media (ipod /player at heart)
It consists of Core Audio,Image formats(jpg,png,tiff),Quartz(2D),Audio Mixing, Open AL,Open GL ES, Video Playback.
4)Cocoa Touch(top most layer)
It is very very object oriented. It uses multi touch,alerts, core motion(eg accelerometer, gyro etc) Web View, Map Kit, Localization/Internationalization,View Hierarchy,Image Picker,Controls,Camera.
We shall relate all of these terminologies with the iPhone apps we create later on, one by one, in a fun filled way!
Beginning with the platform Elements or Components,
The Tools we need for iPhone application development are:
XCode( which is an IDE as discussed in my previous blogs, more or less like dreamweaver),
IB(Interface Builder)
[Common myth about Interface builder is , using it not a good programming practice as it might create a confusion about how things work out in the end, but it is not always true, until your project is humongous and complex, then it's best not to use an interface builder],
Instruments
Usually used for Managing Memory, finding out leaks in memory and such.
The Language employed would be Objective C( you can also use hint of c /c++, if you're really good at that, along with objective c we do use JScript and associated libraries,HTML,Basic SQL(SQLite), JSON, and other light languages either to enhance the effect or make programming easier)
The Frameworks involved are: Foundation/Core Data/Mapkit/UIKit/Core Motion etc etc.
Now let us take a close look at the iPhone app Design.


Now now, the diagram has a few limitations, which we shall discuss eventually as we tread along.
Now model class is basically a "what-where-when" class, which means, it basically takes care of objects, in the way they are, not how they are, say suppose, you have a game application for a ninja game, you ask what are the names of the ninjas, what ninjas are present( a,b,c) , where are they present, when are they present, not how
Never ask a how based question to a model class, as it deals only with the what scenario of objects at hand. It is very important to understand that a model DOES NOT communicate with the controller at all, it is like a slave who listens to instructions of the controller and carries them out, It has a small Notification/KVO(Key value observing) signal which alerts and updates the controller about the changes or alterations in its contents( suppose say a ninja dies and is removed from list or level has changed etc)
This scenario of observations is termed as 'tune-in' mechanism.
Moving on to the controllers, we find out that it is the heart of the app,It takes care of all activities involved,which include controlling the view and model and letting them know HOW to perform those set of activities.A controller sends instructions to both model and view and it is responsible for the working of objects, In grammatical sense, a model is the noun and a controller is the verb which a view is the adjective.
A controller basically takes care of UI Logic
It has a radio station signal through which it receives the updates from the model.
The view is a minion of the controller, it displays the UI contents ( like buttons, test boxes etc)
It is the human readable/viewable interface on your iPhone, and it is not allowed to communicate with the controller entirely( only in 3 ways though)
Target-Action : Having a target set on the controller and through action get to that target alerting controller what action has taken place, whether a button was clicked or a a name was placed in the text box.
Delegate: As I mentioned delegates technically in my previous blog, in the architectural sense, it means A delegate is like a representative which lets the controller know what it did or what it should be doing upon completion of certain activity( say view did load then do this , or certain buttons should appear upon completion of certain activity)
Datasource: Views do not own data they display. They take care of data at or count by asking the controller for it, (eg : say it asks the controller give me data at row 6 or 8 etc), for this a datasource on controller is defined which fetches the data for it, thus restricting communication with the entire unit, more so a blind communication. Views are like dumb units which just do things as instructed, how it is done, is none of their concern.
In iPhone you have to carry out memory management yourself and as mentioned earlier it uses Objective C extensively which means it relies on dynamic binding extensive unlike c/c++(dynamic binding simply means whatever code is executed is not seen until it is actually sent at runtime)
Protocols like delegate and datasource help greatly with the process of dynamic binding.
We shall see all of these in action in the upcoming tutorials.
In this way life of an iPhone app starts with the very basic model part ,goes through controller phases, back and forth and displays the output on the view, where it ends, once the user decides to exit the app.
This pretty much covers the base lifecycle of an iPhone in depth, we shall see more of life cycle and more exciting things with apps and I shall provide the code for a few apps I make in the upcoming blogs!
Stay "tuned-in"!!!
and don't forget....

With Love and respect,
Vishwan Aranha

Big iPhone terms made small!

New comers in the iPhone field have a hard time understanding the terminology, that has all the Technical mumbo-jumbo, the play hard definitions which do not make sense at all and the supremely complicated code which keeps everyone wondering...



Let us go over the most important terms a step at a time, you can even check out apple's documentation if you're interested in the high tech stuff!
Click here to see the apple documentation page
If you're a junior iPhone developer, people you come across will usually ask you these set of questions, when you go for an interview which is termed technical but is purely conceptual( sorry I do not consider conceptual interviews technical, it's for book worms, not for creative people like me )
What is a delegate?
In basic terms it means a representative... someone that represents a group/category or class. In iPhone terminology, it is the same, it is a representative!
I would say it is an object( say a postman 1) that another object(another postman 2) sends messages to when things happen(say mail is delivered from one post office to another) , so the delegate can handle app specific details( like a postman 1 can handle the address details to deliver the mail), the original object wasn't designed for ( not postman 2's job) . It's just a way of customizing(changing) behavior without sub-classing( without making additional categories in the code).
There simple enough!

Where do we use delegates in Xcode? we use it in classes that we create, which got to have access to certain parts of the classes we defined earlier, more like a son borrowing car keys from his dad, to have access to his car ( big object) or house keys.
There are a lot of other terminologies involved, but I can only go through the most basic one's , rest of them you can handle yourself!:p
What is a framework?
A framework is a hierarchical directory that encapsulates shared resources such as dynamic shared library, nib files, image files, document strings and reference documents, in a single package( in plain terms, it is a box full of goodies, which when opened and used correctly can help you perform the function that you desire to have in your final output, more aptly)
Multiple apps can use these resources simultaneously.
getting more technical here, I would state that a framework is also a bundle and it's contents can be accessed using core foundation bundle services with a cocoa NSBundle class ( if you don't have any idea about what I said, you need to go through the documentation and understand the basic terms, and then come back and enjoy this blog :))

Now ladies and gentlemen and people in between!
These frameworks, come in handy, these are collectively termed cocoa frameworks(which are application programming interfaces to handle much of the complex data), never mind the complex words I used.
Remember that UI(user interface) kit frameworks are used for interface designs like buttons/text boxes/ colors etc etc, most basic elements you need to create output like html forms( with all the simple silly details to be filled in )
Similarly there are other frameworks like core graphics frameworks, foundation frameworks, Audio Video(AV) foundation frameworks, etc and the list is too long ,which help you design and add effects to your iPhone applications. This is why I think if you understand the working of basic frameworks, you know half of iPhone design, rest depends on your use of adobe suite and implementing them in Xcode.
There are many other terminologies to discuss, but I don't want to make this blog lengthy and boring, if you don't understand any definition in the documentation.. just drop it in ,in the comment box below and I shall try to explain it to you in the best way possible...
Stay tuned for my new upcoming blog, It's about "Life cycle of an iPhone"(how things work around in the iPhone world)
Until then...

With Love and Respect,
Vishwan Aranha!

Going about iPhone and Web Development

Hello Readers!
As ye all know, I have been a web developer and a programmer for quite a while, It was the same until I discovered the new iPhone Technology which revolutionized my life to an extent. Maybe I over exaggerated a bit, but hey! I love to make things work and create designs and code that make lives easier in some form or the other.
 I have ranted enough for now! Let's get started with the basics. Why switch from being a web developer to an iPhone developer. It's been almost over a year since I have been working as an iPhone developer making quite a lot of applications everyday!
It's like I eat, sleep, wake up with iPhone Applications. I am almost addicted!!!( gotta have me in for a iphone drug test, anyone has any app for that yet? lol jk?)
Alright, Alright! I know I got distracted again. Getting back to the topic!
Web design and development has a basic pattern which is very similar to iPhone. Any layman who has knowledge about dreamweaver can easily confuse it with XCode IDE, with the exception of not having a design display. Coding in Xcode is not as simple and easy, but when you see the finished product, it's all worth it. iPhone follows a similar Usability/Accessibility Analysis approach, with a few variations of course, followed by the common implementation procedures based upon a layer of design associating them both to give us the finished product which is supposed to look wonderful! ( in most cases where you are willing to understand new creative ideas)
Hey! Stop yawning! Let's make it more interesting with pictures and videos!
Let's start with Did you knows...?
Did you know that some kids are excellent iPhone developers ( well as far as basics are concerned, they are not complex coders, but impressive)
Here is a kid with youtube id 'simple SDK' who is teaching us adults how to start ( not to be abrupt, i did take my basic lessons from him aswell, so hail simpleSDK)


Impressive! Isn't it, but that's for amateurs. ( I was one too, once upon a time!)
Moving forward, let me show you a screen shot of my very first basic app, Glatt Mart's Weekly sale app.
This app works as follows:
Grocery Items for Sale:

Meat Items for Sale:

Produce Items for Sale

Sushi Items for Sale

Takeout Items for Sale


As you can see,There are different sections of items for sale every week, customers can see the items they like, and then tap of the item of their choice ( say groceries: glatt mart beef franks for instance , as in first screen shot)

and... as you can see, It will display the price of that item, along with name and quantity , with options to follow on facebook/twitter or even visit the website to shop online through iPhone.
Customers can even rate the apps which is then stored in our database, so we can figure out which item's are most rated and put them on sale every week,to increase our sales.
Not only that, we can even figure out the time period of the sale by clicking on the icon at the top of the menu display :

Thus, making it a valuable resource for the shops who enhance weekly sales online or through iPhone's.
I shall add more features to this app eventually. for now I have kept it simple for demo purposes, I shall even introduce my more technical and highly detailed apps in the future and explain the basic code, including the patterns of usability and Accessibility analysis, and how to go about it in a simple and well defined way, to have a flawless product, which will look complex, but will be easy to program once you get the hang of it.
If you like my blog, subscribe to it, and I shall keep you posted on my new upcoming blogs which will deal with design patterns and structures that will impress the customers and add more educational value to the content at hand!
Au Revoir mes Amis ,
until next time ...

Love and Respect(Technical of course),
Vishwan Aranha!

Followers

Vishwan Aranha. Powered by Blogger.