A note on NSManagedObjectContextId

Like a lot of iOS Devs I’m used to working with my domain objects across various different threads.

As you may know, when you decide to work with an object on a different thread, you need to retrieve that object from that thread’s NSManagedObjectContext. This is normally done like so:

[myNewContext objectWithID:recordFromADifferentContext.objectID]

The record’s objectId is a universal identifier and you can find out more information from the Apple Docs on it.

However, I was recently having trouble with saving an object in one thread and then retrieving it in another thread. It was throwing an exception when I tried to use the object on the second thread.

The problem is that the initial objectId on a record is a temporary one. Therefore, when we hop onto a different thread, we can’t do a lookup on it.

The solution? Simply make the following call on your original managedObjectContext like so

[recordInFirstContext.managedObjectContext obtainPermanentIDsForObjects:@[recordInFirstContext] error:&error];

This will force the record to create a permanent objectId which can then be retrieved on another thread.

“Oh shit, we’re here”


Regardless of your ideal job – whether its to play music, design clothes or build cathedrals – you don’t just move straight into it. It’s a slow process that almost impossible to perceive happening. Like a kind of backwards erosion.

As a kid my dream was to play football or make videogames for a living. When I informed someone about this about 8 months ago they were like ‘Well thats great that you made your dream job come true’. I didn’t realise I was making games for a living until that moment.

I’ve enjoyed myself building different types of software over the years that I hadn’t realised that I’d landed in my dream profession. And for me that kinda proves the whole ‘enjoy the journey’ stuff that you often hear spouted.

Building a good career (or relationship, or music record or whatever) is like an engaging conversation on a road trip. You’re enjoying yourself so much that when you arrive at your destination you’re just like ‘Oh shit, we’re here already’.

Happy Thanksgiving, peeps!

Screw stereotypes

A recent tweet by Marc Andreessen got me thinking about our culture:

“Silicon Valley is nerd culture, and we are the bro’s natural enemy.”

It got me thinking: what is nerd culture?

An interest in programming? Computers in general? Does it exist anymore? As a guy who could most certainly be viewed as a nerd (I started programming on a Commodore 64 as a kid and I could probably give you the rundown of every single game released in the N64/Playstation era), the whole ‘nerd culture’ thing always kinda jarred with me.

There are cultures around music, sport, film etc. Nerd culture is different to these in that its viewed as an exclusive membership. If you liked computers then you spent Friday nights at home playing Dungeons and Dragons, not out catching a game of ball.

When people learnt you had interest in computers they quickly assumed you didn’t have any interest in pursuits outside of technology.

This is understandable. Computers have only had widespread adoption in the past two or three decades. Tech culture is super young in the grand scheme of things. “Outsiders” built stereotypes due to a lack of understanding.

But my issue isn’t with outsiders pigeon-holing us. That happens for every culture eg. Football fans being seen as yobs, art fans seen as snobs etc. My problem is when we start viewing it this way ourselves.

If we ourselves start labelling each other as either “geeks”, “brogrammers” or whatever then we do a disservice to ourselves, to the person we’re labelling and to our industry.

Why? Because nobody is just one thing. I know plenty of people who are crazy sport fans who make great coders and I know plenty of self-proclaimed super-nerdy types who can’t hack for shit.

Here’s why it’s important to kill off these stereotypes now: because we’re at an important changing point in our industry and our culture. A career in tech is possible for more people (and more types of people) than ever before. The vast, vast majority of people considering a career in tech won’t fit into the nerd/brogrammer archetype.

For some people that won’t matter but for others it will make them reconsider pursuing an interest in which they have a very real passion.

Caricaturing the roles in our industry will reduce diversity and will mean that we’ll miss out on some really talented people who could do special things in technology.

What you can do

1. Realise that stereotypes add nothing positive to anything and try to wipe them from your mind.

2. Don’t fit yourself around a stereotype. Are you a programmer with bad social skills? Well then work on it – becoming a good conversationalist isn’t that hard. Are you a sales guy who just “doesn’t get” tech? Work on it. Again, it isn’t that hard.

3. Encourage as many people as you can towards our industry. The days of programmers being almost exclusively neck-bearded white males are coming to an end, people. This is a good thing.

Screw the stereotypes. Encourage people to code. Watch our industry blossom.

