PDA

View Full Version : Hopin' someone can provide a simple IPhone sample code




jerrywickey
Apr 16, 2009, 02:38 PM
I am just a lowly assembly language programmer and have not kept up with object oriented programming at all.

However, I have at least three very interesting pieces of software that could easily be implemented on IPhone.

I was reading up on XCode and the IPhone SDK and reading and reading and reading.... when I realized I am overlooking a huge resource.... You guys are expert and with my programming expirience, perhaps just a few short examples is all I need.

Would someone be kind enough to give me a complete IPhone Xcode project example this simple IPhone task.

Cause the IPhone to play a tick and a tock sound , each tone from a separate .caf or other sound file one second apart, repeating forever until a single stop button is tapped.

Shouldn't be more than a header file, a single button in a nib and a single method file

I have already provided two caf files. You will find two .caf files for download at www.satellitemagnet.com/tick.caf and /tock.caf

That way I learn how to declare the sound files, where to put them and which libraries or what ever XCode calls them, to use sound, how to implement a timer and how to implement activity from a button.

I have already checked out the example app metronome for this. And while it is simple to find the method coding for the sound, there are so many other things going on that I can identify where each resource is declared from all the other stuff.

This simple example might just do it for me.

Thanks so much

Jerry



danmwall
Apr 16, 2009, 02:52 PM
There are tons of great examples on http://developer.apple.com/iphone/. Check it out and good luck!

dejo
Apr 16, 2009, 03:01 PM
I think a combination of examining the code for SysSound and Metronome should be sufficient to get the basics of what you want.

jerrywickey
Apr 17, 2009, 08:20 AM
Thank you

It seems the correct answer is

http://developer.apple.com/iPhone/library/navigation/index.html

More reading through bunches of stuff I know to glean the little bit I don't.

That sounds bad:

I am sure there is loads of great stuff. I just don't need all that. I need some simple syntax to get done what I want to do.

If you don't want to hear an old programmer's rant, don't read another word.

On a different note. Coming from an entirely linear programming experience, I get the notion that NextStep and some of the other programming paradigms kinda ran away with themselves.

I have implemented an oporating system tolerant of any number of tasks running simultaneously with merely 8kbytes of assembler code. The entire operating system, which manages inturupts, keyboard, display and so forth as well as all other tasks ran as separate tasks itself, each submitted to the task manager just as any other task. The task manager itself is the first task submitted to itself at startup by the boot code.

Having done this, it just seems that object oriented programming gives me no advantage and yet imposes a great deal of syntax and unessesary structure. True structure must be intrinsic to the code. Like a work of art. True structure can not come from constraints placed by a compiler.

A sloppy programmer is still sloppy even when someone attempts to clean him up by imposing arbitrary compiler and language constraints by calling what is really code, object methods instead.

Anyone agree?

Jerry

jnic
Apr 17, 2009, 08:50 AM
The advantage of OOP appears when others have to work on your code (and vice-versa). Code can certainly be an art form, but from an engineering standpoint we need to be pragmatic.

A sloppy programmer is still sloppy even when someone attempts to clean him up by imposing arbitrary compiler and language constraints

Applies in all walks of life!

BlackWolf
Apr 17, 2009, 09:36 AM
Thank you

It seems the correct answer is

http://developer.apple.com/iPhone/library/navigation/index.html

More reading through bunches of stuff I know to glean the little bit I don't.

That sounds bad:

I am sure there is loads of great stuff. I just don't need all that. I need some simple syntax to get done what I want to do.

If you don't want to hear an old programmer's rant, don't read another word.

On a different note. Coming from an entirely linear programming experience, I get the notion that NextStep and some of the other programming paradigms kinda ran away with themselves.

I have implemented an oporating system tolerant of any number of tasks running simultaneously with merely 8kbytes of assembler code. The entire operating system, which manages inturupts, keyboard, display and so forth as well as all other tasks ran as separate tasks itself, each submitted to the task manager just as any other task. The task manager itself is the first task submitted to itself at startup by the boot code.

Having done this, it just seems that object oriented programming gives me no advantage and yet imposes a great deal of syntax and unessesary structure. True structure must be intrinsic to the code. Like a work of art. True structure can not come from constraints placed by a compiler.

