未加星标

The cost of forsaking C

字体大小 | |
[开发(python) 所属分类 开发(python) | 发布者 店小二04 | 时间 2016 | 作者 红领巾 ] 0人收藏点击收藏

The C programming language is not trendy. The most recent edition 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 likes the Bay Area web/mobile startup echo chamber, the second if one hates C’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 structures such 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 systems would 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 networking without being fluent in C, practitioners who need to understand their operating system’s TCP/IP stack will find themselves grasping for C.

Lastly most of the work we do with databases, key value stores, message queues and other distributed systems technologies mandates 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.

本文开发(python)相关术语:python基础教程 python多线程 web开发工程师 软件开发工程师 软件开发流程

主题: C++ClojureRustJavaJavaScriptPython
分页:12
转载请注明
本文标题:The cost of forsaking C
本站链接:http://www.codesec.net/view/479660.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 开发(python) | 评论(0) | 阅读(54)