Alex Rivera | Logout

Cocoa Bad Habits

Asked 2008-10-15T16:21:00.637
29

What are those bad habits you've developed since you've started coding in Cocoa?

I think making a list of bad habits and actively adding to it and, more importantly, breaking those habits is a good technique to produce your code quality. So start now, get your bad habits off your chest. Maybe other people share your bad habits.

Edit
Report

2 Answers

21

Passing nil to arguments that call for NSError**, pure lazy.

answered 2008-10-15T19:06:14.393
5

Bad habit: Retaining my Java mindset.

My Java background leads me to obsessively check for a null before even thinking about doing anything with a variable, when I could be making use of Objective-C's ability to send a message to nil. (See: "Sending a message to nil?")

Instead of trying to preemptively catch a nil, I have to remind myself that Objective-C allows me to simply write code that gracefully works with return values of 0 or nil.

answered 2009-01-24T19:46:46.960

Your Answer