A sloppy programmer is still sloppy even when someone attempts to clean him up by imposing arbitrary compiler and language constraints by calling what is really code, object methods instead.

Anyone agree?

Jerry

I agree with you that bad programming is just bad, no matter if you program OOP, linear or whatever.

OOP has a few advantages though, one of them was already mentioned: reusability. OOP code is extemly reusable, even through multiple projects. It's easily managable even with multiple programmers working on it. Second big advantage: data encapsulation. you have a string object, and all things you need to modify/change/access that string are in a single object. cocoa touch is extremly strict when it comes to this. this can be hard to code, but brings big advantages with big projects!

oh and btw: the basic cocoa touch syntax is learned pretty quickly. I learned it in only a day or two. the really BASIC syntax, I mean. and after that, you can simply use the documentation to find out about any APIs you need.

johnnyjibbs
Apr 17, 2009, 09:54 AM
Assembly code may be streamlined but it certainly isn't very user friendly!

I found Objective-C and Cocoa very easy to pickup in a couple of months from scratch. My previous experience of programming has been a dabble of AMOS Basic in the Amiga days and more recently SQL stuff.

Apple has some great documetation and reference resources explaining everything you need to know, plus a tonne of very practical examples that illustrate this code. Once you are familiar with the core Cocoa APIs, you'll start to see how nice it is to work with them!

firewood
Apr 17, 2009, 10:25 AM
I am sure there is loads of great stuff. I just don't need all that. ... 8kbytes of assembler code.

There are still systems that simple... maybe a $1 pic microchip. Compared to a coding for a old micro or a single user PDP-8, programming an full featured iPhone app is more in the direction of developing the network OS for an entire computer lab containing a CDC-6600 supercomputer with several dozen simultaneous users from different departments. There's lots of capabilities and stuff going on inside an iPhone, even if it's just sitting there.

firewood
Apr 17, 2009, 10:28 AM
If you don't want to write it yourself, and can spec out your sample code tightly enough, you can try to bid out the development of the code on some site like elance or rentacoder. Might only cost a few hundred.

ymmv.

dejo
Apr 17, 2009, 11:07 AM
I am sure there is loads of great stuff. I just don't need all that. I need some simple syntax to get done what I want to do.
So, you still don't think you are able to glean the info you need from what you've read? I think part of your problem is you want simple syntax for something that is not as simple as you would like it to be. I'd suggest you look at some tutorials / books to learn the basics of Objective-C and iPhone development and then you can revisit this issue when you are more comfortable with how things work. And a sloppy programmer may always be sloppy, but a good programmer welcomes an opportunity to learn new ways of doing things.

jerrywickey
Apr 17, 2009, 11:47 AM
Excellent replies.

Thank you so much.

And I do agree that by forcing programmers to conform to an arbitrary standard, everyone can easily use and reuse the same code.

But we kinda did that in the old days anyway. It was just the programmers responsibility to document arguments in and out.


firewood,

I thought about that. but, it is time, I learned this new stuff anyway. Besides, writing it my self is the only way I will get satisfaction from it.


dejo, you are very correct. Every good programmer learns from everything he does.

Perhaps you would be interested in taking me up on my other recent post

"Molecular biology..."

Jerry

lazydog
Apr 17, 2009, 03:09 PM
Thank you

It seems the correct answer is

http://developer.apple.com/iPhone/library/navigation/index.html

More reading through bunches of stuff I know to glean the little bit I don't.

That sounds bad:

I am sure there is loads of great stuff. I just don't need all that. I need some simple syntax to get done what I want to do.

If you don't want to hear an old programmer's rant, don't read another word.

...
Having done this, it just seems that object oriented programming gives me no advantage and yet imposes a great deal of syntax and unessesary structure. True structure must be intrinsic to the code. Like a work of art. True structure can not come from constraints placed by a compiler.

A sloppy programmer is still sloppy even when someone attempts to clean him up by imposing arbitrary compiler and language constraints by calling what is really code, object methods instead.

Anyone agree?

Jerry

No, I can't agree :)

