Klaus Thul

Entries categorized as ‘Software’

WordPress

March 5, 2011 · Leave a Comment

Maybe some of you noticed: I moved this website to WordPress (hosted by DreamHost). After testing several web-publishing platforms, I settled onto this solution. It is very mature and offers for me the right balance between ease of setup and flexibility.

Right now, I am using one of the build-in themes – the only customization is the turtle (from Sipadan island / Malaysia) at the top.

Categories: Software

Stanford iPhone programming course

June 13, 2009 · Leave a Comment

You can expect the next versions of KTdict to be much better: I just completed the course iPhone Application Programming of Stanford university. The course is taught by two Apple engineers . The lectures are videotaped and available for free at iTunes U. I watched all off the lectures, looked at most of the code examples, didn’t do any exercises but started right away improving KTdict.

Before I wrote KTdict for iPhone, I had some experience with Cocoa programming for the Mac. I started out assuming that everything is more or less the same and only looked at documentation when I didn’t get something working as I liked without. The course was therefore quite an enlightenment for me.

Therefore, my advice for fellow iPhone programmers with Mac experience:

You need to become familiar with the concept of view-controllers, navigation-controllers, tab-bars, table-views and table-view controllers. This is essentially the UI-magic which gets you an application from your 24-inch iMac with Mouse and Keyboard onto a 3.5 inch iPhone with a finger.

So please: Watch lecture 1-8 of the Stanford course and read the documentation of the classes UIViewController, UITableViewController, UINavigationController and UITabBarController before you start coding your first iPhone application.

view_controller_demo.001

The other important item I learned are powerful tools for debugging which I didn’t really use so far:

It is definitely worth installing the Clang static analyzer. This tool is pretty good in finding some typical programming errors, especially related to Cocoa’s retain / release memory management model (the iPhone does not support garbage collection like MacOS 10.5+). Also, seeing the master use the performance tools like leak-check was quite helpful.

Benefit of all this: A new, better, less buggy version of KTdict is already submitted in the app-store. Let’s hope Apple will release it very soon despite tons of iPhone OS 3.0 apps in the pipe!

Categories: Software

From Objective-C to Java

May 7, 2009 · Leave a Comment

One of my plans for KTdict is to write a “buddy” desktop application. It would have essentially the same functionality, but provide the possibility to synchronize flash-cards and dictionaries between iPhone and desktop.

Question is which programming language and GUI-framework to use. It would be quite easy for me to write this as a Mac/Cocoa-application, but this would leave Linux and Windows users out.

So I ended up reading a book about the Java programming language (so far I seriously used C, C++ and Objective-C) and got a first small program to run, so I can provide my first impressions here.

First thing I noticed it that Java and Objective-C are semantically much more similar then Java and C++ or Objective-C and C++:

  • Inheritance scheme is the same: Objective-C and Java use single inheritance with the addition of protocols / interfaces (C++ has true multiple-inheritance).
  • Both languages have simple types (int, float, …) and objects, they don’t make everything an object.

Main differences between Objective-C and Java are:

  • Java isn’t a superset of C, so features like converting integers to pointers are gone. It isn’t possible to write low-level code in Java.
  • Java has no type “id” like Objective-C and it is not possible (one might argue also not necessary) to do dynamic typing.
  • Java compiles to byte-code for a virtual machine, not binary-code for a hardware processor.

Java is likely the language least prone to programming errors I have ever used. It is very clear, that the designers of the languages rather compromised on power then on safety. Also, I like the idea of having a cross-platform GUI-library (Swing).

But I haven’t decided yet what to do. Currently, Java is the most likely choice, but I am also considering simply writing a Mac-only app in Cocoa (lowest effort for me) or to check other cross-platform frameworks like Qt.

Categories: Software