标签:
http://ourcoders.com/thread/show/5550/
@tinyfool 看了您在quora上回答的『为什么说程序员是最好的职业』,加上本来就想学编程(但是一直以来因为各种借口...到现在都还没开始学。。)。现在决心要行动了...买了台RMBP回来。
希望您给点建议...开始该如何学习...看到quora上您说,从阅读像Linux内核这样的大型开源软件代码开始学习编程是最不好的。怕自己随便开始学习很容易进入误区...所以很想得到您的建议。
希望看到这个帖子的大家都能给点建议^_^
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@tinyfool brought me here, I will give you some advices about programming on OS X.
In my opinion, programming on OS X is more easier than it is on iOS, because you have more choices on it.
OS X has five native APIs for you to write and build native apps, they are Carbon, Cocoa, Java, POSIX and X11.
1: First of all, OS X Kernel Programming mainly uses C, C++ (Embedded C++ for IOKit) and assembly language. In China, it is barely to see an OS X‘s kernel programmer because the Kernel programming has the most steep learning curve. Although OS X‘s kernel is open source, the lack of documents will be the biggest barrel on you way to be a kernel programmer. OS X has a special part called IOKit, this is a framework for hardware drivers. It is uses Embedded C++.
2: Carbon and Cocoa use C, C++, ObjC and Swift as the main programming languages. Most even all of the Apps you see on the Mac App Store and iOS App Store are based on them. I think you‘d better start here. ObjC is good start for Object-Oriented Programming, as well as the Swift is the one of best language for you to learn Functional Programing. No matter which one you will choose, you can learn and get the most advanced programming experience with them.
3: POSIX, it is the abbreviations for Portable Operating System Interfaces. It is the de-facto standard for those Unix, Unix-like and Linux systems. It bases on C language APIs. If you want your program can be easily ported to those Pan-Unix OS, the POSIX is the best choice.
4: Java, oh fuck Java , Java sucked. As a more than ten years Java programmer, I beg you not to learn Java language. For native application, Java App has poor performance and ugly user interfaces. For web application, those apps based on Python and Ruby will kick your ass. For that famous Ad of Java "Write once, Run anywhere" is a piece of shit, actually we call it "Write once, fuck up anywhere". So, do not to be stupid, do not fuck around.
5: X11, it has something to do with X Windows, which is de-facto standard of GUI apps in the Pan-Unix OS. If you want your GUI app can be easily ported and running on Unix and Linux, you will use this.
6: Well, OS X is Unix, Unix is invincible, you can do what you wanna do on an Unix system, so you also can learn all kinds of programming languages on OS X.
7: Comments and Advice, star your leaning from ObjC or Swift, good luck.
@Tinyfool 点我来,我来说说我个人的看法,
首先,默认你的问题是如何学习 OS X 编程
OS X 编程我个人感觉比 iOS 要容易上手,特别是对于新手来说,更加自由,选择也更为多样。
OS X 自己就有五大编程框架,Carbon, Cocoa,Java,POSIX 和 X11,其中:
1: 一般来说,OS X 内核级别编程,使用三种语言,C C++ (Embedded C++ IOKIt) 和 汇编,这个跟以上编程框架中的 POSIX 有一定关系。这一块国内基本没有人做,国外不少,这部分的 OS X 是开源的,想学习这部分编程,那么就要从 C / C++ 开始,慢慢的看内核代码。这部分的缺点是文档少,资料少,优点是有源代码,你不会用一个 API 没关系,看 OS X 内核源代码总能找到。另外,这里还有一套特殊的东西,就是 IOKit,这个框架是 Embedded C++ 接口,用于编写驱动程序,如果你想要给 OS X 编写驱动,那么你要学这里。如果不想搞这块 (当然,这块学着苦,也没什么可预见的前途,除非你向我一样写书,没办法只能逼着自己看),你接着往下看。
2: Carbon,Cocoa 这两个可以使用,C, C++,Obj-C (AppleScript-ObjC) 和 Swift 四种语言,这些相信够你学一大阵的了。那么搞 Cocoa 学着写应用层的软件要好很多,这里主要就是 ObjC 和 Swift,当然你要用 C 我不拦着。你看到的 Mac App Store,iOS App Store 上的,都是这类,相对容易上手,也可以自己去卖钱,容易出成绩,也容易有成就感。这块儿的资料什么的太多了,一堆堆的。不过呢,Carbon 少用,一定要搞 Cocoa,Carbon 这东西不知道什么时候就被咔嚓了,但是有些时候你绕不开它。
3: POSIX,OS X 是一个标准的 UNIX 系统这个你知道吧,UNIX 系统的一个特点是都支持 POSIX API,这也是 OS X ,Linux 和 Unix 都能互相移植代码的原因所在。POSIX 就是一套 API 的集合,C 语言接口。OS X 上以 libSystem 库 也就是其他平台的 libc 为基础。实际上这套东西也是 Cocoa 的底层基础。如果你想要做跨平台的开发,那么学习 POSIX 再好不过,问题在于你要用 POSIX,你就要学 C,学 C ,你就要学指针,学了指针就等于进了坑,学好了还则罢了,学不好就完蛋了。C 这种东西,原子弹类型的语言,啥都能干,干啥都行,就是不好控制,跟 ObjC,Swift 这样的比,看着很土。学好了用处很大,你学完它基本上高级语言你看什么也都无所谓了,当然 C++ 除外,那是另一个噩梦,我至今也看不懂。
4: Java,怎么说呢,我虽然学 Java 出身,Tiny 好像也是,但是这东西我没啥好感,本地性能不行,做服务器端现在也能被 Python Ruby 等虐出翔。我实在不知道这个东西现在还有啥好。不要相信一次编译,到处运行这种鬼话,那都是骗鬼听的,真正形容 Java 的是,一次编译,处处不行。当然,这个东西也是有好处的,很多企业还就喜欢他,你要是找工作,这倒是个好选择,不过你记着,一板儿砖砸死10个程序员,9个半会写 Java。
5: X11,我也不太懂这里了,这个是跟 Unix,Linux 界的 X Window 环境有关,使用 X Window 的应用程序,Port 到 OS X 上,或者在 OS X 上开发基于 X Window 的程序,要用到它。比如你在 OS X 上给其他 Unix 和 Linux 开发 GUI 程序,就要用这个东西,不然你就要搞 QT,QT 是啥,别问我,问我我也疯。
6: 要知道 OS X 就是 Unix,Unix 是万能的,没有啥不能干的,除了以上的东西以外,Python,PHP,Ruby,JavaScript,C# (如果你想的话,这属于自虐一族) 什么都能行,什么都能写就看你喜欢了。
我个人给你的建议,学 ObjC,或 Swift,开始上手,理解编程,然后在 OS X 上慢慢开始写程序,慢慢练手。
标签:
原文地址:http://www.cnblogs.com/royi123/p/4276291.html