4 ms·
Why waste time learning to use JS on the iphone, when you may as well just write the app in C++ or Obj-C? At some point, you'll need to go native, and then you'
by markessien 18y ago
Why waste time learning to use JS on the iphone, when you may as well just write the app in C++ or Obj-C? At some point, you'll need to go native, and then you've lost a portion of your time-investment. Instead, just learn it properly, and you can always do things.
- bootload 18y ago"... Why waste time learning to use JS on the iphone, when you may as well just write the app in C++ or Obj-C? ..." Answered the Q right there. "... It's pretty obvious that in order to be able to build the best possible iPhone application you would have to know Objective-C. Having a clear path, paved with JavaScript, to that end result should be any JavaScript developer's goal ..." I can see a time that the browser on the iPhone will be a nice WebApp platform without entirely having to "go-native" (but still understand).
- boucher 18y agoThere is a large class of applications for the phone that do not need to be native. I'd guess (unscientifically) that its about a third of the apps on the app store, and probably growing.
- markessien 18y agoThat's not the point. There is a large class of desktop apps that could be programmed in Javascript also. The point is - why would any developer or any development studio bother with investing time and effort in learning Javascript for the iPhone, when you can just invest the time in learning how to use C++? Using Javascript will give you a short-term boost, but at a long term cost. And at some point, when you do switch to the native API, you need to restart learning. The difference in using C++ and javascript on the iphone is pretty small - they have similar syntax and organisation. C++/Obj-C actually has some advantages in terms of speed, because of the much larger availability of sample code and tools to work with it. And of course, there is the native vs intepreted advantage of C++ code.
- tlrobinson 18y agoPerhaps the developer already knows JavaScript. Also, I'm not sure where you got the idea that you can write iPhone apps in C++, you can't, the API is almost entirely Objective-C and some straight C (though there may be a few C++ APIs)
- markessien 18y agoYou only need to write the gui parts in Obj-C, you can write all the logic of your application in C++.
- tlrobinson 18y agoYou'll have a single code-base for multiple platforms (iPhone, Android, web, even desktop with something like Adobe AIR) The interface may be tweaked to fit the format of each platform, but the application logic (which is likely the complex part) will be entirely the same.
- Tichy 18y agoWell to push the nasty programming aspects as far out to the edge as possible and be able to do most of the programming in a pleasant programming language. And the common code base for porting is another factor, too. I don't see a great future for Objective-C, but being really good at Javascript seems like a safe bet for a useful skill.
- river_styx 18y agoWhat in particular do you find unpleasant about Objective-C? I find it quite a nice language to work with, actually.
- Tichy 18y agoSo far I have only read the tutorials to some extent. I don't like that there is no garbage collection on the iPhone, and that I have to write header files. The pointer stuff looks suspicious, too, but I have not read far enough to know how awful it will be. I seem to remember that Joel On Software wrote once that garbage collection gave one of the biggest productivity boosts modern languages provide. Oh, another thing I don't like is the stupid hungarian notation of the API. Also, it seems kind of pseudo-dynamic: if it is dynamic, what is the point of header files and interfaces? It doesn't make sense to me.
- jws 18y agoHeader files are a blessing. They move many bugs from runtime to compile time. The point of the header file is to make a contract. Sometimes that isn't appropriate and there you can "go dynamic" if you need to, but you are moving your errors to the runtime. The retain/release model of object lifetime management in Objective C becomes nearly automatic for the programmer. That being a dangerous "nearly", you can still screw up. Garbage collection is much nicer, but given the limited memory I can understand why they didn't enable it on the phone. Remember: You can screw up badly with garbage collected systems too, it just doesn't result in a core dump on a desktop machine. You can accidentally leave references to objects you will never access again (cache structures are notorious) preventing it from being reclaimed. On a desktop that leads to a bit of memory bloat and maybe some swapping if the app runs long enough. On an iPhone you run out your RAM and get terminated.