请选择 进入手机版 | 继续访问电脑版

技术控

    今日:227| 主题:57401
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] The cost of forsaking C

[复制链接]
夏日落傷 发表于 2016-10-5 09:15:43
158 2
The C programming language is not trendy. The    most recentedition of the canonical C text (the excitingly named    The C Programming Language) was published in 1988; C is so unfashionable that the authors have neglected to update it in light of 30 years of progress in software engineering. Everyone “has been meaning to” learn Rust or Go or Clojure over a weekend, not C. There isn’t even a cute C animal in C’s non-logo on a C decal not stuck to your laptop.  
  But Myles and I are not trendy people, so we insist that all of our students become fluent in C. A fresh class of C converts has just finished working through the K&R bible, making this a good time for me to reflect on why we deify this ancient tongue.
  We give students four reasons for learning C:
  
       
  • It is still one of the most commonly used languages outside of the Bay Area web/mobile startup echo chamber;   
  • C’s influence can be seen in many modern languages;   
  • C helps you think like a computer; and,   
  • Most tools for writing software are written in C (or C++)  
  The first is easy to dismiss if one    likesthe Bay Area web/mobile startup echo chamber, the second if one    hatesC’s influence on many more modern languages. Most engineers should take head of reason three, although our students also learn computer architecture and at least one assembly language, so have a firm mental model of how computers actually compute. But reason four is hard to ignore.  
  Forsaking C means forsaking anything below the level of abstraction at which one happens to currently work. Those who work for instance as web developers forsake thoroughly understanding the browsers, operating systems and languages on top of which their own work stands.
  Concretely:
  Most of our students use    interpreted languages with popular implementations written in C. One exercise we do is to write a Python bytecode interpreter to better understand stack machines and interpreted languages; doing so involves reading the CPython implementation closely. The ruby reference implementation is also written in C, and most JavaScript implementations are written in C++.  
  When learning about    common data structuressuch as hashmaps and dynamic arrays, we need to either implement these ourselves in a language where we can think concretely about memory layout, or to read good implementations that do so. For a student to understand how a Python list or ruby array works, we have them either write a version from scratch or read the source of the standard library implementations—gaining the same level of understanding without diving into C is almost impossible.  
  Learning about    operating systemswould be much harder without C. The operating systems that we use are mostly written in C, the C standard library is tightly coupled to the syscall interface, and most resources dealing with operating systems concepts assume knowledge of C.  
  While it is certainly possible to learn about    computer networkingwithout being fluent in C, practitioners who need to understand    their operating system’s TCP/IP stackwill find themselves grasping for C.  
  Lastly most of the work we do with    databases, key value stores, message queues and other distributed systems technologiesmandates C, for performance reasons.  
  Many practicing software engineers do fine work without fully understanding the above. Routine work in a narrow domain may not demand foundational knowledge. But our students strive to do novel, high-impact work, and quickly find that a solid understanding of C is a prerequisite. If you have similar goals, I would encourage you to put aside that trendy new language for a few more weekends and brush up on good old C.



上一篇:[译] 机器人可以如何通过共享经历学习新技能
下一篇:How I test Ansible configuration on 7 different OSes with Docker
帅帅 发表于 2016-10-5 10:29:48
内容很有深度!
回复 支持 反对

使用道具 举报

何宇航 发表于 2016-11-17 20:31:03
介是神马?!!
回复 支持 反对

使用道具 举报

我要投稿

回页顶回复上一篇下一篇回列表
手机版/CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 | 粤公网安备 44010402000842号 )

© 2001-2017 Comsenz Inc.

返回顶部 返回列表