Arbitrary compiler and language constraints? I see OO working on two levels: as a tool to allow the rapid deployment of tried and tested patterns and techniques, and 2nd as a way to facilitate the abstraction of new ideas. Both can be done in assembler but it is much, much easier and faster in something like Objective-C/C++. Anyway, unless I'm picking up the wrong message, why are you slagging off high level languages? From your other post on molecular biology it looks as though you must have programmed simulations before. Did you do them all in assembler?

b e n

jerrywickey
Apr 17, 2009, 04:41 PM
I understand where you're coming from Ben,

And I want to learn an object oriented language. I am just impatient.

I want to learn it now. Would you have some time to answer 10 to 20 questions over the phone? Each requires only a sentence or two.

Its just that tutorials teach: if you want to do this, type that.

While, I learn quickly with: here is a list of things you can do and exactly and unambiguously what each construct does.

Jerry

dejo
Apr 17, 2009, 04:48 PM
While, I learn quickly with: here is a list of things you can do and exactly and unambiguously what each construct does.
That exactly what the Developer Documentation & Class References do. However, as for being unambiguous, that only comes once you gain understanding, and even then, it will never be totally unambiguous. Think of it like this: the class references are like a dictionary but if you don't understand the language in the first place, it's meaningless. You could give me a Greek dictionary but since I don't know the basics of the language (syntax, grammar, etc.) I am not going to be able to put together even a sentence.

lazydog
Apr 17, 2009, 04:52 PM
I doubt I would be able to help you on the phone as I'm not very good at explaining things. Why don't you just post your list of questions. There are some very helpful people here and I'm sure you will get some excellent replies.

b e n

dejo
Apr 17, 2009, 04:59 PM
Why don't you just post your list of questions. There are some very helpful people here and I'm sure you will get some excellent replies.
Oh, yeah. I was gonna suggest that too, but got caught up in my whole dictionary analogy. One person on the phone may not be able to answer all your questions but I suspect the group of experts that frequents the iPhone Programming forum should hopefully be able to answer most of them. Assuming they are not questions like: "I need to fill an area in an image with a color. Can you give me the solution?" :D

jerrywickey
Apr 18, 2009, 08:11 AM
posting the questions never works.

It is exactly as lazydog suggests, people are often not very good at explaining things.

It is just like the game 20 questions. With only 20 bifurcated questions one can arrive at exactly 1,048,576 unambiguous differentiations.

The key to arriving at the ones I want is knowing which questions to ask, and each next question changes with each answer. I can guide the answers to exactly what I need to know in surprisingly few questions, regardless if the answerer is on track or not.

I am good at that. I even wrote an inference engine that chooses interrogations for a logic game and does so better than I.

In fact, for programmers, it would be a curiosity to just experience over the phone an example of inference by bifurcation.

Until, someone takes me up on it and invests 30 minutes on the phone, I will keep reading.

It seems that reading isn't the problem. Finding the material which contains the answers and sorting through it to find them is the time consuming part. And I really don't have that much time. Perhaps an hour a day and at that rate, this way will take me at least 30 days. I have already spent nearly 5 minutes just reading this thread and writing this reply.

I would much rather spend a half hour with someone on the phone who has this knowledge already in their heads and is able to retrieve it without sorting through hundreds of pages of text. I can drill down to it like a laser beam.

don't worry about not knowing the answers to some questions. I just go around that and find another way to the answer.

Jerry

lazydog
Apr 18, 2009, 12:41 PM
Jerry, I think you will find people very helpful on this forum so perhaps you will be able to speak to someone on the phone. However, I think you should start a new thread and post your first question and take it from there. Apart from making an interesting read, the whole point of having the forum is so that other people can benefit from reading answers to similar questions that they may have. A telephone call may be the most beneficial to you but it isn't of much use to other people learning OO programming :)

b e n

firewood
Apr 18, 2009, 08:58 PM
Did you get someone to play 20 questions with you?

If not, why not post your question here and see if we can help you in the direction of an answer in 19 questions or less?

ymmv.

CocoaPuffs
Apr 18, 2009, 11:18 PM
Jerry = Nigerian Prince.

lazydog
Apr 19, 2009, 04:40 AM
Jerry = Nigerian Prince.

LOL - yes I never thought of that! Makes sense.

b e n