Startup Bullshit

There are several common reasons a startup fails. Oftentimes there’s no market for the product, the idea was poorly executed, the startup was poorly ran or founders just got bored and gave up.

These mistakes are common amongst newbie founders and, to a degree, they have to be learnt by first hand experience. That being said, it’s really frustrating to see/read about smart people falling to these traps and I read an article on Medium today which damn near made me pull my hair out.

The article in question is titled “How quitting my corporate job for my startup dream f*cked my life up”. It’s not too long and is pretty well written – go read it now. Don’t worry, I’ll still be here when you get back.

Ok, you’re back. This article made me want to bang my head against a brick wall as it featured a lot of the bullshit that’s involved with startups right now. Let me be more specific.

1. The author sought an escape in a startup

Startups are freakin’ hard. I don’t mean long-hours hard. I mean every single part is difficult. Hiring the right people. Developing a product. Identifying a niche. Marketing. Selling. None of these tasks are easy (the one exception being the tech side if you’re already a developer but truly full-stackers are rare).

The author clearly hated his job and wanted out. But like the dude who leaves his wife for a younger, seemingly-more-attractive model – he found out that nothing is perfect.

If you think that working for a startup is suddenly going to undo problems you have at work, at home or whatever then trust me: you are wrong.

What the author should have done was changed jobs. Get a gig where he can spend more time with his girlfriend and friends. Start to enjoy life, basically.

2. The author searched for an idea, rather than letting it come naturally

I can guarantee if you take twenty minutes of your time you’ll come up with what seems like a good idea for a startup. Look back on it in 24 hours and I bet you think it sucks.

The best startups are formed to solve problems that the founder has experienced first-hand and repeatedly. The author just wanted the startup life but (it seems) didn’t have the need thats required to run one. By need I mean that you feel the world needs this product, or at the very least that you do.

Founding a startup for the hell of it is like adopting a puppy because you like the idea of having a dog but aren’t prepared to deal with the mess.

3. The author tried to mask the struggle

Your friends and family are, in general, going to be very supportive of the leap you’re taking. They probably think the world of you and you don’t want to feel like you’re letting them down. But a major, MAJOR pet peeve of mine is how damn near every founder feels like they need to tell people they’re killing it. When asked how their startup is doing, 99% of founders (not a scientific statistic) will shoot you smile and tell you about increased signups, engagement rates, rapid pivoting or whatever. You know what you never hear? Honest replies like: “You know, I’m having a kinda shitty week” or “I’m really unsure whether there’s a market for our product”.

I don’t know why but founders seem to feel like they need to project this constant image of whirlwind, starry-eyed success. Like everyday they work at their startup is a trip to Disney World.

Guess what? Startups suck sometimes. You work in a constantly insecure environment. You’re always over-allocated. You don’t know the next time you’re getting paid. Sometimes you launch and no-one shows up. Yep, you can paint these things up as positives (“an exciting environment to work in!”) but they’re truly not. It sucks. Now of course there are positives that, in my opinion, outweigh the negatives (hence why I do what I do) but to pretend on daily basis that everything is rosy in the garden is just plain madness.

And if you can’t express your thoughts, feelings and experiences to those closest to you then who can you express them to?

4. The author had a naive definition of success

“Successful entrepreneurs are not necessarily those who raise millions of investment rounds”

I seriously needed to take a beat when I read this. I truly can’t comprehend why, oh why, an entrepreneurs success would be defined by raising funding. I don’t want to pick on him here because he only suggests that some people may harbour this view. However, it is a hyper common view that raising investment is some kind of win when it’s not.

Raising investment means you managed to convince one or a handful of people that you could be majorly profitable/popular in a few short years. It says literally nothing about how good your product is and if anyone will buy it. Multiply that by a thousand if its a seed round.

Taking on investment is another headache you’ll have to deal with and if at all possible (and most of the time it IS possible) you should bootstrap your company.

Defining success as raising investment is like a rock band prioritising getting signed by a big label rather than making good music.

5. The author provides nonsense startup advice

Okay so this part is obviously quite relative but the tips he gives feed further into startup bullshit.

“Are you ready for the social pressure?”

