Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is not a fair apples to apples comparison. I am certain that had they rewritten the application in Objective-C from the ground up, taking into account all they learned from the mistakes of the past, they would have ended up with similar or even better gains (by developing in a familiar environment).

It is natural, almost unavoidable in fact, that an application developed and continuously enhanced over many years will end up in a bit of a mess, unless the approach is very disciplined - which it was not in this case (inadequate unit tests for one example).

This was not a weakness or failure of Objective-C, but of circumstances and approach.



It's not apples to apples, but it sounds like both quality improvement and code size reduction were gained by leveraging the Swift type system instead of relying on runtime type checks in NSArray-based code. Would that kind of thing be fixable in an Objective-C rewrite without writing more code?


Honestly the syntax is a lot simpler and rewriting in Objective-C would probably in some cases get more bulky if you are transitioning to using typed collections:

    NSMutableDictionary<NSString *, NSString *> *dictionary = [[NSMutableDictionary<NSString *, NSString *> alloc] init];
compared to the swift version:

    var dictionary = [String:String]()


>the syntax is a lot simpler

and the flexibility is less too. The expressions are far from being equivalent. The Objective-C expression specifies what kind of dictionary interface and implementation will be there, where is the Swift's versions says there will be just Swift's map. Ability to manage implementation may for example start to matter once you're off beaten path - like large number of items, high concurrency or some very specific requirements on life cycle, memory or performance or you want/have to exploit very specific type/set of keys. Though in mainstream case general standard implementation is probably just fine. Everybody chooses their own poison.


you could just say

    [NSMutableDictionary dictionary]
instead of -alloc -init on the annotated class.


That's true. The rhs isn't the the most obtrusive part compared to its type declaration:

    NSMutableDictionary<NSString *, NSString *> *
imagine having to pass the typed dictionary into a method, now you've got to add the type declaration to the method signature in addition to it being initialized elsewhere. Its brutal but also worth doing if you stick to Objc.


Exactly what I think every time I read a "we re-wrote it in X and it's much better thanks to X".

We do it about every 3-5 years, and it seems to coincide with new CTOs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: