随笔 - 60  文章 - 5  trackbacks - 0
<2009年5月>
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456

常用链接

留言簿(2)

随笔分类(42)

随笔档案(60)

文章档案(2)

我收藏的博客

搜索

  •  

最新评论

阅读排行榜

评论排行榜

原文地址:http://www.cprogramming.com/whyc.html

为什么学习C

Why Learn C?

现在大家在用的计算机语言的数量多得可怕。从高级语言(比如VB)到低级语言,有非常多的选择(Perl,Ruby和Python语言,对于很多任务的实现都是不错的选择)。Java已经成为了一些项目非常受欢迎的语言,某种程度上也是因为它拥有大量的API和虚拟机机制提供了比较好的安全性。(内存垃圾收集器也是一个非常不错的功能,可以使得程序员更有效率。)
There are an awful lot of programming languages available right now -- everything from the extremely high level (such as Visual Basic) to the low level power of assembly, and a good variety of specialized options in between (Perl, Ruby, and Python are good choices for many tasks). Java has also become quite the hot programming language for some tasks, in part because of its large API and in part because the virtual machine provides some elements of security. (Garbage collection is another nice feature and can make programmers much more efficient.)
然而,学习c语言编程,也有很多很好的理由。第一,历史悠久:C语言已有30多年的历史了(译者注:到现在已有近40年了),能找到大量的有效的源代码。这也意味着有很多可以学习的例子,也有很多是可以直接拿来用的代码。而且,语言的很多问题都已经说明的很清楚--它可以更好的理解,并且你可以找到很多很不错的教程。另外,对于C,你可以获得很多你能理解的看法和见解。
Nevertheless, there are some good reasons to learn to program in C. First, age has its advantages: C has been around for 30 years, and there is a ton of source code available. This means there's a lot to learn from, and a lot to use. Moreover, many of the issues with the language have been clearly elucidated -- it's well understood, and you can find a lot of tutorials available. Plus, with C, you get lots of strong opinions mixed with insights that you can understand.

由于历史的原因,C做为Unix的一个系统编程语言,C已经成为了一门通用的编程语言。有时候用C语言来表达一些编程上的想法,大部分人都会感觉到比较舒服。
As a result of its age and its use as the language of system programming for Unix, C has become something of the lingua franca of programming. C is a great language for expressing common ideas in programming in a way that most people are comfortable with. Moreover, a lot of the principles used in C -- for instance, argc and argv for command line parameters, as well as loop constructs and variable types -- will show up in a lot of other languages you learn so you'll be able to talk to people even if they don't know C in a way that's common to both of you.

第三,C是比较接近机器语言。
Third, C is reasonably close to the machine. When you're working with pointers, bytes, and individual bits, things like optimization techniques start to make a lot more sense. There's also utility in knowing exactly how something works underneath the hood -- this helps a great deal when something you're trying to do in a higher level language seems way slower than expected, or just doesn't work at all. You also tend to get a better picture of advanced topics like exactly how networking works. A higher level language will make it a little bit simpler, but it'll be harder to understand what's going on, and when things stop working, it's much better to know exactly what's going on so you can fix it. Additionally, if you like computer science as a discipline, or just like knowing how things work learning the details of the system is great fun.

实际上,很多有趣的编程都可以用C来做--比如,系统软件和数据管理系统(Berkeley DB)。如果你想写一个比较复杂的web程序,C也是一个很不错的选择。如果你想写一个非常好的,快的,C也是很好的选择。你可以用C来写整个操作系统,想用Java来做这个事情是非常难的,对于脚本语言来说是几乎不可能的。而且C是一门非常简洁精炼的语言,它使得非常有趣的编程看起来更优雅,你的编程之旅将会有一个很好的开始。
In fact, a lot of fun programming is done in C -- for instance, system software and data managers such as Berkeley DB. If you want to be able to do more than write a simple web app, C is a great language. If you want to write a great, fast game, C is again a great choice. You can write an entire OS in C. It'll be much harder to do so in Java, and nearly impossible in a scripting language. And the language, being succinct as C is, will probably make your fun program more elegant looking to boot.


我对于这篇文章所谈的话题,想补充几点。
1、学好C,可以帮助理解其他语言中的一些概念。
比如Java中的引用的概念,如果理解了C语言中的指针的概念,就能很好的理解“引用”这个概念了,而不理解指针的概念想把引用的概念理解的很透彻,是比较难的。

2、学会了C语言,再学习其他语言会感觉到更轻松。
Object-C,Java,C++等等很多高级语言的语法都与C是相似的。学会了C后,基本上只要花上一周的时间了解一下其他语言的特性,就基本上可以看懂其他语言的源代码了。

3、从现实角度来考虑,学好C,找到一份好工作的可能性也是大大增强,特别是对于刚毕业的大学生,或工作经验比较少的程序员。现在需要有C语言基础,擅长于C语言的,工作岗位也是比较多。比如拿现在非常流行的iPhone,iPad等设备的应用程序,开发语言就是Objective-C语言。Objective-C是苹果Mac OS X、iOS平台的开发语言,Objective-C是基于C语言的,增加面向对象的相关特性。你可以认为Objective-C就是另一个版本的C++,也就是采用了与C++不同的语法,但也实现了面向对象。你有了C语言的基础,再学Objective,难度就不大了。
你可以到那些招聘网站去看看,查查iPhone相关的开发工程师的要求,是不是很多都要求有C/C++的基础和经验。
还有一些系统开发和底层比较相关的,很多都是需要用C语言开发的。拿信息安全行业来讲,很多安全产品都是用C语言来开发的。还有游戏行业很多都是用C或C++。

还有一点,很多初学者认为学习C很难。其实我想说的是难并不是计算机语言的问题,难的是因为你用计算机解问题的思维还没建立起来。因为你进入的是一个新的领域,以前没有接触过计算机编程,对于怎么用计算机来解决现实中的问题的这种思维你还没有建立起来,毕竟用计算机解题的思维,和用数学解题的思维还是有些不一样的,所以你会觉得学习C语言很难。
如果你在学习C语言的同时,再进行一些程序员的思维训练,我觉得情况就会大有改善。
posted on 2011-10-20 17:07 黄剑父 阅读(2603) 评论(1)  编辑 收藏 引用 所属分类: 编程学院

FeedBack:
# re: 为什么学习C 2011-10-21 18:22 Glueless full lace wigs for black women
虽然现在jave,php等很火,但是c是所有语言的根本,一定要学好,赞同  回复  更多评论
  

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理