The only social pressure that you’ll feel as founder is that which you create yourself. This relates back to point number three above. If you’re constantly telling people how great your startup is doing then you’re gonna feel the need to continue that lie (if it is one). Honesty with yourself and others is the cure for said pressure.

“Do you have enough cash to last at least a year?”

Bullshit. You need enough cash to do you until you can build a product and validate a market. That shouldn’t take a year – it should take at an absolute maximum 6 months. Three months for a basic MVP seems to be a good rule of thumb (again, highly scientific).

Referring back to point number two, if you feel you *need* to create something you’ll find a way – trust me.

“Are you ready to sleep only few hours a day?”

Another statement that forced me to take a few deep breaths. I’ve written about this a bit already so I won’t go on too much but the notion that working long hours and skipping out on sleep will help you achieve startup success is absolute FALLACY. Yes, sometimes there are grinds but they should be few and far between. I’m sitting in my office at 6:15pm and I would’ve been out of here an hour ago but I decided to write this blog post instead.

Hey founders, you’re probably the most important part of your startup so it’s pretty crucial that you look after yourself. That means getting the recommended amount of sleep, nutrition, social activity and exercise every single day – with few exceptions.

All that being said…

So I might have been a bit hard on the author of the mentioned piece. I also may have portrayed startups in a negative light but it doesnt hurt to show the other side of the experience.

As I said it’s frustrating to see the same mistakes performed repeatedly (and for poor advice to be peddled). Maybe that’s just the way it always has to be for newbies but I hope not.

If you’ve any thoughts on this piece then be sure to leave a comment or get in touch.

Choosing the right SaaS tool for the job

“Choosing the right tool for the job” is solid advice but an incredibly difficult task when you’re looking for a SaaS app online. Unlike wandering into a physical store and picking between a handful of options, the possibilities are practically infinite on the web.

As a freelance programmer, there’s a host of software that I use in running my business. I need to think about document collaboration and storage, budgeting/invoicing, managing mailing lists etc – it’s a long list and crucial that I’m able to rely on each service.

Clayton Christensen (the chap who christened the term ‘disruptive innovation’) explains in The Innovator’s Dilemma’ that we ‘hire’ a product to do a job. Here’s some advice on how to most efficiently hire a product for your business.

1. Stop looking for all-in-one solutions

You’re not likely to come across a platform that can measure web traffic, keep your Twitter stream updated and feed your cat without spending big bucks. All-in-one solutions at generally aimed at the (very) large corporate world and, in my experience, aren’t as effective as “dedicated” solutions.

It’s the reason why DIY enthusiasts have toolboxes rather than a Swiss Army knife.


– I use Buffer (www.bufferapp.com) to keep my social media accounts up to date. Such a simple service but one I gladly pay for.

– I use Rubberstamp (www.rubberstamp.io) to manage budgets, expenses and purchase orders - again, simple and effective.

2. Make proper use of trials

Pretty much every webapp out there will offer some trial for their product. Some require a credit card, some don’t. If they do and you’re not so sure about it then put a reminder in your phone to cancel the service, otherwise they’ll likely charge you for the first month once the deadline passes.

Do you have a large company which makes the trial hard to appraise (ie. the trial only works for a company with ten employees and becomes unlimited once you pay)? Try reaching out to the service providers directly and explain the situation – chances are they’d be happy to make an exception for you.

Of course, some services are free which brings me onto my next point.


If the product you’re using is free across the board (ie. there are no paid plans) then realise that this service could disappear the next time you go to login. Business is oftentimes simple and if a company makes zero money then they’re not going to be around terribly long. Failing that, you may fall prey to “customer lock-in” when they decide to start charging and you pay over the odds.

At the very least, make sure that you can export your data from the service in question.

4. Ask around

Most webapps will come with customer testimonies but you can’t beat a reference from someone you already know (possibly because they’re in an identical situation as you).

Reach out to your friends on social media (or, crazy thought here, real life) and see if they can suggest anything.

5. Keep an eye on cost of growth

Are you about to sign up for an app thats $10 a month for five employees but $200 for ten? Make sure that you’re costs don’t scale faster than you do.


The key points above should help guide you towards an online solution regardless of what exactly you’re looking for. Picking the right tool for the job online can be difficult but a little investment up front can save you hours of headache further down the road. Happy hunting!