Java开发人员在Mac OS上遇到Objective-C [英] Java Developer meets Objective-C on Mac OS

查看:123
本文介绍了Java开发人员在Mac OS上遇到Objective-C的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在多年前的C ++开发,但是这些天我主要是一个Java软件工程师。由于我拥有一个iPhone,我准备下个月春天为MacBook,并且一般有兴趣开始使用Mac OS developmentmt(使用Objective C),我想我会把这个问题:下一步?

I have developed in C++ many years ago, but these days I am primarily a Java software engineer. Given I own an iPhone, am ready to spring for a MacBook next month, and am generally interested in getting started with Mac OS developmentmt (using Objective C), I thought I would just put this question out there: What Next?

更具体地说,我应该拿什么书,有什么网络资源,有些人可能指向我?我计划购买的一些书籍:

More specifically, what books should I pick up, and are there any web resources that some folks could point me to? Some books that I am planning to purchase:

  • Programming in Objective-C 2.0
  • Cocoa(R) Programming for Mac OS X (3rd Edition)

与这些标题?最后,我将非常感兴趣的一个我应该准备期待,一旦我开始这一旅程的总结。作为在Java中使用IntelliJ IDEA开发的人,当我移动到在Xcode中编写ObjectiveC代码时,我会注意到一些关键差异? Mac OS桌面开发和iPhone开发之间有什么区别?用于Java垃圾收集,我应该知道ObjectiveC垃圾收集/内存管理。任何其他语言的具体问题,任何人都想指出?如何构建UI?是否更接近Swing,构建与代码交互的Visual C ++资源文件,或者更像是一些能为guis生成代码的borland IDE?

Anyone familiar with these titles? Finally, I would be very interested in a summary of what I should be prepared to expect, once I embark on this journey. As someone that develops in Java using IntelliJ IDEA, what are some key differences I will notice as I move over to writing ObjectiveC code in Xcode? What's the differences between Mac OS desktop development and iPhone development? Being used to Java garbage collection, what should I know about ObjectiveC garbage collection / memory management. Any other language specific issues that anyone would like to point out? How about building UIs? Is it closer to Swing, building Visual C++ resource files that code interacts with, or is it more like some of the borland IDEs that will generate code for guis?

推荐答案

在您的问题中购买了这两本书,我推荐Cocoa Programming for Mac OS X作为一种快速学习语言和Cocoa框架的方法,并且可能是开始生产实际应用程序的最快方法在可可。我强烈推荐它。 Objective-C 2.0中的编程是一本伟大的参考书,但如果你已经知道C,没有什么教会你,你不能从另一本书。但是,如果你需要一个Objective-C中所有保留的关键字的列表,那就是要去的书。

Having purchased both of the books in your question, I recommend Cocoa Programming for Mac OS X as a quick way to learn the language and the Cocoa framework, and is probably the fastest way to start producing real applications in Cocoa. I highly recommend it. Programming in Objective-C 2.0 is a great reference book, but if you already know C, there's no much it's going to teach you that you can't pick up from the other book. However, if you ever need to a list of all the reserved keywords in Objective-C, that's the book to go to.

所有的用户界面都可以生成,但是你会发现使用Interface Builder(它与XCode一起)来布局用户界面更加容易。你最终会得到更少的代码。使用绑定,您甚至可以消除与布局接口不直接相关的代码。详细信息在Cocoa Programming for Mac OS X书中。

All of the user interface can be generated progmatically, but you'll find it much easier to use Interface Builder, which comes with XCode, to lay out the user interface. You'll end up with a lot less code. With bindings, you can even eliminate code which isn't directly related to laying out the interface. The details are in the Cocoa Programming for Mac OS X book.

我从Java中漏掉的一件大事是集合API。在Cocoa中,你只需要得到NSSet,NSArray和NSDictionary,没有Comparable接口的模拟。这些类也是不可变的,但有可变的版本,如NSMutableArray。

The one big thing I miss from Java is the collection API. In Cocoa, you just get NSSet, NSArray, and NSDictionary, and there's no analog to the Comparable interface. These classes are also immutable, but have mutable versions such as NSMutableArray.

我实际上没有使用Objective-C 2.0中的垃圾收集。在以前的Objective-C版本中,内存管理由retain,release和autorelease方法处理。创建对象的保留计数为1.保留增加的计数,释放递减它,并且自动释放对象是一个更复杂。同样,Cocoa Programming书也很好地解释了这一点。垃圾收集是一个选项,如果它被打开,retain,release和autorelease方法什么都不做。但是,如果你正在编写一个库或框架供他人使用,你应该编程它,就像垃圾收集被关闭一样。

I actually haven't played with the Garbage Collection in Objective-C 2.0. In previous versions of Objective-C, memory management was handled by the retain, release, and autorelease methods. Objects were created with a retain count of 1. Retaining incremented that count, releasing decremented it, and autoreleasing objects is a little more complicated. Again, the Cocoa Programming book explains it well. Garbage collection is an option, and if it's turned on, the retain, release and autorelease methods do nothing. However, if you are writing a library or framework to be used by others, you should program it as if garbage collection is turned off. That way applications can use it whether or not they have garbage collection turned on.

对于Web资源, http://cocoadevcentral.com/ 是一个伟大的网站与初学者教程。 CocoaDev Wiki在 http://www.cocoadev.com/ 中包含了许多主题的详细信息,您通常可以在可用邮件列表中找到一些有用的信息和人员 http:/ /lists.apple.com/mailman/listinfo/cocoa-dev

As for Web resources, http://cocoadevcentral.com/ is a great site with beginner tutorials. The CocoaDev Wiki at http://www.cocoadev.com/ contains detailed information on a lot of topics, and you can usually find some useful information and people on the cocoa-dev mailing list http://lists.apple.com/mailman/listinfo/cocoa-dev

iPhone开发有点不同,细节受到NDA的限制。然而,如果你获得苹果批准访问iPhone开发者中心,苹果提供了一些伟大的视频概述的差异,这指向你需要从Mac OS X跳转到iPhone OS X编程的文档。

iPhone development is a little different, and the details are restricted by an NDA. However, if you get approved by Apple to get access to the iPhone developer center, Apple has provided some great video overviews of the differences, which point you to the documentation you need to make the jump from Mac OS X to iPhone OS X programming.

这篇关于Java开发人员在Mac OS上遇到Objective-C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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