Code Organization in Xcode Projects

Xcode does not impose any structure to your source code tree. This is both cool and useful to quickly throw a couple of lines for a prototype, but in my experience, this approach does not scale. More often than not, without any hygiene, your project can become a mess. Just using Xcode defaults, after a while your resources will sit beside your .xcodeproj file, all the project classes will be thrown together in the Classes folder, and if you have a relatively large project, this approach makes finding individual files painful.

Of course, Xcode provides “Groups” to organize your source code, but the idea is to be able to quickly identify the different kind of files that make up your Xcode project, either for Mac or for the iPhone, without having to open the Xcode project file. This means having both a folder structure, and an internal source code file structure. All of this will help you maintain your project in the future, which means cheaper costs, and less time spent looking for bugs.

All of this is also particularly useful when browsing projects via Google Code, Github or any other kind of file view of source code repositories. If your code is organized in a nice folder structure, it is easier to explore than if all the files sit in the same folder.

In this post I will enumerate some best practices that I use in all of my projects. Continue reading

Wonderful uses of the Phone

maravillloso

(Image caption: “A passenger in a plane of Northwest Orient Airlines makes a phone call relayed by radio”) Wonderful uses of the Phone by Richard F. Dempewolff Reaching over a shelf in her kitchen, a housewife pushes a button in a modern device similar to a transistor radio. “One, one, five, seven, five, eight, zero,” says the woman in front of the device microphone. A light turns on in the five centimeter screen in front of the device and the image of a man appears. “Joe,”, says the housewife, “do me a favor: please bring chocolate ice cream when you leave from work.” The man in the screen smiles and through a small speaker a manly voice says: “sure, I’ll be there in half an hour.”

(Mecánica Popular – latin-american version of Popular Mechanics, october 1958 – courtesy of hernún)

Twitter Weekly Updates for 2009-12-11

  • Twitter Weekly Updates for 2009-07-19 http://bit.ly/uPdzt #
  • Nice weekend completely offline. I should've set up some autoresponders but… Here I am anyway. #
  • I've started reading "Beautiful Teams" (O'Reilly) yesterday http://url.akosma.com/47e302 great book so far. Similar to "Founders at Work". #
  • cette semaine: Paléo! @claukosma et moi on y va mardi (Julien Doré) et vendredi (Charlie Winston + Ska-P), et vous? #
  • Paleo iPhone application: http://url.akosma.com/s45658 awful (eeewww!) but useful. #
  • "Comprueban que decir malas palabras ayuda a tolerar el dolor" http://url.akosma.com/s9jn6r #lpmqlp #
  • "Toxic Love Shack" B52 vs. Britney Spears http://url.akosma.com/uwi6a8 #
  • public service message: the T-60 minutes before the Eagle touches the Moon! http://wechoosethemoon.org/ #
  • T-39 minutes for the moon landing on http://wechoosethemoon.org/ #
  • T-15 minutes for Moon landing at http://wechoosethemoon.org/ #
  • impressive http://wechoosethemoon.org/ #
  • A new day, a new iPhone app. #
  • just finished yet another iPhone app. Woooooot! #
  • This is the hottest train I've ever been in my life. Even the Retiro-Tigre in January was cooler. Geez. #
  • Just left Nyon Paléo Festival, INCREDIBLE Julien Doré! http://twitpic.com/b5f7k #
  • public service msg: wanna outsource Cocoa / iPhone in Argentina or Uruguay? Ask @cotlar @cigumo @devego @gabrielgm @gugote Great chaps! #
  • another public service msg: outsourcing your company e-mail to Google Apps for Businesses is a great business decision. Very happy with it! #
  • "o sorpresa / milagro de la naturaleza / sobre la mesa / he visto una milanesa / decorada con un carozo de cereza". Esssaaaa #
  • Going to a meeting for (you guessed it) yet another Earth-shattering iPhone app :) #
  • I wish there was an "umbrella" iPhone app, using the integrated force field generator to protect you. I forgot mine at home and wrath comes. #
  • "La ruuubia, taraaada, aburiiiida" esta justo enfrente mío. #Luca not dead. #
  • Wait wait wait… Where's the storm??? #
  • viewing live how little randomness there is inside rand() and random() #
  • Farfalle for lunch. Al pesto. With cheese. And bread. Not very "diet" but soooo good #
  • the Amélie soundtrack by Yann Tiersen is absolutely mind-blowing. I love it. #
  • testing my latest iPhone app and its integration with Twitterriffic #
  • thought: Y Combinator == microfinance VCs? Is there a similar model here in Europe? #
  • In a couple of year's time, with more RAM and CPU power, the iPhone OS will feature garbage collection. But it won't matter anymore. #
  • Actually I got so used to retain, release and the Clang static analyzer that I even skip garbage collection on my Mac apps, too. #
  • Who said the solar eclipse was not visible in Europe? Right now Lausanne is witnessing one, but instead of the moon is clouds. And hail. #
  • the iPhone simulator *should* include the "airport mode". Anyway, deploying to phone now. #
  • Today, yes: we got tickets for the Harry Potter film! #
  • the Harry Potter movie is… meh. A real "middle" movie, but without the thrill of ESB, quite boring actually. #
  • Keynote, 1password, Delicious Library: when the iPhone becomes accessory of the desktop experience, it changes everything. #
  • I still don't get why Google Latitude on the iPhone is a web app. Crappy user experience, and even my location is wrong. Weird. #
  • Just found out that Digicomp is offering iPhone SDK dev training! http://url.akosma.com/6eeb6g #

Powered by Twitter Tools

Objective-C Compiler Warnings

A recent comment by Joe D’Andrea in a previous post reminded me about the importance of removing compiler warnings in Xcode projects. Most importantly, it reminded me of a conversation with a fellow developer a couple of weeks ago, in which he told me that he was surprised to see that my projects compiled all the time without warnings. Not a single one. Nada. And that I took the time to remove them before checking code into source control.

He actually didn’t know you could remove all compiler warnings; he thought Objective-C was the land of compiler warnings. This situation, I think, is far from exceptional, and due mostly to cultural and technical reasons.

It is my opinion, that removing compiler warnings is basic project hygiene, like writing unit tests, or using the Clang Static Analyzer. I will explain in this post some techniques I use to remove warnings in my Objective-C code.

warnings2 Continue reading

bluewoki – Bluetooth Walkie-Talkie for iPhone OS 3.0

main The first iPhone application under the akosma brand has just been published on the App Store:

bluewokiApp_Store_Badge_EN is a very simple walkie-talkie application, which uses the new GameKit framework available on the iPhone OS 3.0. It is available at the App Store! In English, Spanish and French.

The source code is really simple (around 170 lines of code) and you can get it, as usual, from Github with a BSD license.