iOS Newcastle: Optimising Objective-C and North East App Showcase
The rare UK heatwave meant that most people were outside enjoying the sun. However, a dedicated few chose air-conditioned entertainment at Clavering House for iOS Newcastle for talks about Objective C and a showcase of locally-made apps.
Objective-C Best Practices
Alan Morris
First up at @ios_ncl is @dippigu on objective C programming pic.twitter.com/uh3Le8Pz2s
— Vicky Teinaki (@vickytnz) July 9, 2013
With a long background in programming (he started at age 7!), Morris worked for Orange and Accenture (he admits he stayed at both “far too long”) before co-founding(?) Little Red Door. While over the years he’s learnt a number of languages, he admits that Objective-C “is the first I’ve learnt in depth”. He gave the following tips:
- Know how to use #include, #import (stops recursion), and @class (e.g. don’t use #include in headers, instead use it to look for functions rather than constantly calling header files at compile time)
- Beware premature optimisation. The developments in Objective-C mean that there are various ways to optimise your code (e.g. a numerical iterator loop is slow, a for in object loop is faster but doesn’t give an index, the scary looking but fastest and index giving enumerateobjectsinblock function). However, he used the great phrase “premature optimisation” for the scenario where you believe that one function will be faster whereas in real life the difference is minimal. He advises just to write how you know, test, and check if there are bottlenecks.
- Coding standards: while these are needed for big teams, they’re just as useful for smaller or even single person teams. Set up practices so you know whether you use YES or TRUE for booleans.
- Style guides: Little Red Door are now pretty strict on getting well structured style guide PSDs from their designers right down to properly named layers. While it does have an initial time outlay, Moore believes that it pays off in terms of less back-and-forth for missing or ambiguous elements when it comes to implementation (There’s actually been a big push for good style guides recently, such as the Style Guide Boilerplate).
- Code comments: think about time spent vs time saved, and add comments as per why the code is doing something rather than what to do. (A recent article on comments for commits emphasises the same thing.
- Reduce asset sizes with 9 slice images and related techniques. In a recent project, his team managed to reduce UI assets from 40Mb to 10 using this technique (which is akin to the akin to the sliding doors/CSS clips methods in HTML), and then to 6 with ImageOptim (though a tip from Morris: turn off the XCode caching!) .
For me as a PHP (and occasional Python) developer, Objective C has always been a bit of a mystery to me. However, the new number and array literals as of XCode 4.4 means that it’s a lot closer to other languages (no need to end arrays with ‘nil’ anymore). Similarly, Dict now has a key:value format far more similar to python.
His tips on carious shortcuts reminded me of David Pogue’s suggestion that everyone knows 80% of various computer actions, but a different 80%.
Local App Showcase
There was also a showcase of local apps:
- Balance Guide (£0.69) is a guide for personal money management by Mindwarp Consultancies (represented by Julian Moorehouse).
- Scouting for Boys (free) is a repository for UK Boy Scout archives (in soft launch) by Matt Glover. Matt used UIPageView Controller, CocoaPods (a technlogy that created strong debate!), iCarousel, and LBYouView (a scraper for Youtube) for it.
- Slumber (normally £1.29, £0.69 for this week) an app by Little Red Door that plays white noise, maternal and fetal heartbeats etc). It was based on a toy sheep that did a similar thing. (It also uses iCarousel). Bizarrely, it has a good following in Tel Aviv and Iran!
- Booths (free) is a shopping/groceries network by Hedgehog Lab that allows for shopping lists etc. It’s based on standard core data (though he admits the dev admits now use magical ones), Mapping stack, and Pixate (a stylesheet for apps using CSS, thus getting around having to roll out iOS updates for style changes). He also mentioned the data is piped from WordPress, which wasn’t their choice (normally they’d use Python and Django).
- The Tyneside Speakers Club app (free) represents a group that has been meeting twice a week in Whitley Bay for 42 years. The app is a way to get younger people interested in the meetup through videos. “There have been loads of downloads, but unfortunately the people in Turkmenistan haven’t shown up.”
There are a number of apps in review stage as well, such as one on the art of the Metro.
In terms of older but still interesting apps, one attendee released an app that shows you how sudoku can be solved as well as an acclaimed version of The Game of Life!
On the non-iOS front, some devs are expimenting with Launchpad and internet of things.
Other things
- Organiser Matt Glover took part in the Middlesbrough Hack Day and came second, using the FB SDK and cameras. The winning app used twitter search terms and libraries to measure whether the tweets were positive or negative, for reputation management.
- There are speaker calls for iOS Dev UK.
- Finally, if you’re interested in a Macbook Air, there’s one for sale. (Who needs Craiglist when you have meetups?)