For the past few months I’ve been working on a server administration application (I can’t go into specifics). It was ported Windows code that included some MFC emulation using old-fashioned Mac APIs such as WaitNextEvent. As expected, it never worked reliably and I was starting to feel defeated by it.
I figured out that the actual server code consisted of self-contained C++ objects that had very little to do with the application code. I ended up throwing away most of the old application code and grafting the server code into a modern Cocoa application using some ObjectiveC++ bridge classes. Once I got it to build, it took less than a day to get it working, and in the process fixed lots of long-standing bugs.