什么是在知道按c让我写出更好的code任何其他语言的例子吗

什么是在知道按c让我写出更好的code任何其他语言的例子吗

本文介绍了什么是在知道按c让我写出更好的code任何其他语言的例子吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在堆栈溢出播客,乔尔Spolsky的不断竖琴杰夫·阿特伍德关于杰夫不知道怎么写code在C.他的说法是,知道C有助于你写出更好的code。他也总是用一些故事涉及字符串操作,以及如何知道ç将允许你在不同的语言编写更有效的字符串例程。

In the Stack Overflow podcasts, Joel Spolsky constantly harps on Jeff Atwood about Jeff not knowing how to write code in C. His statement is that "knowing C helps you write better code." He also always uses some sort of story involving string manipulation and how knowing C would allow you to write more efficient string routines in a different language.

正如有人谁知道一点点C,但爱写在Perl等高级语言code,我还从来没有一次碰到,我能写C.解决的一个问题。

As someone who knows a little C, but loves to write code in perl and other high-level languages, I have never once come across a problem that I was able to solve by writing C.

我要寻找的地方,而写像Perl和Python的高级别/动态语言的一个项目了解C也会有用的真实世界的情况的例子。

I am looking for examples of real-world situations where knowing C would be useful while writing a project in a high-level/dynamic language like perl or python.

编辑:阅读一些你们已提交过大问题的答案,但依然没有任何意义,我在这方面:

Reading some of the answers you guys have submitted have been great, but still doesn't make any sense to me in this regard:

拿strcat的例子。有一个正确的方式和错误的方式,以字符串C.联合但是,为什么要我(作为一个高层次的开发者)认为,我比Larry Wall的聪明吗?为什么不语言设计者写的字符串操作code的正确方法?

Take the strcat example. There's a right way and a wrong way to combine strings in C. But why should I (as a high-level developer) think that I am smarter than Larry Wall? Why wouldn't the language designers write the string manipulation code the right way?

推荐答案

这乔尔斯波斯基采用的是对的和点状出血的滥用一般Shlemiel画家的算法。

The classic example that Joel Spolsky uses is on misuse of strcat and strlen, and spotting "Shlemiel the painter" algorithms in general.

这并不是说你需要C到解决高级语言解决不了的问题,那就是知道Ç好给你什么回事的语言所有这些层面,可以让你写出更好的软件下方的观点。因为正是这样一个角度可以帮助您避免编写code是,您不知道的,实际上是为O(n ^ 2),例如

It's not that you need C to solve problems that higher-level languages can't solve, it's that knowing C well gives you a perspective on what's going on underneath all those levels of languages that allows you to write better software. Because just such a perspective helps you avoid writing code which is, unknown to you, actually O(n^2), for example.

编辑:基于注释一些澄清

会意C不是这样的知识prerequisite,有很多方法来获取同样的知识。

Knowing C is not a prerequisite for such knowledge, there are many ways to acquire the same knowledge.

会意C也没有这些技能的保证。你可能精通C,但仍然写可怕的,难看的,七拼八凑code在你触摸每一个其他语言。

Knowing C is also not a guarantee of these skills. You may be proficient in C and yet still write horrible, grotty, kludgy code in every other language you touch.

C是一种低层次的语言,但它仍然拥有现代化的控制结构和功能,这样你就不会总是凑了繁琐的细节赶上了。这是非常困难的,而不获得一定的基本面(如内存管理的细节和指针)的掌握要成为精通C,其中掌握的任何语言​​工作时往往支付丰厚的回报。

C is a low-level language, yet it still has modern control structures and functions so you aren't always getting caught up in the fiddly details. It's very difficult to become proficient at C without gaining a mastery of certain fundamentals (such as the details of memory management and pointers), mastery of which often pays rich dividends when working in any language.

它总是对基本面。

这是许多追求以及软件工程如此。这已经不是秘密咒语,让最优秀的程序员最好的,而它是基本面有较大把握。经验表明的C知识趋于具有较高的相关性对某些那些基本面掌握,并且学习C ++的往往是更容易和更常见的路线中的一个来获取这样的知识

This is true in many pursuits as well as software engineering. It is not secret incantations that make the best programmers the best, rather it is a greater mastery of the fundamentals. Experience has shown that knowledge of C tends to have a higher correlation to mastery of certain of those fundamentals, and that learning C tends to be one of the easier and more common routes to acquiring such knowledge.

这篇关于什么是在知道按c让我写出更好的code任何其他语言的例子吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 04:46