Many months ago, for a project at my day job, I found myself needing a base 64 decoder. I could do this with openssl, from what I hear, but I thought it would be much more fun to do it myself.
So I did.
It was an ugly hack, and I wasn’t very proud of it.
Late week before last, I was able to obtain a copy of Rhapsody DR2. Oh wow, right? Rhapsody was the in-between phase when Apple purchased NeXTSTEP, and began combining NeXTSTEP and MacOS. It’s pretty neat, you guys. Some great screenshots of the Rhapsody system can been seen at GUIdebook. GUIdebook is an amazing website, by the way. You should it check it out.
At any rate. I again found myself, last week, needing a base64 decoder, but this time, I not only needed a decoder, but a encoder as well. So, I recreated the old base64 decoder that I had made many moons ago as the Base64 Utility. Base64 Utility can decode and encode. It’s pretty spiff.
I thought to myself, “Wouldn’t it be neat to try my hand at Rhapsody development…”, turns out, yes, it is neat.
It is a fully functional Base64 Utility for Rhapsody, compiled on Rhapsody DR2. Wow, right?
There are quite a few gotchas, by the way, that I didn’t anticipate. The compiler is freaking picky, you guys! I don’t know if there would be interest in a detailed post about this, but if there is, I will write it.
But then I thought to myself, “Wouldn’t it be neat to take a step further back, and port this to OPENSTEP?” The answer, again, was yes.
Holy crap! Active OPENSTEP development?! The initial release of OPENSTEP was in 1994, you guys! What is this, I don’t even!
There were fewer gotchas bringing this to OPENSTEP because I was porting not the OS X version, but the Rhapsody version. The main problem was that I had to recreate the NIBs and that
NSWindowController didn’t yet exist.
Then I thought to myself, “Wouldn’t it be neat to bring this to iOS?” There’s additional thought that has to go into this. How would you access files? How would you export the files? What are the limits to copying and pasting large amounts of text on a mobile device?
I came to the conclusion that it would, in fact, be neat.
The largest difficulty in this regard was that of UI. The app is registered for specific file types, so that it can directly open those file types from other apps, such as Mail.app. The app is also able to accept input from the
UIPasteboard. If you copy an image, the app will detect that in the File List, and you’ll be able to create a file to be able to encode.
The other difficulty was that of memory usage. A huge help in this regard was from Tom Harrington’s article at Cocoa Is My Girlfriend entitled Extending NSData and (not) Overriding dealloc. Excellent work on that category, Tom.
Lastly, what sparked all of this. The original Base64 Utility for OS X was quite a feat in itself, you guys. I don’t particularly claim to be a desktop programmer, although I have a couple of projects going. I am a mobile software developer, and this is new to me, short my GTK+ work, years ago.
There’s a lesson to be learned here, you guys. It’s that of software portability. Although all of these systems are objective-c based, there are nuances, there are gotchas, there are things that you wouldn’t think of.
All of these apps now share a common base. You have to be careful not to abstract things away to the point of uselessness, but you also have to be flexible enough to be able to make a change once, and it be able to propagate to the various systems. This mini-project has certainly given me more respect for the people at projects like Firefox.
In the near future, I’m going to be releasing these projects. I hope you enjoy using them as much as I’ve enjoyed creating them.
I suppose today I was in a bit of a “partridge in a pear tree” mood, so I thought to myself, “Wouldn’t it be neat if I did a Windows version?”
“Yes”, is the answer, in case you haven’t gotten the recurring theme.
Having only ever made one other Windows program, a C# Windows Form Application that was used as an autorun app on a cd at an industry conference, I have to say Windows program is fairly new to me.
C# is an abomination. It is not C. I do not care what anyone says. It would not matter to me if Dennis Ritchie and Brian Kernighan came to me and told me other, I would not believe them. C# is a bastardization of Java.
Having said that, it’s not horrible to develop inside Visual Studio. It’s not a bad tool, but it does leave me yearning for my native Xcode.
On the issue of code portability, I wasn’t able to use much from my objective-c base, short concepts, but this was a positive learning experience, all in all.