Thoughts on the iPhone SDK 1
So, I downloaded the free version of the iPhone SDK. It comes in at a whopping 2.1 GB so it took about 20 minutes to download.
After extracting it, the README has this to say:
- It requires about 5.3 GB for installation.
- It requires OS X 10.5.2 on intel machines (some claim that it can work on powerpc as well).
There is the option to keep Xcode 3.0 and Xcode 3.1 Beta that comes with the iPhone SDK on the same machine. I did not choose this option so it replaced my original developers tools (meaning that I did not need to sacrifice extra disk space at the expense of a possibly buggy beta version Xcode 3.1).
I tried some of the sample apps from the iPhone developer site (it uses a generic URL of http://developer.apple.com/iphone/samples/index.action which checks to see if you are authenticated).
Here are the ones that I tried:
- Kalimba - Supposed to be a replica of an African thumb piano. We should be able to strike each bar and have a musical note sound. It failed miserably on the iPhone simulator -- sound will not play and the piano refused to rotate to landscape mode. See this thread. Here's a picture to show what I mean:
- Jigsaw - Just a simple jigsaw puzzle. Works fine.
- TheElements - Shows the periodic table with the possibility to view each element's page on wikipedia. When I clicked on the link to wikipedia, the simulator crashed gloriously -- no warnings, no output to console. It just crashed. After some playing around, I discovered that it crashes when you run it immediately after it opens up in the emulator. Instead, if you go to the home screen and then activate TheElements application, then opening a link would work!
- GLGravity - Draws the canonical OpenGL teapot and allows you to rotate it by rotating and tilting your iPhone. This refused to run on the simulator -- claiming that it needs to run on an iPhone.
This is one of the examples for the iPhone SDK. Unfortunately, it does not seem to work properly on the simulator – sound doesn't work and it refuses to rotate into landscape mode.
I have to agree that the iPhone SDK has a lot to offer. If you don't believe me, just watch the video. The demo comes on at about 30 minutes through. It's akin to writing for a mini version of OS X with the addition of an impressive user interface, multi-touch control and internal accelerometers. Games will definitely benefit from this. So it should be easy for most developers to get started once they familiarize themselves with the new human interface guidelines.
Spore on the iPhone. It uses the accelerometer on the iPhone for controls.
However, as impressive as the SDK is, it also has some shortcomings which can't be ignored. Here's why (some of these might change when iPhone 2.0 debuts but I doubt it):
- No garbage collection.
Creating an iPhone Application:Note: iPhone OS does not support memory management using the garbage collection feature that is in Mac OS X v10.5 and later.
Maybe most Objective-C developers love doing manual reference counting but this seems like something that should be addressed. After all, Google's Android platform supports this. Moreover, Objective-C 2.0 already supports it so garbage collection could have been enabled from the beginning.
Some might argue that garbage collection adds extra performance overhead. But consider what happens when your app starts leaking memory all over the place. And with all the rich history that garbage collection has, it's really amazing that companies don't really start to take it seriously.
In fact, during the video, they showcased several different developers creating fantastic prototypes for the iPhone in two weeks. I suspect that development and debugging time could have been reduced more if only garbage collection was enabled. =) -
Crippled simulator
Not sure if this will change in the future but the current simulator is rather dumb and featureless. You cannot even trigger the hard buttons (like the volume UP/DOWN, silencer, top button). The only button you can activate is the home button -- the one at the bottom of the screen. And no, you can't simulate the features of the accelerometer.
It does however support the two-finger gesture if you hold on the OPTION key on your keyboard.
I suspect that this is a ploy by Apple to get people to i) buy iPhones to test on b) subscribe to the $99/year developer deal to get your app on to the iPhone. After all, how are you going to test your next greatest app that relies on the accelerometer if the simulator cannot even handle it. However, of my three criticisms, this might be the easiest one to fix.
Google's Android emulator is currently better but that could be because there isn't an actual phone to run it on yet! -
$99/year (yes, it's PER YEAR!)
Apple Announces iPhone 2.0 Software BetaDuring the beta iPhone SDK program, a limited number of developers will be accepted into Apple’s new iPhone Developer Program and offered the ability to get code onto iPhones for testing. The Standard Program costs $99 (US) per year and gives members an iPhone SDK and development tools; access to pre-release iPhone software; technical support; the ability to get code onto iPhones for testing; and distribution of applications via the new App Store. The Enterprise Program costs $299 (US) per year.
To even get your app for testing onto the iPhone you need the special version of the SDK or a special license. This is weird since that means that I cannot even write an app for MYSELF and install it on my phone just for my own PERSONAL use.
Plus, right now no one can install your app unless you list it on iTunes (which minimally also requires the $99/year contract).
You can argue that this annual fee is not really a problem with the SDK but I think it is. After all, without paying the fee, your SDK basically allows you only to experiment and not actually get anything onto your iPhone.
I think the $99/year (or $299 for Enterprise) fee is somehow used to do code signing which I think is a weird way to guarantee that your program is non-malicious. I could be wrong.
Also, after having to pay $99 would anyone release your app for free??!! I look forward to seeing how many free apps there will be. My prediction is that apps that are somehow tied to a desktop app that costs money (for instance, Transmit, NetNewswire, etc) might be free since the cost is absorbed by the desktop app.
It would be interesting to see how it would compete with Android in terms of interested developers. I am not sure if it is a good idea to actually get developers to pay to actually use the development tools.
I do like the idea of paying the yearly fee to have Apple list your product for you on iTunes but it would be good to offer developers the choice of distributing their own applications if they want. In fact, just being able to install your own app on your own phone would be fantastic!
So while the SDK definitely has a lot to offer, it also has some serious shortcomings that might discourage some developers. But with all things Apple, they certainly won't mind ostracizing some developers in favor of others....
Alan Kay's Talk at TED 2
Alan Kay recently gave at talk at TED. You can view his video from here. Like all TED talks, it's about 20 minutes long so it's short and straight to the point. The rest of my post will make references to the video, so reading it without watching the video might not make much sense.
Unsurprisingly, in the video, Kay demonstrated the canonical moving car example for Etoys. The moving car demo is something that most people familiar with Squeak would have seen. It's really simple but it lets kids experience programming in a fun interactive way. Unfortunately, this is something that most modern languages have failed to enable. After all, which is more fun: printing text to the screen or watching your creation actually move on screen?
However, the second part of Kay's demo was even more interesting. He shows what you can do to help illustrate some simple math and physics properties in an insightful manner. It uses all the features of Etoys (or maybe the full Squeak implementation) to let students experiment by themselves.
Experimenting with this would have been so much cleaner than using a tape meter. It's actually even cooler when you watch the animation or code it up yourself in Etoys.
For instance (and this was something that impressed me), you could design a simple car that drop dots along as it moved. So, a car that is accelerating will be dropping dots further and further apart from one another. This is basically the same idea as using a tape meter. However, the animation of the car moving and dropping dots seem so much cleaner to me. You can easily illustrate the concept of velocity and acceleration without having to talk about friction, etc. Something that is unavoidable with a real experiment. This helps especially when you are teaching a younger audience about the basic principles of motion.
Toward the end of the talk Kay showed an example running on the OLPC. So I was curious whether all courseware on the OLPC will be interactive or whether they will be like normal textbooks only in digital format. Either way, it's already hard enough to actually get good content onto the OLPC. As far as I know, there is no group dedicated to creating content for the OLPC yet.
However, I was able to find a couple of interactive learning environments at OLPC Courseware Review but, from the list, it seems that Dr. Geo II is the only one that has been ported to run on the OLPC. It would be interesting to see if there is a Google Summer of Code project for creating/porting an existing interactive learning environment to the OLPC.
Incidentally I was reading "A Mathematician's Lament" by Paul Lockhart which also talks about how to revamp the current K-12 mathematics education. The paper is available from here. Basically, Lockhart says that there is not enough experimentation with math going on in the class rooms. And that most of math is rote memorization with little appreciation for the beauty of math.
The math education back in Malaysia is not much better either. In school, the teachers are more interested in finishing the syllabus. So students either get-it in school or have to rely on paid tutors to teach it to them. There's very little appreciation on the derivation of the proofs of math. Either the derivation is skipped entirely while teaching or it follows the route of the boring derivation on the board that doesn't engage students.
PhD Qualifying Exam
So every student doing a PhD at UIUC (and I think any US university) is expected to pass a qualifying exam. The qualifying exam gauges whether a student is competent enough to continue in the PhD program. However, it's much more than that. I think it's more of a test to see how well you can do a presentation and answer tough questions during the presentation; as well as trying to not sound stupid in front of a very smart audience.
Anyway, I took my exam two weeks ago. It was an oral presentation where I was assigned two papers: The jastadd Extensible Java Compiler and Automatic Test Factoring. Both papers were about tools (something that I interested in as I mentioned in my research statement to the exam committee).
It's interesting to note how the two papers are somehow connected with me. I first saw the JastAdd system while I was at OOPSLA '07. I had even talked to the authors of the paper, attended their poster session and even their demo session. Fortunately (or unfortunately) I did not attend their presentation session so my presentation was not influenced by theirs. I was already interested in studying this paper in-depth because of the system. And having it chosen as my qualifying exam paper gave me even more motivation.
The second paper was interesting because, Danny, one of my colleagues from the same research group is now working under Prof. Michael Ernst. Danny had referenced some of Ernst's work before. So I was familiar with some of the terminology in the paper and was able to use that to my advantage.
It's just interesting to see what a small world it is....
My slides for the presentations are available here: JastAdd.pdf and AutoFactoring.pdf. I am not sure how interesting they would be on their own but they are pretty to look at.
And I just found out that I passed! The committee had this to say:
"The committee were impressed with his performance and background knowledge".
So that's one crucial step toward completing my Ph.D! :)
PhD Qualifying Exam
So every student doing a PhD at UIUC (and I think any US university) is expected to pass a qualifying exam. The qualifying exam gauges whether a student is competent enough to continue in the PhD program. However, it's much more than that. I think it's more of a test to see how well you can do a presentation and answer tough questions during the presentation; as well as trying to not sound stupid in front of a very smart audience.
Anyway, I took my exam two weeks ago. It was an oral presentation where I was assigned two papers: The jastadd Extensible Java Compiler and Automatic Test Factoring. Both papers were about tools (something that I interested in as I mentioned in my research statement to the exam committee).
It's interesting to note how the two papers are somehow connected with me. I first saw the JastAdd system while I was at OOPSLA '07. I had even talked to the authors of the paper, attended their poster session and even their demo session. Fortunately (or unfortunately) I did not attend their presentation session so my presentation was not influenced by theirs. I was already interested in studying this paper in-depth because of the system. And having it chosen as my qualifying exam paper gave me even more motivation.
The second paper was interesting because, Danny, one of my colleagues from the same research group is now working under Prof. Michael Ernst. Danny had referenced some of Ernst's work before. So I was familiar with some of the terminology in the paper and was able to use that to my advantage.
It's just interesting to see what a small world it is....
My slides for the presentations are available here: JastAdd.pdf and AutoFactoring.pdf. I am not sure how interesting they would be on their own but they are pretty to look at.
And I just found out that I passed! The committee had this to say:
"The committee were impressed with his performance and background knowledge".
So that's one crucial step toward completing my Ph.D! :)
Rubber Bands
My girlfriend and I decided to join the Innovation Tournament Video Contest. The video above is our submission. It could definitely be improved. However, considering the fact that we are only a two-person team and that the weather here is less than conducive, I think we did OK. Overall, it was an interesting experience -- something that I normally would not have done.
Update: Well, turns out that we won! We get to have breakfast with Henry Petroski, an author whose books I enjoy and a visit to IDEO. I wasn't aware of this before but turns out that Henry Petroski did his Ph.D from UIUC! My advisor, Ralph Johnson and my colleague, Maurice are both fans of his writing. It is great to be able to meet Mr. Petroski in-person!
The prizes were sort of interesting because there were slightly more prizes than participants. So this means that a) everyone who participated was really a prize-winner and b) each team got to choose more than one prize. Some prizes, like the opportunity to attend breakfast with Mr. Petroski, were not limited or exclusive so multiple teams could choose the same prize.
Rubber Bands
My girlfriend and I decided to join the Innovation Tournament Video Contest. The video above is our submission. It could definitely be improved. However, considering the fact that we are only a two-person team and that the weather here is less than conducive, I think we did OK. Overall, it was an interesting experience -- something that I normally would not have done.
Update: Well, turns out that we won! We get to have breakfast with Henry Petroski, an author whose books I enjoy and a visit to IDEO. I wasn't aware of this before but turns out that Henry Petroski did his Ph.D from UIUC! My advisor, Ralph Johnson and my colleague, Maurice are both fans of his writing. It is great to be able to meet Mr. Petroski in-person!
The prizes were sort of interesting because there were slightly more prizes than participants. So this means that a) everyone who participated was really a prize-winner and b) each team got to choose more than one prize. Some prizes, like the opportunity to attend breakfast with Mr. Petroski, were not limited or exclusive so multiple teams could choose the same prize.
Convention Preserving Refactorings 2
"These tools, along with the relatively small amount of Ruby code required to implement the desired features, made life easy during the first few iterations. With each new feature, however, the amount of refactoring required to keep the codebase clean increased. Although Rails' adherence to the DRY principle helped reduce duplication, each refactoring had to change numerous code artifacts. Some of the changes, admittedly, were needed to keep the code in line with Rails' convention-over-configuration philosophy.
Renaming an entity class, for instance, requires renaming the corresponding database tables, including other columns and indexes referencing the model's table, renaming the model class, changing the corresponding controller, helper classes, and every reference to the entity class in the views, as well as renaming the directory containing the view classes and templates. And, of course, you have to similarly rename the associated tests and all references to the model, controller, and views in the tests and fixtures."
One of the advantages of being under Prof. Ralph Johnson is that we are indoctrinated to think of programming as a series of program transformation. From the humble HelloWorld program (just think of when you are reediting the program to add some comments or change what gets printed out to the console) to more complex programs out there, almost everything can be viewed as a series of transformations.
Refactoring is as a form of program transformation. Refactoring is a process where you restructure your code without affecting its observable behavior -- where behavior is defined pretty loosely. Why would anyone want to do something like this? If you have never done refactoring before this might seem like a worthless task. After all, if you aren't modifying the behavior of the program, you aren't adding new features to it. And features are what the customer cares about, right?1
Well, turns out that you refactor to make your code easier to understand. Code that is easier to understand is also easier to modify. So essentially, refactoring helps prepare your program for the next feature, and the next feature, and the next feature... that you want to add; making those features easier to add.
Certain refactorings can now be automated through an intelligent IDE. And IDEs have generally done a very good job of it -- until you being to cross the traditional language barrier. For instance, look at Rails. Rails is a framework that relies on Ruby, erb, Javascript, SQL, etc. When you perform a refactoring on your Ruby code does that refactoring percolated correctly through the entire program? If you rename a method in your Ruby code, will it change the name of the method to the new one everywhere that it was called before? Would it also be able to change the method call inside the erb file?
Furthermore, because Rails relies on the convention-over-configuration idea, it is desirable that your refactoring preserves those conventions as well. So now, your refactoring tool not only needs to know Ruby but it must be configured to understand the Rails framework itself! Renaming your Rails model should also make the appropriate changes to the controller and your erb file just because the framework expects them to be related by name in a predetermined manner. Failing to do so would actually cause your program to fail.
If another framework comes along, your tool has to be taught to function for that framework too. And a programmer might choose to use numerous frameworks together. How would you ensure that the refactoring tool would work for any combination of frameworks?
The point of this post is to illustrate the need for multi-language refactoring support. We can think of complex frameworks as basically an extension of the language itself. Frameworks have their own set of conventions to be followed. Following those conventions is essential for a framework such as Rails. For other frameworks, following those conventions would be desirable to make the code easier to reason about.
So the main challenge is how to capture those rules that a framework specifies so that our refactoring tool can understand them and make the appropriate changes toward the entire code base.
1 You can actually think about adding features as another form of program transformation but it is not really viewed as a refactoring since adding a feature is not behavior preserving.
On Screencasts
Jay Fields Thoughts: Are Screencasts the Future?:
He [Geoffrey Grosenbach] sent back a few more reasons why he believes in screencasts as good teaching tools.
- Efficiency of time: It takes dozens of hours to read a 300 page book straight through. But a screencast can pack the most relevant information into an hour.
- Passive/Active: You can sit back and pick up whatever elements are interesting to you. Some people say the most valuable part is learning auxiliary shell shortcuts or workflow tips.
- Graphical/Textual: I don't know any tech publisher who pays an artist to draw helpful diagrams. Screencasts are inherently graphical and it makes sense to include a few diagrams that explain the topic better than paragraphs of text would.
I have been experimenting with doing screencasts for the class that I am a teaching assistant for. As far as I know, no other classes have been using this approach. I suspect that the HCI classes might use them but I have yet to verify that.
Like the quote above, I believe that certain things are easier explained and demonstrated through screencasts. For instance, I started the first screencast for the class to illustrate how to handle resolving conflicts during a wiki edit. For people who have never used a wiki before, handling conflicts during an edit can be a confusing task. Especially if they have no idea what to do and why a conflict would occur. And so, they tend to ignore the conflict warning and erased a previous person's edit.
After some students inadvertently destroy previous edits on the wiki, my initial thought was to write a short article on how to prevent this from happening in the future. It would have to contain numerous screenshots to actually show what was going on at each step. And then I realize how long it was going to be. Moreover, it would be hard to actually describe the conflict. Instead I opted for a screencast approach.
I opened two browser windows side-by-side and edited the same page on the wiki. I then had one browser commit earlier than the other to simulate a conflict. From there I just recorded what I needed to do to resolve the conflict. The video took about 3-5 minutes and I was able to show the real scenario and what actually happens. I did not use audio in this screencast but opted to use the "show text" feature of Quicksilver to type out important messages as the video progressed. I think it worked well.
I am also a fan of using pattern languages to describe best practices. So over this week (hopefully) I will have a set of screencast patterns done. I have already drafted the patterns map out and how each pattern related to another. I will admit that I am not expert in making screencasts but I have seen enough of them that I can tell which are good and which are confusing. I think my screencasts still fall into the category of the latter and would need some work on :)
Getting Into College: The Things People Do
Teens trade lazy summer days for jobs / Work experience seen improving college prospects:
"Instead, many college-bound young people are in summer school, doing volunteer work, or on a trip to the Third World -- sometimes more to spice up their college applications than out of genuine interest, admissions officers say.
Admissions deans are loath to suggest that certain types of experiences are better than others, and say they do not hold a lack of paid work against applicants. Still, deans at several elite schools said they are taking more notice when students have unglamorous jobs."
(Via Digg.com.)
Back in my country, I have seen students in my school join clubs and societies just for the sake of putting it down on their university applications. They would show up during the early weeks of the school term to every club and society meeting so that they may be elected as committee members. And the education system in my country has a completely bogus and ridiculous scoring system for club participation: It is scored on a scale of 1-10. You are scored between 1-4 if you are just a normal member - length of participation determines what score you get. You get a 5 if you are one of the committee members. The only way you can get above a 5 is if you have represented your school, district, state or country. This forces everyone to compete for a position in the committee even if they are not fit for the post in the first place.
And not surprisingly, it is usually the loud-mouths who manage to get the position. They will try to convince their friends and teachers that they are suitable for that position. And when they finally get that position, they do not live up to their promises. The normal members end up doing much of the work without receiving any credit (remember the bogus system? You cannot get above a 5 if you are not a committee member). And what is worse is that our education system does not really rely on recommendation letters. So even if the teacher decides to write a letter for you, it is not going to be read by the admissions committee.
This was during my high school years and they might have already abolished this system. However, I seriously doubt it since I still hear tales of people doing these activities as a means to boost their application.
I have also heard stories of students who try all sorts of methods to get into medical school in this country. There was someone who was working in a lab during his undergraduate years where he received proper training. He exhibited great leadership, motivation and potential. Thus, he was able to garner a good recommendation letter from his mentor. Then poof, once he got accepted into medical school, he stopped showing up to the lab altogether. When contacted, he just brushed it off as saying that he is now extremely busy.
I don't pretend to have a solution for this. There is no bullshit detector at the moment nor will there ever be one. It's just sad that such things are so prevalent. And it's even more sad that just because everyone is doing it, good honest kids are also compelled to follow. What happened to being who you are and sticking to your own opinions?
Harry Potter
Unless you have been living under a rock - or just could not be bothered - you would have at least heard the news that the 7th and final book of the Harry Potter series has been released much to the delightfully anticipation and solemn realization of many. Delightful since this is the concluding book; and solemn since it marks the ending of a tale that has spanned a decade.
Truth be told, I was not an early fan of the Harry Potter series. In fact I had merely dismissed it as another work of fiction when the first book appeared during my teens. I am not one who enjoy modern works of fiction since I have found them to be rather shallow in nature. However, as a kid, I did however remember reading the works of Enid Blyton and thoroughly enjoyed them. When I hit my teens most modern fiction books out there really began to feel repetitious with heavy borrowing from one another. And there never was a compelling series to commit myself to.
My interest in Harry Potter only started during the long holidays when I was done with school. In my country, that mean after the exams that one has to take during Form 5. By that time, four Harry Potter books have already been released. My mom had somehow procured them from one of her friend's daughter who was studying overseas. Moreover, by this time, I was curious about the hype and controversy that the Potter series had spawned. The hype was undeniable so much so that one of my more radical church friends (forgive him as he was (is still?) young and naive), brainwashed by his church, condemned the book as a vessel for demonic works.
It was by reading the four books in my hands at that time that I think I understood how Harry Potter could captivate the hearts of children and adults alike. There was an endearing quality to it. It did not dismiss the acts of violence as most other children's book would have done; neither did it superficially inject violence into the series. Sacrifices do have to be made sometimes for the greater good. Moreover, its conversations were not cloaked under the shroud of pretense: adult conversations (be they muggles or wizards) will always be punctuated with implied swearing. It is this honesty that separates this book from the works of the other authors who try too hard and yet at the same time, reveal too little human nature.
Anyway, it was certainly fun reading the last installment of the series. I was determined to finish it as soon as possible to avoid the possibility that my girlfriend would spoilt the ending for me. She has already attempted to do so by flipping to the last few pages of the book and reading the text aloud. Without spoiling it for anyone else, I would say that the ending brought a nice satisfactory conclusion to the series. It was a most appropriate ending after the midst of sadness that had transpired during the last few books of the series.
Now, if you'd excuse me, I must search for some other series to follow.