mikeash.com: just this guy, you know?

NSBlog
RSS feed (full text feed)

accessors advice(2) apple autorelease(2) bug c++ chemicalburn cocoa(29) collections community controls dangerous defensive distributed fridayqna(12) garbagecollection hack hash init initializer injection ipc iphone isequal kvo leopard(2) link mailinglist memory messaging networking notifications nscoding objective-c(11) objectivec(3) opengl performance(6) plugin pyobjc python rant release retain runloop serialization simbl singleton sourcecode stl super threading(2)

Showing entries tagged "cocoa". Full blog index.

Cocoa Unbound at 2010-09-04 21:51
Tags: community mailinglist link cocoaMy recent whining about ridiculous moderation policies on cocoa-dev has borne fruit! Brent Simmons has graciously created cocoa-unbound, a group dedicated to Cocoa discussion but without the foolishness. I've already joined, and I encourage you to do so as well. A well-trafficked mailing list where we can talk about Mac programming without minions of the Mothership getting in our way will be a wonderful resource to have.
(Read More) 5 comments

Friday Q&A 2010-08-27: Defensive Programming in Cocoa at 2010-08-27 15:19
Tags: fridayqna defensive objectivec cocoaWelcome back to another word-laden edition of Friday Q&A. About a year ago, I wrote a post on defensive programming. That post covered defensive programming in a general sense, and Scott Gould has requested that I write one specific to various standard Cocoa practices, which is what I will be talking about today.
(Read More) 16 comments

Friday Q&A 2010-08-12: Implementing NSCoding at 2010-08-13 16:35
Tags: fridayqna cocoa objectivec nscoding serializationWelcome back to another frightening edition of Friday Q&A. This time around, friend and local OS X coder Jose Vazquez has suggested that I discuss how to implement NSCoding in Objective-C classes.
(Read More) 11 comments

Friday Q&A 2010-06-18: Implementing Equality and Hashing at 2010-06-18 14:48
Tags: fridayqna isequal hash cocoa objectivecWelcome back to a late edition of Friday Q&A. WWDC pushed the schedule back one week, but it's finally time for another one. This week, I'm going to discuss the implementation of equality and hashing in Cocoa, a topic suggested by Steven Degutis.

Tags: fridayqna collections cocoaWelcome back to another edition of Friday Q&A. For this week's post, I'm going to talk about three somewhat obscure collections classes that were introduced to Cocoa in 10.5: NSPointerArray, NSHashTable, and NSMapTable, a topic suggested by Phil Holland.

Tags: networking cocoa messaging distributedReader Steven Degutis was inspired by my post about Distributed Objects and decided to make something that avoided those pitfalls. The result is SocketObjC, a remote messaging library that uses continuation passing style to achieve full asynchronous messaging. I haven't tried it, but it's worth checking out.

Tags: fridayqna apple cocoa adviceWelcome back to another Friday Q&A. This week, Quentin Carnicelli (who is heavily involved in generating my paychecks) has suggested that I talk about things that every Apple programmer should know. In other words, common Cocoa design and implementation decisions that I'd prefer Apple not to make.

Tags: fridayqna cocoa memory retain releaseHappy iPad 3G day to everyone. Whether you're waiting in line, waiting for the delivery guy, or just pining at home like I am, you can fill your idle moments with another edition of Friday Q&A. This week, Filip van der Meeren has suggested that I discuss retain cycles and how to deal with them.

Tags: fridayqna cocoa controlsWelcome to another chilling edition of Friday Q&A. While I hope to be soaring over the scenic Shenandoah Valley on this fine Friday, I have taken the precaution of preparing my post in advance, so that you may see it even while I am incommunicado. Such is the magic of the modern world. This week, Michael Crawford has suggested that I give in example of implementing a custom control in Cocoa.

Tags: fridayqna cocoa notificationsIt's that time of the week again. No, it's not just time to go get drunk, but time for Friday Q&A! This week's topic, suggested by Christopher Lloyd of Cocotron (a really neat open source project that lets you write Objective-C/Cocoa code for non-Mac platforms like Windows), is NSNotificationQueue, a little-known, poorly-understood, but handy Foundation class.

Tags: fridayqna cocoa runloopIt's the first Friday of the new year, and that means it's time for the first Friday Q&A of 2010. This week, I'm taking Dave DeLong's suggestion of talking about NSRunLoop internals.

Tags: cocoa objective-c accessorsIt's Black Friday, and that means it's time for another Friday Q&A. Today I'm going to talk about the use of accessors in Objective-C init/dealloc methods, a topic suggested by Jon Trainer.

Tags: cocoa python pyobjc objective-c hackIt's another Friday and time for another Friday Q&A. This week, fellow Amoeba Jeff Johnson suggested talking about using Cocoa from the command line using Python and PyObjC.

Tags: cocoa threading dangerousIt's another Friday, and so time for another Friday Q&A. This week, Quentin Carnicelli (one of the guys who signs my paychecks) suggested that I talk about dangerous API calls in Cocoa.

