Showing posts with label iphone. Show all posts
Showing posts with label iphone. Show all posts

Sunday, May 17, 2009

Loopy for loops.

Well, so far we have created programs that basically repeat what we say, "hello world."
or a program that can add 3 to 3, together.  Not bad, but these programs are a bit simplistic.
Like all programs the execute their functions the close.  However to make things more interesting, we need to make a program to will continue to run until we tell it to stop.

How do we do that? We do that with loops.
Loops is when the program restarts after completing its' primary function.  It would go back to designated points in the program, like the beginning of the program or function.  

We will investigate a few of these loop functions. 
The ones we'll look at include the "if", "while" and "for" loops.

The "if" function is not really a loop, but I put it in this category since it does direct the flow of the program.  Essentially you are using "if" to state that if something happens the program will do something else.  Like if the football game is on, then I'll watch.  Of course you can make it a bit more complicated.  If the football game is on, then I'll watch, but if it is not then I'll watch something else.   

Let's look at some code to see this in action.

#include stdio.h                         (our rules or parameters)
int main                                      (beginning of our program)

{int myNumber;                        (declaring my variable)
my Number = 1                       (establishing myNumber equals to 1)

if (myNumber == 2)                       (saying if myNumber is equal to 2)
printf ("myNumber is equal to 2");       (then print "myNumber is equal to 2")
else 
printf ("myNumber is not equal to 2");   (or else print "myNumber is not equal to 2")

return 0;}                     (end program)

"if" and "else" introduces the concept of true and false.  The computer will see either the state is true or the statement is false.  By doing this we can direct the program to do what we want by manipulating what happens when the computer encounters the true/false.



Not bad.  Now we can more deeply into loops, if you do not understand it, re do this part again.  It's important.  


I think I'll split this topic into two post, since
1) It is important
2) It's a big subject.


Wednesday, May 13, 2009

Day 1. Gathering the resources

I decided to make a blog chronicling my adventures in making an iphone app.  

First: A little background, I have no programming experience what so ever.  I did enroll in a beginning programming course in college but had to drop it due to conflicts with other classes.  I find this task quite daunting, since the programming language is as foreign to me as a language from another country.  My career is in the medical field.  I love my Iphone and love all the applications for it.  I wanted to make an app and put it in the app store, not only for the monetary gains, but mainly I wanted to expand my horizons.  I always wanted to make video games, since that is one of my main hobbies.  Learning to make an iphone app, will be a means to that end.

What I have gather so far.
I suggest those that want to dip their toes into programming, you should check out a website call Tilestack.com.  I program one stack called Mr.Sage.  That was my first programming effort of any kind.  Tilestack lets you play around in a environment that is more friendly to someone who knows nothing of programming.  It takes most of the intimidating coding out of it.  Infact if you make a stack good enough, they would even publish it in the iphone app store.  There are draw backs, since if you publish onto Tilestack there are chance people can steal your idea, as I found out.  And often times what you think is a good stack does not correspond with others, and your stack may not be publish.  But as a start, I find it a great tool to know the basic of programming.

Books:  I bought these books since I did a quick google search, and they seem to be the most recommended.

1)Learn C on the MAC by Dave Mark, publish by Apress
I find this book pretty easy to understand and it was written with people who have no experience in mind.  I have read this book through and was able to accomplish so of the simple programming.  The book becomes harder to read about half way through, but stick with it.  I had to reread it several times already.

2)Learn Objective-C on the Mac by Mark Dalrymple / Scott Knaster, publish by Apress
I only started to read this book, since it just came in the mail from amazon.
So far, some of the the things, I learned from the first book, carries over to this, but it is a bit more difficult to follow.  Probably will have to take it slow....really slow.

3)Beginning iPhone Development: Exploring the iPhone SDK by Dave Mark/ Jeff LaMarche, publish by APress.  
I have read only the first two chapters, from what I know this will probably be difficult to follow if I do not understand objective-c (which I don't yet).  This seems quite a bit different from C language, but we'll know more once I go through the book in more detail. 

WebSites:
So far the best website I found is iPhone development Central.  They have video tutorials, though I find most of them difficult to follow from a non programmer perspective.  I decided to join their forums since they appear to be a community of programmers from different level of expertise.  Some of the members are friendly and would gladly give a helping hand to newbies. 

Another great website is called Masters of the Void.  This is essentially learning C, but in a more truncated form.  If you do not want to buy the book, this would be the first step I recommend.  

Well, That's it for now, back to reading and programming.