将 Carbon 代码移植到 Cocoa 的策略
我正在寻找有关使 Carbon 代码支持 64 位的策略和文章。
64 位的 Carbon 不存在,也不会存在。这几乎是一个死胡同 。
因此,为了将 Carbon 应用程序和工具包引入 64 位,他们的 GUI 部分必须用 Cocoa 和 Objective-C 重新编写,对吧?
如何才能最大限度地减少过渡过程中需要付出的努力?如何最大限度地减少所需的 Objective-C 代码量?
I'm looking for strategies and articles on making Carbon code 64-bit ready.
Carbon for 64-bit does not and will not exist. It's pretty much a dead end.
So in order to bring Carbon application and toolkits to 64-bit their GUI part will have to be re-written in Cocoa and Objective-C, right?
How can I minimize the effort I have to put into the transition? How can I minimize the amount of needed Objective-C code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的。
我本人就来自Carbon。这是完全不同的——你不妨重新开始,忽略你以前的 Carbon 经验,也许你不会犯我早期犯的一些错误(比如跳过模型层)。
至于你的应用程序,你可能需要做很多手术,因为 Carbon 并没有像 Cocoa 那样强迫你将 UI 和逻辑分开。 Cocoa 强制执行 MVC;如果你不遵守它,你就会因重新发明轮子、犯错误和纠正错误而付出代价。
这使得 Cocoa 听起来像是更多的工作,但事实并非如此。移植很困难(不可避免),但除此之外,Cocoa 则完全相反:编写(和阅读!)Cocoa 应用程序比编写(和阅读)Carbon 应用程序容易。移植结束后,您会很高兴自己进行了切换。
哦,很多人会推荐 Aaron Hillegass 的 Cocoa 编程 for Mac OS X 中的一项或两项 和 Stephen Kochan 的 Objective-C 2.0 编程。我有第一本书,也读过一些,但那是在我已经学会了Cocoa之后,所以我不能认真推荐它;也就是说,它还不错,而且我不认为你读它会做错。我什至没有看过第二本书,所以我不会说它的质量。
[1]:
file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/index-date0.html
(堆栈溢出)不允许我链接文件:URL)Yup.
I came from Carbon myself. It's completely different—you may as well start fresh, ignoring your previous Carbon experience, and maybe you won't make some of the early mistakes I did (like skipping the model layer).
As for your app, you probably have a lot of surgery to do, as Carbon did not force you to keep UI and logic separate like Cocoa does. Cocoa enforces MVC; if you don't adhere to it, you pay the price by reinventing wheels and making and correcting mistakes.
That makes Cocoa sound like more work, but it's not. Porting is hard (inevitably), but otherwise, Cocoa is quite the opposite: Writing (and reading!) a Cocoa app is much easier than writing (and reading) a Carbon app. Once the porting is over, you'll be glad you switched.
Oh, and many people will recommend one or both of Cocoa Programming for Mac OS X by Aaron Hillegass and Programming in Objective-C 2.0 by Stephen Kochan. I have the first book, and have read some of it, but that was after I had already learned Cocoa, so I can't earnestly recommend it; that said, it is not bad, and I don't think you'd do wrong to read it. I have not even seen the second book, so I won't say anything about its quality.
[1]:
file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/index-date0.html
(Stack Overflow won't let me link file: URLs)