Posterous theme by Cory Watilo

Starting small

I was initially thinking of titling this post ‘Making a dent’, in memory of Jobs' memorable quote about putting a dent in the universe. However, I believe that enough people are already sold on the idea of making a dent, while there are not enough people sold on the how or the execution of making said dent.

So here we are: how do you make that you-shaped dent you were born for? I believe the answer is simple: start small, do what you can, take small steps, and build on those steps.

What does this look like?

Goal

Here’s my goal, inspired by a talk recently given by John Gruber about the rise of tablets: Using tablets, take computers into fields where computers never made it before, because people in those fields don’t sit at a desk all day.

Strategy

Here’s my big-steps plan, or strategy if you will:

  • Get free from the dayjob in a few years
  • Use that freedom to make said dent

My thinking is that you can’t change the world if you’re stuck from 8am-6pm doing another man’s bidding. You may be lucky however – your dayjob may be all the platform you need to change the world (i’m looking at you, nath and matt).

Small steps

And i also have a small-steps plan, or tactical plan if you will:

  • Make iPhone apps in the evenings / train trip / weekends whilst employed in a day job
  • Hopefully not neglect the family too much in doing this!
  • When, in a few years, this is bringing in enough income to overtake my day job, i will resign and be able to work full-time on my ideas
  • I will then use the strategies in this post about cold calling to make some contacts with local small doctor’s practices
  • Build a iPad (+web/mac) app to manage medical records and the ancillary affairs of a doctors practice, with one of my contacts. Make it so good that they just love it.
  • Sell it to lots of doctor’s practices, and work towards selling to the big companies that own many practices
  • Leveraging my reputation gained by this point, get a small regional private hospital to work with me to build the features they’d need
  • Sell to other private hospitals
  • Sell to public hospitals / government, and…
  • BAM! Australia’s medical industry has been disrupted. Imagine how effective our health system would be if it was liberated from its crushing paperwork load.

How this works

See how every one of my steps above in my specific plan involves achievable, small steps towards bigger things?

It’s all about small steps: doing what you can with what you’ve got, and doing stuff that builds you a platform for doing something bigger.

Even if you don’t have a big goal that you want to work towards, practice the skill of doing small things with what’s available to you now (your time/skills/resources). Get good at execution, and direction will inevitably come. And once you’ve got that direction, start taking baby steps in that direction.

Observer Pattern in Objective-C

Perhaps you’ve got a situation like this: A ‘middleware’ type class in your application, which let’s say for argument’s sake keeps track of sales on your website, through a timer or some sort of push mechanism. You’ve also got some other UI classes which would like to be notified whenever there’s fresh data in this middleware class, so they can update their display.

One early approach I pursued in achieving something like this was to use an array of listeners. The middleware class maintained an array of listeners, and other classes could add themselves to that array. Whenever there was new data, the middleware class would iterate through the array, calling some method with a name like ‘MiddlewareUpdated’.

Basically, this was a classic observer pattern.

But this method had a lot of issues:

Memory management

Since the middleware was a singleton, and it’s list of listeners retained the other UI classes, they would never get released. A couple of solutions to this were tried:

  • Making this list hold weak/assign references to the other classes. This involved a hacky non-retaining subclass of NSMutableSet. And if we forgot to remove the UI classes from the listeners upon their dealloc, crashy crashy!
  • Making the UI classes remove themselves from the listeners array on their viewDidDisappear. This meant that if they were a hidden tab, we couldn’t update them, and all sorts of tradeoffs.

Lots of code

This method meant lots of boilerplate, error-prone code to keep track of the listeners in the middle ware, adding and removing them and sending them update notifications. Also all the UI classes needed to implement the MyMiddlewareDelegate protocol. And so on.

Enough!

So here I propose a simpler solution: using NSNotificationCenter. This way you can implement the observer pattern or the publish-subscribe pattern with much less error-prone boilerplate code and simpler memory management issues.

This solution ‘goes with the grain’ more with iPhone development, as it uses the pre-existing mechanisms, so there’s less reinventing the wheel going on here.

So let’s see how this works in practice. Here’s an example of my middleware class:

..header file..
NSString* const MyMiddlewareHasUpdatedNotification;

..implementation file..
NSString* const MyMiddlewareHasUpdatedNotification =
    @"MyMiddlewareHasUpdatedNotification";

- (void)notifyObservers {
    [[NSNotificationCenter defaultCenter]
        postNotificationName:MyMiddlewareHasUpdatedNotification
        object:nil];
}

So whenever it wants to notify anyone that it has new data, it calls the [self notifyObservers] method.

Now in the UI classes that want to observe the middleware class for any updates, in their viewDidLoad or initWithNibName or initWithCoder functions, you subscribe to the notifications like so:

