Archive for January, 2008

Objective-C messages, checkboxes and booleans

Thursday, January 24th, 2008

So in the past week or two I’ve started a new project using Objective-C and Cocoa for OS X. If you want a good set of frustrations, here it is. Honestly.

It is hard, I mean really hard, to break out of the C++ style programming mindset. It really is automatic that when I think I need to call “doSomething” on “magicObject” to type: magicObject.doSometing(blah).
Instead I now need to type: [magicObject doSomething:blah].
It isn’t hard or overly complex — it is simply different. It isn’t how years of C++ style programming have trained my brain. And they’re not function calls, they’re messages. You send a message to an object and hope to God it does something meaningful with it.

And then there’s booleans. For whatever reason they strayed from TRUE and FALSE and opted for YES and NO. I can agree that most of the time thinking of things in YES and NO can make more sense — but it is once again hard to break habits. Of course figuring out that it is YES/NO was a pain enough. I should really find a few more good guides before continuing (and then I’ll need the patience to actually read them…).

And finally a checkbox in a Cocoa table view component. Nothing really complex about it by itself but once you layer on the fact that the checkbox itself uses NSOnState/NSOffState constants which map to integers. But the table view gives you an id (dynamically typed) object when something changes. I was consistently crashing my app when I attempted to use this value as just an integer. Reading whatever documentation I could led me nowhere. I finally found some random items on the internet that finally led me to try:
if ([anObject intValue] == NSOnState) {
Well that works. How the hell should I know to ask the parameter anObject for intValue. Honestly — if there’s a document somewhere in the Apple Developer docs that would have hinted at that I’d like to know — that way I know what to look for next time.

Returning the value for the checkbox when the table view asks for it was equally frustrating. I figured I’d just return NSOnState/NSOffState. Haha! No. You need to return an object so I had to figure out what it wanted and how to cast it. Finally:
value = [NSNumber numberWithInt:NSOnState];
Not exactly what I figured. Creating an NSNumber object and seeding it with NSOnState.

As with any new language and technology there’s a lot of things that people used to it assume and outsiders struggle to figure out. I’m hoping to overcome the struggling soon. Until then, expect a few more posts outlining my struggles.

sol 3 south planet update

Sunday, January 13th, 2008

So apparently the sol 3 south planet on jigawatt (http://jigawatt.thetr.net/planet/) wasn’t grabbing my feed anymore. In fixing mine I realized that 3 out of 8 blogs don’t actually exist anymore and another hasn’t been updated in 6 months.

Those were the days I actually enjoyed college. When I think of my time at RIT for whatever reason that year and those people are what really stands out. When I get back to Rochester I should fire up the infotron one more time. I haven’t worked on so many side projects since that year — I’m not around enough amazingly driven people anymore. CSH wasn’t even as good.

So, does anyone actually still subscribe to planet sol 3 south anymore? Or is it just me? :)

The Fence (and why I’m sitting on it)

Saturday, January 12th, 2008

Today, in the digital world, there’s a fence. On one side of this fence exists Microsoft and on the other side is Google. What fence is this? Why it’s the cloud software fence. These companies aren’t alone though, there’s plenty of others standing along with them; and they’re all trying to figure out where the future of software is. Will we all be using software in the cloud or is it just a fad and our predominate packaged desktop software will continue to be the most used?

The question which we should be asking is why does it have to be one or the other? Sure they have offerings in each space that complement their major offering in the other — but why skimp? Take, for example, Microsoft and their new Office Live Workspace service. Basically a little cloud storage for documents, basic viewing capabilities, and no editing. You still need the desktop version of Office. What they did is keep the desktop Office application as the main focus and added glorified cloud storage. This is a perfectly acceptable approach, but you’re still tied to needing a copy of Office wherever you might need to access your documents. This works fine if you’re a heavy Microsoft and Office user who will be accessing this on a reliable set of devices (personal computers). Probably your normal business user accessing at work and at home or perhaps a desktop and a laptop.

On the other side are companies like Google which are blazing the way of web based applications. This is the other extreme of web and standards based apps which can be accessed from any browser in any place. All the features are in the web version and no download is required to use it. I can be traveling and do my work wherever I can find internet and work from basically any device with a web browser — and then some. Support for internet devices like the iPhone is also big. Sometimes there’s desktop bits which accompany a web service like the Gmail Notifier or the Google Talk client. But in the end these are just extensions of the real application on the web. The online Talk client (the one in Gmail and the flash based version) seem to get more attention and features than their desktop cousin since they were released. This is just Google’s way. It works decently well.

Pretty much every application can be put on or mostly on one side of this fence. I think, though, the real winners are going to be the ones completely ON the fence. Being able to melt together the power and ubiquity of the cloud with the clean integrations and power of PCs and internet devices.

The ability to do work from anywhere and practically any device is something I can’t live without anymore. Mostly I view computers as simply a portal to my data instead of being tied to a specific machine. Going between home and work means that I would have to set up and configure applications in both places. Change a setting at home and I’ll have to change it at work to have the same experience. Same thing with a desktop and a laptop. Now what about, say, not being able to install applications at work or at school. And then throw in differing operating systems and you’ve got quite a mess. Sounds like I need a web application so that I can just load it up anywhere and I’m right where I left off.

But now what about the fact that I want desktop integration and bouncy graphics (I do, in fact, own a Mac). Things like having an icon in the status bar or indications of the number of emails/ims/etc in my Dock and of course things like Growl notifications. Why should I have to live without these. But then you say all you need is something like the Gmail Notifier. Sure, you can do that with email. But even then I find myself using Mail.app when I’m home with my Gmail and Google Apps accounts. I don’t want to have to run 3 Gmail Notifiers to check just some of my mail. I have many other accounts too. And calendaring? I use Google Calendar so that I can work with my calendar wherever I may be — but iCal is just nicer on the eyes and faster to operate. Desktop interfaces are generally faster and and more integrated. That’s all there is to it. I can jump between application, drag and drop, click, tab, copy, paste, and use key commands in standard and reliable ways. Desktop applications don’t need a lot of hacking to try and have “offline” support either — your data is sitting there locally in a standard way on your disk.

So this leads me to where I think we as software developers need to be headed. We need to blur the line between the desktop and the cloud. We need to be able to have web based services so that a user’s data is available anywhere they are. There needs to be a full featured web service that users can use to access this data from anywhere without having to be concerned with how they’re accessing the internet and their data, besides that they need a web browser. Because these services are designed to be actual web based services they have an open, well designed, and standards compliant API which allows desktop, mobile, and other applications to have just as much functionality as the web based application. Even if the service developer cannot produce a non-web based application it allows for third-party development. Of course in this model using the web application is completely unnecessary so the standard use of advertising isn’t as effective and will require new monetization models for web based services.

Based on my perfect model I can think of one service that comes very close to being perfect — Twitter. Yes Twitter. Think about it. They provide a web service which anyone can access and use. They provide a web app for the service which performs all the functions of the service. They provide access for mobile devices and do so in a standard way (SMS). There are many applications written for many operating systems. At any time no matter where you are — you can use Twitter, somehow. Unless you’re in the middle of the desert with no electricity or cell reception — but that’s your fault.

I like it because on my laptop I can use Twitteriffic and its fancy Growl notifications. I can use shortcut keys to bring up and use the app. And it always does its thing in the background, I don’t need to log into the web page in Safari every time I boot my computer. I use my phone when I’m on the go and if I’m at a device with internet access I use the web based version. I even use the IM version for wherever I’m logged into IM. My experience of twitter across all these different devices and places is the same too! The interface itself is obviously a bit different but I can perform all the same functions.

Twitter is the simplest version of this concept. I think, though, it is really the future. You may argue that people are working on ways to make web apps able to tie into the desktop better and blur the line more — but the issue is that these all require additional software. That’s great and all but until 99% of clients can support it — it isn’t useful. The point of a web app is that I can access it ANYWHERE. If I need a special plugin I’m stuck to wherever I can install a plugin. Standards based HTML and Javascript is pretty much ubiquitous if done right — so why break a good platform? We’re always working on new ways to distribute software so I think in the coming years we’ll see browsers and operating systems blending together and making standards based web applications able to be desktop applications with ease. Until then, I think we may as well not wait and simply make the best out of what we have now — web applications for remote access, native desktop applications for local and offline access.

In the end, I really just want my bouncy icons. :)