Learning the iOS 4 SDK for JavaScript Programmers: |
Author: Danny Goodman Introduces iOS4 development from the point of view of a JavaScript programmer - does it work? This is an interesting idea - a book that introduces iOS4 development from the point of view of a JavaScript programmer. Notice that this isn't a book about iOS4 development using JavaScript because such an approach is impossible. The main development language for the platform is Objective-C and JavaScript can only be used to create web apps that just happen to run on iOS devices. If you want to create a native application you have to code in Objective-C and there is no choice.
The book starts off with a look at "Why Go Native" which explains why you might want to take advantage of the hardware and run outside of a browser. It also discusses the cost of joining the Apple app store, what you get in return and how it all works. Chapter 2 deals with getting the SDK and installing it and Chapter 3 tells you how to create your first project. It is at Chapter 4 that the JavaScript approach starts to go a little wrong. The problem is that using Objective-C, Xcode and the SDK in general isn't very much like working in JavaScript. The application structure is quite different and more sophisticated and the language is classically object oriented, strongly typed and not at all dynamic. What this all means is that from chapter 4 the appeal to what you know about JavaScript becomes increasingly less helpful. By Chapter 7, which looks at the details of the C language, you should be getting the hang of iOS development and forgetting, JavaScript but it keeps being popped up to motivate what follows. Chapter 8 concludes the introduction to the SDK with a look at using Objective-C and Cocoa Touch. Chapter 9 forms a sort of cookbook of tasks but the big difference is that they are organised as how to do common JavaScript tasks in Cocoa Touch. So you format a number in JavaScript but how you do it in Cocoa touch isn't really related and so why organise things in this way? On the plus side the book does point out the big differences between working in JavaScript and Objective-C. For example, it explicitly tells you that you can use a C array with the sort of flexibility that you expect from a JavaScript Array object and this could well be useful. However the differences in the environment are so great that any programmer reaching page 151, where C arrays are introduced, still expecting anything much to be like JavaScript isn't really thinking about it. Another, and perhaps more important, problem with the book is that it is very focused on small tasks and not on creating whole apps. It also doesn't take you into many of the areas of the API that are the reason you decided to go with native app creation, i.e. there's nothing much on using the hardware. This is a slim book and can't cover everything, but you do need to know that you will need a second volume to get up to speed on creating more adventourous apps. Overall this is quite a good introduction to Objective-C and Cocoa but I suspect it would be even better if the link with JavaScript was removed. It's a nice experiment but one that ultimately probably doesn't work. On the other hand if you really only know JavaScript and feel that having the new compared with what you already know might be useful then give this book a try.
|
|||
Last Updated ( Thursday, 24 March 2011 ) |