策略可可移植碳code [英] Strategies for porting Carbon code to Cocoa

查看:206
本文介绍了策略可可移植碳code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找战略和文章,使碳code的64位准备就绪。

碳64位没有,也不会存在。这是pretty的太大的死胡同

因此​​,为了使碳的应用程序和工具包,64位的图形用户界面的部分将不得不重新写在可可和Objective-C,对吧?

我怎样才能最大限度地减少了努力,我必须投入的过渡?我怎样才能最大限度地减少所需的Objective-C code量?

解决方案
  

因此​​,为了使碳的应用程序和工具包,64位的图形用户界面的部分将不得不重新写在可可和Objective-C,对吧?

是啊。

  

我怎样才能最大限度地减少了努力,我必须投入的过渡?我怎样才能最大限度地减少所需的Objective-C code量?

  1. 了解可可。阅读的Objective-C编程语言和的 Cocoa基础指南。熟悉MVC,KVC,和Objective-C。书签<一href="http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/ObjC%5Fclassic/"相对=nofollow>基金会和<一href="http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/ObjC%5Fclassic/"相对=nofollow> AppKit的框架参考。学会爱界面生成器,因为它是你的朋友(moreso可可比以往任何时候都在碳)。
  2. 在可可得到很好的。读<一href="http://developer.apple.com/mac/library/navigation/index.html?section=Topics&topic=General&kind=guide"相对=nofollow>更多指南(如果你仍然在Leopard中,使用[1]代替)。写为许多一次性的应用程序,甚至真正的应用程序,你可以逃脱在任何时候你有可用。如果可以的话,让他们离开一个BSD许可下,并编写可重用源$ C ​​$ C,并给予该走了。人们会发现错误,并有些人会告诉你他们,有的会提交补丁。得到能够写一个完整的应用程序与模型层,不超过两个控制器,以及至少一个在一天自定义视图或细胞
  3. 阅读<一个href="http://developer.apple.com/legacy/mac/library/documentation/Carbon/Conceptual/carbon%5Fporting%5Fguide/"相对=nofollow>碳移植指南,那么端口的应用程序。

我是从碳自己。这是完全不同的,你不妨重新开始,忽略了你的previous碳的经验,也许你会不会做出一些早期的错误,我没有(如跳绳模型层)。

至于你的应用程序,你可能有很多手术要做,因为碳也没逼你保持UI和逻辑分离像可可一样。可可强制MVC;如果你不坚持下去,您重塑车轮以及制造和改正错误付出代价。

这使得可可听起来像更多的工作,但事实并非如此。移植是硬(不可避免),但除此之外,可可恰恰相反:(!和阅读)写可可应用程序是的的比写(和阅读)碳应用程序变得更加容易。一旦移植结束后,你会很高兴你切换。

呵呵,很多人都会推荐一个或两个可可编程的Mac OS X的亚伦核心提示:中编程在Objective-C 2.0由斯蒂芬·科昌。我的第一本书,看过一些吧,但是那是在我已经学会了可可,所以我不能认真地推荐它;这么说,这是不坏,我不认为你会做错误的阅读。我还没有看到第二本书,所以我不会说关于它的质量什么。

[1]: <$c$c>file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/index-date0.html (堆栈溢出不会让我的链接文件:网址)

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?

解决方案

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?

Yup.

How can I minimize the effort I have to put into the transition? How can I minimize the amount of needed Objective-C code?

  1. Learn Cocoa. Read The Objective-C Programming Language and the Cocoa Fundamentals Guide. Become familiar with MVC, KVC, and Objective-C. Bookmark the Foundation and AppKit framework references. Learn to love Interface Builder, for it is your friend (moreso in Cocoa than it ever was in Carbon).
  2. Get good at Cocoa. Read more Guides (if you're still on Leopard, use [1] instead). Write as many throwaway apps and even real apps as you can get away with in whatever time you have available. If you can, give them away under a BSD license, and write reusable source code and give that away, too. People will find bugs and some will tell you about them, and some will submit patches. Get to be able to write a complete app with a model layer, no more than two controllers, and at least one custom view or cell in a day.
  3. Read the Carbon Porting Guide, then port your app.

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)

这篇关于策略可可移植碳code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