Recently, while I was coding a method to update my application persistent data, I found out that a good way was to store the data in NSUserDefaults. I could have done it in a different way: writing arrays to a file in /Documents and retrieve it later when I need it back. So, it seems that we can right integers, strings, arrays and even objects in NSUserDefaults. My question is: how much is to much of NSUserDefaults usage ?
Entries from April 1, 2009 - April 30, 2009
Well, here is a little summary of what could be good practices for coders:
- Use pragma directives to create logical blocks of code;
- Use meaningful variable and parameter names;
- Use meaningful method names;
- Use "one-line" comments // before complicated line of code;
- Use "many-lines" comments /* ... */ at the beginning of the header & implementation files with a brief description of what is included and implemented in those files;
- Use constant definitions with meaningful name instead of literals or constant numbers...;
- Document each sections and constant definitions in a main "Constant.h" file;
- Group constant definitions in logical manner;
That is it ! Any suggestions ?
I've been writing Objective-C code since a few weeks now. At the beginning, most of my time was spent in UI prototyping. Then, Interface Builder was my main tool before starting to actually code my first iPhone Application. Now, 80% of my application UI is implemented. I rarely do Interface Builder now. I'm mostly writing lines of code... Those are accumulating and I find myself a little bit lost in the many .h / .m files. I feel the need to spent some time to clarify my code, document it and make it cleaner, easier to read and maintain. I know that on the outside, it will be like the development stalled. But, I think the time that I will spend on this will pay off in the long run.
Meanwhile, as a teaser, I'm posting a blurred picture of one of the screen of my iPhone application. Try to guess what it will be!
The iPhone is a platform for coding newbies..... for better or for worst ! I'm one of those though ! This reminds me of the beginning of the micro-computer age when moms and dads wanted to put cakes recipes on their computer by writing Basic code !
These days I spend my time between a full time job, my family and the iPhone application development. Sometime, I take a day off my job to concentrate on the iPhone application development. This is exactly what I've done in the last 10 days. But, after a full day in front of my computer, I'm a bit tired. This is why I turn to my AppleTV and listen to the iPhone Application Programming Podcast from Stanford University. I'm a bit late: episode 6 is out and I just finished listening to episode 3.
As of today, I'm now officially accepted on iTunes Connect. So, technically I can submit my iPhone application on the App Store for review. This step is important for me as the paperwork seemed a little bit daunting when I first applied for Paid Application Contract Type. To make things a little bit harder, I'm Canadian so extra papers had to be filled and returned to Apple. Now, all that stuff is behind me and I can continue to work on my first iPhone application.
Again, an interesting article about the iPhone becoming a real gaming platform and the importance of prototyping during iPhone app development. It is sad the guy doesn't develop more on this subject.
I've been very busy the last few days with the development of my first iPhone app. Things are going well. Interface Builder is a joy and a big time saver... when we know how to use it ! The Debugger is so useful ! And I love Xcode. About 70% of the UI is implemented. When I'm done with this, I'll start coding the Model part of the MVC (Model, View, Controller paradigm).
Just found out that a Table View in Interface Builder doesn't need to always (or at all) be contained in a View. Why ? I guess, a Table View is a subclass of a View. This is redundant. I feel better now because now my Table editing mode is working!