Tags: fridayqna cocoa objective-c singletonIt's time for another Friday Q&A. I hope everyone who had a chance to go to C4 had a good time and is back home safe and sound. This week I'm going to discuss singletons, both how to make them and when to use them, as suggested by Jon Trainer.

Tags: fridayqna performance cocoa ipcWelcome back to another Friday Q&A. This week I'm going to take Erik's (no last name given) suggestion from my interprocess communication post and expand a bit on Distributed Objects, what makes it so cool, and the problems that it has.

Friday Q&A 2009-01-09 at 2009-01-09 21:38
Tags: fridayqna threading cocoaGreetings one and all. I caught my mistaken writing of "2008" in this blog post title almost instantly instead of only noticing after I'd already posted it like I did last week, so the year must be coming along. Welcome to the second Friday Q&A of 2009 (and only the fourth in all human history!) where I'll be taking Ed Wynne's suggestion and talking about the various meanings and implications of thread safety as they apply to Mac OS X system frameworks.

Tags: cocoa kvo sourcecodeCocoa's Key-Value Observing facilities are extremely powerful and useful. Unfortunately they have a really terrible API that's inherently broken in a couple of different ways. I want to discuss how it's broken, and a way to make it better.

Tags: cocoa objective-c super init initializerOne of the longest ongoing controversies in the Cocoa community is how to write your init methods. More specifically, how to properly call your superclass's initializer. In the hopes of putting this controversy to rest, I want to walk through the right way to write an initializer and exactly why this is the right way.

Tags: performance cocoa objective-c iphoneI finally got a chance to run my performance comparison code on an iPhone, so we can see just how much horsepower this little device has. I still am not able to load my own code onto the device myself, so I want to thank an anonymous benefactor for adapting my code to the new environment and gathering the results for me.

Tags: performance cocoa objective-c leopardBy popular demand, I have re-run my Performance Comparisons of Common Operations on the same hardware but running Leopard.

Leopard: First Impressions at 2007-11-30 23:12
Tags: leopard cocoa objective-c rantLeopard's been out for a while now and brings with it a lot of interesting new tools for the Mac programmer. I've had the chance to work with some of them and want to offer my opinion on how they've worked out.

Tags: cocoa garbagecollection performanceThe move to garbage collection in Cocoa has been interesting. People have said that it's impossible, or impractical, or a bad idea, or doomed to failure, and one of the most common things trotted out is that GC is inevitably slow. However, I think that enabling garbage collection in your Cocoa app could actually be a good way to increase performance under the right conditions.

Tags: performance objective-c cocoa We all know that premature optimization is the root of all evil. But a recent conversation brought to mind that we often don't really know the runtime costs of the code we write. While we should be writing foremost for correctness and clarity, having an idea of these speeds is good, especially when we get it into our heads that some operation is much more costly than it really is. With that in mind, I compiled a list of common Cocoa operations and how much time they require at runtime.

More Fun With Autorelease at 2007-02-08 00:00
Tags: autorelease bug cocoa objective-c I just hit a subtle but commonly known bug for the first time. I thought I'd share my fun with the world. Everybody reading this blog should know about autorelease pools and how they work in Cocoa. As everybody knows, every time you go through the event loop, Cocoa blows away the old pool and makes a new one for you, so that all of your autoreleased objects go away and your new ones go into a fresh pool. That way you never build up more objects than get produced during a single event loop cycle.

Using Evil for Good at 2006-07-14 00:00
Tags: cocoa objective-c c++ stl chemicalburn People who know me as a programmer probably know that I am a great hater of C++. As someone who does a lot of Cocoa, this extends naturally into hating Objective-C++. But I made good use of Objective-C++ in ChemicalBurn and I thought I'd share.

Autorelease is Fast at 2006-06-07 00:00
Tags: autorelease performance cocoa objective-c If you've done much Cocoa programming, you've probably run into a situation where you needed to create a local autorelease pool because of some sort of loop. And you've probably run into advice telling you not to create and destroy the pool for every iteration, because that would be slow. I never believed that it could be significant, and I finally took the time to test it today. What's the verdict? Just as I thought, making autorelease pools is really fast.

Cocoa SIMBL Plugins at 2006-03-25 00:00
Tags: cocoa simbl injection pluginThis post was contributed by guest poster Joshua Pokotilow.
Occasionally, we wish our favorite programs would sport a particular feature that just isn't there. Those of us who aren't developers need to fall back on lobbying for features, but those of us fortunate enough to be in the biz, churning out line after line of Objective-C well into the heart of the night, waking up the next day with bloodshot eyes and feeling not unlike the living dead, have other options. O, we lucky few.

NSOpenGLContext and one-shot at 2006-02-23 00:00
Tags: advice opengl cocoa If you've done any OpenGL work in Cocoa, you may have noticed that OpenGL surfaces behave badly when it comes to things like miniaturization and deminiaturization to the Dock. This recently caused some big problems for me, and I finally found out how to get rid of these problems altogether. It wasn't excruciatingly hard to find, but I wanted to make a post about it here so that it could be found with words like "deminiaturization".