// Start observing the middleware for changes
- (void)observeMiddleware {
    [[NSNotificationCenter defaultCenter]
        addObserver:self
        selector:@selector(middlewareUpdated:)
        name:MyMiddlewareHasUpdatedNotification
        object:nil];
}

// When we're done, remove ourselves as an observer.
// That's it for memory management!
- (void)dealloc {
    [[NSNotificationCenter defaultCenter]
        removeObserver:self];
    [super dealloc];
}

// On startup, get the current state of the middleware
// and listen for future updates  
- (void)viewDidLoad {
    [self observeMiddleware];
    [self getInitialLoadFromMiddleware];
    [super viewDidLoad];
}

// Update the UI to reflect the latest data
- (void)getDataFromMiddleware {
    self.something = [[MyMiddleware instance] something];
    [self.tableView reloadData];
}

// Upon startup, get the initial data from the middleware class
- (void)getInitialLoadFromMiddleware {
    [self getDataFromMiddleware];
}

// This'll get called whenever the middleware has updated
- (void)middlewareUpdated:(NSNotification*)notification {
    [self getDataFromMiddleware];
}

The above example is slightly longer than necessary to illustrate how I prefer to grab the initial data and listen for later updates neatly. Really the only interesting parts are the observeMiddleware and middlewareUpdated methods.

Why you should give presentations

Giving presentations got me my current job – so i’m going to use this blog post to hopefully convince a few people that presenting is a Good Thing™ and that you should give it a try!

Why?

The main reason you should be presenting is simple: to make other people smarter. You’ll be doing your small bit to increase the intelligence of the world. If everyone did it, how much better off would the world be? Imagine if millions of people around the world were imparting wisdom / knowledge to others. I think that’s a worthwhile thing to aim for.

Another reason is to build your reputation (or personal brand, if you will). This can be very helpful in small or localised industries. Last time i was in a job interview, the interviewer recognised me from a presentation i gave at a local meetup. Although he still grilled me with due diligence, it was more of a formality and the interview was a cinch.

If you’re in a technical industry like me, you probably could also stand to benefit from the increased communication skills and confidence that you’ll learn from giving a few presentations. These kinds of skills are what will set you ahead of the pack and make you that much more valuable of an employee. Not to mention that communication skills and confidence help in many other arenas of life too.

Networking, in particular, is one of those areas that presenting can really help with. If you go to a meetup, you can only meet one or a few people at a time, however if you give a presentation you’ve basically just introduced yourself to everyone in one fell swoop. And then afterwards the fact that you gave a presentation acts as a great icebreaker for people introducing them to yourself at the meetup.

One of the biggest things that puts people off is the thought ‘but i don’t really have much to contribute’. Nonsense! Everyone knows something. This is usually just a cover for the fear of public speaking. To beat the fear, keep in mind that:

  • Most people at meetups are incredibly friendly.
  • If it goes pear shaped, that’s totally fine. Everyone fails occasionally.
  • Risk is an important part of achieving goals in your life. Take the risk!
  • Don’t compare yourself with well-known keynote presenters – that’s like playing soccer as a child and whinging that you’re not as good as david beckham.

Where you should present

I’m a believer in starting small, and building up to something larger. With that in mind, i recommend starting off by presenting at work during lunch on fridays in a ‘brown-bag’ session (these sessions are so-called because the idea is that everyone brings their lunch to work in a brown-bag and eats it while you present). Send an email around the office to see if a few people would be interested in hearing more about a topic.

Once you’ve become comfortable with that, try meetups. If you’re in a reasonable-sized city, there’s likely to be several meetups related to your industry you could try. These meetups are usually informal groups of a few dozen people interested in getting together, making friends, having a laugh and hearing a presentation or so. Normally they’ll let you have a 5-10min slot. Giving a presentation is a great way to meet people at these meetups.

Other ideas of mine that i haven’t personally tried:

  • Create a small learning class after hours in a community centre
  • Community college

What you should present

You should use your existing area of expertise as a guide on what you should present. Try picking a very specific area, with one or two points you wish to get across. Or you could present a tutorial showing how to do something.

A subject you’re just learning at the moment is another good idea to use as a topic. Chances are, if you’re learning something currently, that it’s a topical thing that would be of interest to others.

If you’ve got an interesting work (or personal) project you’re working on, this also can be an interesting topic to discuss. Even a sub-part of your project can be interesting to people.

Remember, you only want to present for 5-10 minutes until you’re confident you know what you’re doing, so keep it simple and interesting. It’s probably worth practicing a presentation at a work brown-bag before presenting it in front of a bigger audience at a meetup, to ensure that it is interesting for people.

Little plug

Since I’m a fan of giving presentations, i created an iphone app called ‘Impromptu’ to make it simple to create and give presentations. You might hopefully find it interesting! Do me a favor, and please check out Impromptu here.

Thanks for reading!

How to get a programming or design job in Sydney

I’ve been working with a friend lately trying to help them with their job hunt as they enter the workforce, and here’s a bunch of tips which I’ve come up with which should help.

This is all aimed at getting a programming or design job in Sydney in particular, since those two fields are related to me and my friend, but I guess the principles are probably universal these days. If you were trendy, you could call most of this ‘self-marketing’ I guess.

Be good, working towards great

I guess this is obvious, but you have to be worth hiring to get hired. So – get busy! Do what you love, and ship lots of it.

For a programmer, this means start a few open source projects, complete them, and put them on github. Or make a few small iPhone apps and get them onto the app store. For a designer, start a blog and design something small every couple days and put it up there. Get involved in deviantart and other websites of that ilk.

The important thing here is to make it obvious to anyone that you know how to take initiative, start something, and complete it. So start with small projects, so that you have a better chance of completing them. Don’t bite off more than you can chew at this stage.

Don’t be concerned if your quality of your work isn’t great. Perfectionists never complete anything. Your aim is to complete as much as possible, because the more you complete the more you will improve.

An added bonus is that completing lots of small projects will help you find which type of project you enjoy working on best.

Forget Seek

Don’t bother applying for jobs that you see on sites like Seek etc. These days, employers advertising on those sites will get spammed by hundreds of underqualified job seekers. The numbers game is stacked against you when it comes to their HR person looking through the massive pile of all those resumes, there’s better ways to get your foot in the door.

These days, as patio11 says: “job offers travel at the speed of beer”. You’re far better off finding jobs through your friends, networking events, and by directly approaching interesting companies.

Friends

I’m assuming you have friends who are programmers/designers? Or some of your friends are in related fields, and they work at companies that would employ a designer/developer like you? Get them to ask around at work to see if they’re looking for someone like you. If there’s an opening, you can be guaranteed to at least get past first base with an inside contact putting in a good word.

Networking events

This is probably the most important part of this article, so if nothing else, do this! In Sydney, if you’re a developer you should check out the following meetups:

Ideally you’ll be a developer who can program well in two languages, so go to two of these meetups. At RORO make sure to get to know Steve Gilles if you’re looking for a job too, he’s great.

If you’re a designer, i’m only aware of one applicable meetup:

There’s (i’m sure) a lot more – google around and you’ll find them.

Anyway, go along to these meetups (with a friend, if you’re shy), and say hi to anyone who looks friendly. Go along a few times, make some friends (just for friendship’s sake – don’t be a phony!), and when you feel comfortable give a couple of presentations.

Lots of cool employers' job offers get announced at these meetups, and when they know you already, have seen you present some cool stuff, and have seen some of your artwork on your blog or your apps on your github account, it’ll be simple to ask for a job.

Take initiave

If you’ve been looking for work for a while, don’t lose heart and give up on becoming a developer or designer. Start a really cool project – something you think is important, and do it!

If you’ve got time on your hands, this is a great way to keep your skills sharp, and it’ll look great on your resume to show that you took initiave and created some cool stuff while you were looking for a job.

To be honest, you should be doing this even when you’re employed too. Some ideas off the top of my head:

  • Make a cool web-app that helps people in some niche small business keep their core business organised (eg mechanics keep track of when their customers are due for a service, sending them an SMS telling them they need to drop their car in).
  • Design really cool posters for a local charity.
  • Make a bunch of small, useful iPhone apps and release them free with ads.
  • Redesign the website for the design meetup that you’re into.
  • (Big one!) Start a meetup in your local area, if you’re a bit far from the city.

Best of luck!

Custom nav bar / toolbar backgrounds in iOS5

iOS5 brings out this brilliant new ‘appearance’ proxy that allows us to set our toolbar/nav bar backgrounds in one place. No more writing dodgy categories that override drawrect, or inserting subviews at a magical z-order!

Put this in your app’s didFinishLaunchingWithOptions:

UIImage *barsBack = .. some 1x44px image ..

[[UIToolbar appearance] setBackgroundImage:barsBack
                        forToolbarPosition:UIToolbarPositionAny
                                barMetrics:UIBarMetricsDefault];

[[UINavigationBar appearance] setBackgroundImage:barsBack
                                   forBarMetrics:UIBarMetricsDefault];

Pretty simple right?

Now if you’re in the unenviable position of writing an app that just has to work on ios4 as well, you could wrap the above block in an if (IsIos5()) { block, and use the same background-hack categories as you used to in ios4 but wrap the code in an if (IsIos4()) { block, with these handy macros:

#define IsIos5() ([[[UIDevice currentDevice] systemVersion] intValue] >= 5)
#define IsIos4() ([[[UIDevice currentDevice] systemVersion] intValue] <= 4)

Good luck!