通过学习 C 语言所学到的知识将对您余下的职业生涯有用。 随着 Microsoft 改变其平台,您所了解的有关 CLR 的知识将变得过时。
.NET developers should learn about the CLR. But they should also learn C. I don't see how anybody can really understand how the CLR works without some low-level understanding of what happens on the bare metal.
Spending time learning about higher-level concepts is certainly beneficial, but if you concentrate too much on the high-level at the expense of the low-level, you risk becoming one of those "architect" people who can draw boxes and lines on whiteboards but who are unable to write any actual code.
What you learn by learning C will be useful for the remainder of your career. What you learn about the CLR will become obsolete as Microsoft changes their platform.
My take is that learning some compiled language and assembly is a must. Without that, you will not get the versatility required to switch between languages and stacks.
To be more specific -- I think that any good/great programmer must know these things by direct experience:
What is the difference between a register and a variable?
What is DMA?
How is a pixel put on the screen (at low level)?
What are interrupts?
...
Knowing these things is the difference between working with a system you understand and a system that, for all you know, works by magic. :)
To address some comments
You end up having two different kinds of developers:
people that can do one thing in 10 ways in one or two languages
people that can do one thing in one or two ways in 10 different languages
I strongly think that the second group are the better developers overall.
Programmers should probably be actually working in the highest-level language appropriate. What's appropriate depends on your scenario. A device driver or embedded system is in a different class from a CRUD desktop app or web page.
You want your programmers to have as much practice as possible in the language in which they are working.
Since most programmers end up working on generic desktop and web apps, you want programming students to move into the higher level languages as soon as possible during school.
However, the higher-level languages obfuscate a few basic programming problems, like pointers. If we apply our principle of using what's appropriate to students as well, those higher level languages may not be appropriate for first year students. That throws out Java, .Net, Python, and many others.
So students should use C (or better yet: C++ since it's "higher-level" and covers most of the same concepts) for the first year or two of school to cover basic concepts, but quickly move up to a higher-level language to enable more difficult programs earlier.
To be sufficiently advanced in writing C#, you need to understand the concepts in C, even if you don't learn the language proper.
More generally though, if you're serious about any skill, you should know what goes on at least one abstraction level below your primary working level.
Coding in jQuery should be paired with an understanding of JavaScript
Designing circuits necessitates knowing physics
Any good basketball player will learn about muscles, bones, and nutrition
A violinist will learn about the interplay of rosin, friction, bow hairs, string, and wood dryness
I like to learn a new language every year. Not necessarily to master it, but to force my brain to think in different ways.
I feel learning C is a good language to learn about low level concepts without the pain of coding in assembly.
However I feel that learning lessons from languages like Haskell, python, and even arguably regex (not exactly a language, but you catch my drift?) is as important as the lessons to be gleaned from C.
So I say, learn about the CLR and MSIL on the job if thats your area, and in your spare time, try picking up a different language once every so often. If that happens to be C this year, good for you and enjoy playing with pointers ;)
I don't see any reason why they should. Languages like Java and C# were designed so that you needn't worry about the low-level details. That's the same like asking whether a WinForms developer should spend time learning the Win32 API because that's whats happening underneath.
While it doesn't hurt to learn it, you'd probably gain more from spending more time learning the languages and platforms you are familiar with, unless there's a good need to learn the low-level technical details.
It can't be a bad idea to learn MSIL, but in a way it's just another .NET language, but with nasty syntax. It is another layer down, though, and I think people should have at least some vague understanding of all the layers.
C, being somewhat like assembly language with nicer syntax, is a nice way to get an idea of what's happening on quite a low level (although some things are still hidden from you).
And from the other end, I think everyone should know a bit of something like Haskell or Lisp to get an idea of higher-level stuff (and see some of the ideas being introduced in C# 3 in a cleaner form)
If you consider yourself a programmer, I would say yes, learn C.
Many people who write code do not consider themselves programmers. I write .NET apps maybe 3 hours a day at work, but I don't label myself a "programmer." I do a lot of things that have nothing to do with programming.
If you spend your whole day programming or thinking about programming, and you are going to make your entire career revolve arround programming, then you better be sure you know your stuff. Learning C would probably help build a base of knowledge that would be helpful if you're going to go very deep in programming skills.
With everthing, there are trade-offs. The more languages you learn, and the more time you spend dedicated to technology, the less time you have for learning other skills. For example, would it be better to learn C, or read books on project management? It depends on your goals. You want to be the best programmer EVAR? Learn C. Spend hours and hours writing code and dedicating yourself to the craft. You ever want to manage somebody else instead of coding all day? Use the time you would put into programming and find ways to improve your soft skills.
除了 C++ 之外,我没有在简历中列出任何其他语言,因为我不想成为其中任何一个的专业人士。 相反,我从他们每个人那里带回了有趣的想法,并将其用于我基于 .net 的工作中。
C 语言很有趣,因为它确实让您接近操作系统,但这并不是成为一名优秀程序员所需了解的唯一级别。
Should .net developers be learning C? I would say "not necessarily," but we should always be dabbling in some language outside of our professional bailiwick because every language brings with it a new way of thinking about problems. During my professional career as a .net (and before that, VB 2-6) developer, I've written small projects in Pascal, LISP, C, C++, PHP, JavaScript, Ruby, and Python and am currently dabbling in Lua and Perl.
Other than C++, I don't list any of them on my resume because I'm not looking to be a professional in any of them. Instead, I bring back interesting ideas from each of them to use in my .net-based work.
C is interesting in that it really gets you close to the OS, but that's hardly the only level you need to know about to be a good programmer.
学习C将教会您更多关于物理机器的内存使用情况,正如您提到的,这就是 CLR 在底层使用的内容。 学习 CLR 的工作原理并不会让您像学习 C 那样深入了解垃圾收集等问题。通过 C,您可以真正了解内存管理所涉及的内容。
另一方面,与学习 C 相比,学习 CIL 可以让您更多地了解 .NET 中的执行。 尽管如此,IL 如何映射到机器语言在很大程度上仍然是一个谜,因此了解一些高级操作码(例如用于转换类型的操作码)对于理解并没有多大帮助到底发生了什么,因为它们大部分都是不透明的。 然而,学习C和指针将会在其中一些方面启发您。
The CLR is a virtual machine so if that's all you learn, then you only know what's happening at a virtual level.
Learning C will teach you more about the physical machine as far as memory usage goes, which as you mention is what the CLR uses underneath. Learning how the CLR works isn't going to give you as much insight into, say, garbage collection, as learning C. With C, you really appreciate what's involved in memory management.
Learning CIL on the other hand, tells you a bit more about execution in .NET than you would by learning C. Still, how IL maps to machine language will still be a mystery for the most part so knowing some of the high-level opcodes, like the ones for casting types, isn't that helpful in terms of understanding what's really going on as they're opaque for the most part. Learning C and pointers, however, will enlighten you on some of those aspects.
问题是学习 C 还是 MSIL,还是更基础? 我想说的是,总的来说,更多的开发人员可以更多地了解物理或虚拟计算机的工作原理。 一个人只需了解一门语言和 API,就可以成为一名相当有能力的程序员。 为了将这个职业提升到一个新的水平,我觉得开发人员确实需要了解整个堆栈。 不一定要详细,但要有足够的概括性,以帮助解决问题。
这里讨论的许多技能可以通过更多地了解编译器和语言设计来获得。 您可能需要学习 C 才能做到这一点(哎呀,偷偷摸摸),但是编译器编写是学习 C 的一个很好的背景。 Steve Yegge 在他的博客上讨论了这个,在这一点上我基本上同意他的观点。 我在大学时的编译器编写课程是我学过的最令人大开眼界的课程之一,我真的希望它是一门 200 级的课程,而不是 400 级的一级课程。
Is the issue learning C or MSIL, or is it more fundamental? I'd say that in general, more developers could stand to learn more about how computers, physical or virtual, work. A person can get to be a fairly competent programmer by only understanding a language and API in a box. To take the profession to the next level, I feel that developers really need to understand the whole stack. Not necessarily in detail, but in sufficient generality to help solve problems.
A lot of these skills are being talked about here can be acquired by learning more about compilers and language design. You probably need to learn C to do this (whoops, sneaky), but compiler writing is a great context to learn C in. Steve Yegge talks about this on his blog, and I largely agree with him on this point. My compiler writing course in university was one of the most eye opening courses I've ever taken, and I really wish it had been a 200 level course, instead of a 400 level one.
I posted this on another thread but it applies here to:
I believe you need a good foundation, but devote most of your time to learning what you will be using.
Learn enough assembler to add two numbers together and display the result on a console. You'll have a much better understanding of what is actually going on with the computer and it will make sense as to why we use binary/Hex. (this can be done in a day and can be done with debug from cmd.exe).
Learn enough C to have to allocate some memory and use pointers. A simple linked list is sufficient. (this can be done in a day or two).
Spend more time learning a language that you are going to use. I would let your interests steer you into which language (C#, Java, Ruby, Python, etc.).
Of course you should. The greatest way to become overly specialized and single-minded (and, correspondingly, have limited marketable skills) is to only work with a single type of language and eschew all others as "not related to your current task."
Every programmer should have some experience with a modern JIT'd OO language (C#/Java), a lower-level simpler language (C, FORTRAN, etc), a very high level interpreted language (Python, Ruby, etc), and a functional language (Scheme, Lisp, Haskell, etc). Even if you don't use all of them on a day-to-day basis, the broadening of your thought process that such knowledge grants is quite useful.
我的看法是,我们应该始终分配时间来学习我们还不知道的东西。 为了回答你的问题,我认为学习 C 对你来说不是必要的,但如果你有空闲时间,C 是一门很好学习的语言,并且与任何其他语言一样有效。
I already know C and that helped me during the 1.1 days where there are a lot of things that are not yet in the .NET base libraries and I have to P/Invoke something from the Platform SDK.
My take is that we should always allocate a time for learning something that we don't know yet. To answer your question, I don't think it is essential for you to learn C but if you have some time to spare, C is a good language to learn and is just as valid as any other language out there.
发布评论
评论(15)
.NET 开发人员应该了解 CLR。 但他们也应该学习 C。如果不对裸机上发生的情况有一些低层次的了解,我不明白任何人如何能够真正理解 CLR 的工作原理。
花时间学习更高层次的概念当然是有益的,但如果你过于专注于高层概念而忽视了底层概念,你就有可能成为那些能在白板上画框和画线的“建筑师”之一但谁无法编写任何实际代码。
通过学习 C 语言所学到的知识将对您余下的职业生涯有用。 随着 Microsoft 改变其平台,您所了解的有关 CLR 的知识将变得过时。
.NET developers should learn about the CLR. But they should also learn C. I don't see how anybody can really understand how the CLR works without some low-level understanding of what happens on the bare metal.
Spending time learning about higher-level concepts is certainly beneficial, but if you concentrate too much on the high-level at the expense of the low-level, you risk becoming one of those "architect" people who can draw boxes and lines on whiteboards but who are unable to write any actual code.
What you learn by learning C will be useful for the remainder of your career. What you learn about the CLR will become obsolete as Microsoft changes their platform.
我的看法是,学习一些编译语言和汇编是必须的。 否则,您将无法获得在语言和堆栈之间切换所需的多功能性。
更具体地说——我认为任何优秀/伟大的程序员都必须通过直接经验知道这些事情:
了解这些事情是使用您理解的系统与据您所知可以神奇工作的系统之间的区别。 :)
为了解决一些评论,
您最终会遇到两种不同类型的开发人员:
我强烈认为第二组总体上是更好的开发人员。
My take is that learning some compiled language and assembly is a must. Without that, you will not get the versatility required to switch between languages and stacks.
To be more specific -- I think that any good/great programmer must know these things by direct experience:
Knowing these things is the difference between working with a system you understand and a system that, for all you know, works by magic. :)
To address some comments
You end up having two different kinds of developers:
I strongly think that the second group are the better developers overall.
我是这样想的:
I think of it like this:
要在编写 C# 方面取得足够的进步,您需要理解 C 中的概念,即使您没有正确学习该语言。
但更一般地说,如果您认真对待任何技能,您应该知道在您的主要工作级别以下至少一个抽象级别上发生了什么。
To be sufficiently advanced in writing C#, you need to understand the concepts in C, even if you don't learn the language proper.
More generally though, if you're serious about any skill, you should know what goes on at least one abstraction level below your primary working level.
我喜欢每年学习一门新语言。 不一定要掌握它,而是强迫我的大脑以不同的方式思考。
我觉得学习 C 是一种很好的语言,可以学习低级概念,而无需经历汇编编码的痛苦。
然而,我觉得从 Haskell、Python 甚至可以说是 regex(不完全是一种语言,但你明白我的意思了吗?)等语言中学习经验教训与从 C 中收集经验教训一样重要。
所以我说,了解 CLR如果您所在的领域是工作中的 MSIL,那么在业余时间,请尝试时不时地学习一种不同的语言。 如果今年碰巧是 C,那么对你有好处,并且喜欢玩指针;)
I like to learn a new language every year. Not necessarily to master it, but to force my brain to think in different ways.
I feel learning C is a good language to learn about low level concepts without the pain of coding in assembly.
However I feel that learning lessons from languages like Haskell, python, and even arguably regex (not exactly a language, but you catch my drift?) is as important as the lessons to be gleaned from C.
So I say, learn about the CLR and MSIL on the job if thats your area, and in your spare time, try picking up a different language once every so often. If that happens to be C this year, good for you and enjoy playing with pointers ;)
我看不出他们有什么理由应该这样做。 Java 和 C# 等语言的设计使您无需担心底层细节。 这就像询问 WinForms 开发人员是否应该花时间学习 Win32 API 一样,因为这就是底层发生的事情。
虽然学习它并没有坏处,但花更多时间学习您熟悉的语言和平台可能会收获更多,除非非常需要学习低级技术细节。
I don't see any reason why they should. Languages like Java and C# were designed so that you needn't worry about the low-level details. That's the same like asking whether a WinForms developer should spend time learning the Win32 API because that's whats happening underneath.
While it doesn't hurt to learn it, you'd probably gain more from spending more time learning the languages and platforms you are familiar with, unless there's a good need to learn the low-level technical details.
学习 MSIL 并不是一个坏主意,但在某种程度上它只是另一种 .NET 语言,但语法很糟糕。 不过,这是另一层,我认为人们至少应该对所有层有一些模糊的理解。
C 有点像具有更好语法的汇编语言,是了解在相当低的级别上发生的事情的好方法(尽管有些事情仍然对您隐藏)。
从另一端来看,我认为每个人都应该了解一些像 Haskell 或 Lisp 这样的东西,以了解更高层次的东西(并以更清晰的形式看到 C# 3 中引入的一些想法)
It can't be a bad idea to learn MSIL, but in a way it's just another .NET language, but with nasty syntax. It is another layer down, though, and I think people should have at least some vague understanding of all the layers.
C, being somewhat like assembly language with nicer syntax, is a nice way to get an idea of what's happening on quite a low level (although some things are still hidden from you).
And from the other end, I think everyone should know a bit of something like Haskell or Lisp to get an idea of higher-level stuff (and see some of the ideas being introduced in C# 3 in a cleaner form)
如果你认为自己是一名程序员,我会说是的,学习 C。
许多编写代码的人并不认为自己是程序员。 我每天工作时可能会编写 .NET 应用程序 3 个小时,但我并不给自己贴上“程序员”的标签。 我做了很多与编程无关的事情。
如果您整天都在编程或思考编程,并且您将使您的整个职业生涯都围绕着编程,那么您最好确保自己了解自己的知识。 学习 C 可能有助于建立知识基础,如果您想深入了解编程技能,这将很有帮助。
凡事都有取舍。 你学习的语言越多,你花在技术上的时间越多,你学习其他技能的时间就越少。 比如,是学C语言好,还是看项目管理方面的书好? 这取决于你的目标。 你想成为最好的程序员EVAR吗? 学习 C。花大量时间编写代码并全身心投入这项技术。 您是否曾经想过管理其他人而不是整天编码? 利用您投入编程的时间来寻找提高您的软技能的方法。
If you consider yourself a programmer, I would say yes, learn C.
Many people who write code do not consider themselves programmers. I write .NET apps maybe 3 hours a day at work, but I don't label myself a "programmer." I do a lot of things that have nothing to do with programming.
If you spend your whole day programming or thinking about programming, and you are going to make your entire career revolve arround programming, then you better be sure you know your stuff. Learning C would probably help build a base of knowledge that would be helpful if you're going to go very deep in programming skills.
With everthing, there are trade-offs. The more languages you learn, and the more time you spend dedicated to technology, the less time you have for learning other skills. For example, would it be better to learn C, or read books on project management? It depends on your goals. You want to be the best programmer EVAR? Learn C. Spend hours and hours writing code and dedicating yourself to the craft. You ever want to manage somebody else instead of coding all day? Use the time you would put into programming and find ways to improve your soft skills.
.net 开发人员应该学习 C 语言吗? 我想说“不一定”,但我们应该始终涉足我们专业范围之外的某种语言,因为每种语言都会带来思考问题的新方式。 在我作为 .net(以及之前的 VB 2-6)开发人员的职业生涯中,我用 Pascal、LISP、C、C++、PHP、JavaScript、Ruby 和 Python 编写了小项目,目前正在涉足 Lua 和珀尔。
除了 C++ 之外,我没有在简历中列出任何其他语言,因为我不想成为其中任何一个的专业人士。 相反,我从他们每个人那里带回了有趣的想法,并将其用于我基于 .net 的工作中。
C 语言很有趣,因为它确实让您接近操作系统,但这并不是成为一名优秀程序员所需了解的唯一级别。
Should .net developers be learning C? I would say "not necessarily," but we should always be dabbling in some language outside of our professional bailiwick because every language brings with it a new way of thinking about problems. During my professional career as a .net (and before that, VB 2-6) developer, I've written small projects in Pascal, LISP, C, C++, PHP, JavaScript, Ruby, and Python and am currently dabbling in Lua and Perl.
Other than C++, I don't list any of them on my resume because I'm not looking to be a professional in any of them. Instead, I bring back interesting ideas from each of them to use in my .net-based work.
C is interesting in that it really gets you close to the OS, but that's hardly the only level you need to know about to be a good programmer.
CLR 是一个虚拟机器,因此如果这就是您所学到的全部内容,那么您只知道虚拟级别发生了什么。
学习C将教会您更多关于物理机器的内存使用情况,正如您提到的,这就是 CLR 在底层使用的内容。 学习 CLR 的工作原理并不会让您像学习 C 那样深入了解垃圾收集等问题。通过 C,您可以真正了解内存管理所涉及的内容。
另一方面,与学习 C 相比,学习 CIL 可以让您更多地了解 .NET 中的执行。 尽管如此,IL 如何映射到机器语言在很大程度上仍然是一个谜,因此了解一些高级操作码(例如用于转换类型的操作码)对于理解并没有多大帮助到底发生了什么,因为它们大部分都是不透明的。 然而,学习C和指针将会在其中一些方面启发您。
The CLR is a virtual machine so if that's all you learn, then you only know what's happening at a virtual level.
Learning C will teach you more about the physical machine as far as memory usage goes, which as you mention is what the CLR uses underneath. Learning how the CLR works isn't going to give you as much insight into, say, garbage collection, as learning C. With C, you really appreciate what's involved in memory management.
Learning CIL on the other hand, tells you a bit more about execution in .NET than you would by learning C. Still, how IL maps to machine language will still be a mystery for the most part so knowing some of the high-level opcodes, like the ones for casting types, isn't that helpful in terms of understanding what's really going on as they're opaque for the most part. Learning C and pointers, however, will enlighten you on some of those aspects.
问题是学习 C 还是 MSIL,还是更基础? 我想说的是,总的来说,更多的开发人员可以更多地了解物理或虚拟计算机的工作原理。 一个人只需了解一门语言和 API,就可以成为一名相当有能力的程序员。 为了将这个职业提升到一个新的水平,我觉得开发人员确实需要了解整个堆栈。 不一定要详细,但要有足够的概括性,以帮助解决问题。
这里讨论的许多技能可以通过更多地了解编译器和语言设计来获得。 您可能需要学习 C 才能做到这一点(哎呀,偷偷摸摸),但是编译器编写是学习 C 的一个很好的背景。 Steve Yegge 在他的博客上讨论了这个,在这一点上我基本上同意他的观点。 我在大学时的编译器编写课程是我学过的最令人大开眼界的课程之一,我真的希望它是一门 200 级的课程,而不是 400 级的一级课程。
Is the issue learning C or MSIL, or is it more fundamental? I'd say that in general, more developers could stand to learn more about how computers, physical or virtual, work. A person can get to be a fairly competent programmer by only understanding a language and API in a box. To take the profession to the next level, I feel that developers really need to understand the whole stack. Not necessarily in detail, but in sufficient generality to help solve problems.
A lot of these skills are being talked about here can be acquired by learning more about compilers and language design. You probably need to learn C to do this (whoops, sneaky), but compiler writing is a great context to learn C in. Steve Yegge talks about this on his blog, and I largely agree with him on this point. My compiler writing course in university was one of the most eye opening courses I've ever taken, and I really wish it had been a 200 level course, instead of a 400 level one.
我将其发布在另一个线程上,但它适用于:
我相信您需要一个良好的基础,但将大部分时间用于学习您将使用的内容。
I posted this on another thread but it applies here to:
I believe you need a good foundation, but devote most of your time to learning what you will be using.
确实,C 远远低于链条。 了解 MSIL 可以帮助开发人员了解如何更好地优化他们的应用程序。 至于学习 C 或 MSIL,为什么不两者都学习呢? :)
True, C is way below the chain. Knowing MSIL can help devs understand how to optimise their apps better. As for learning C or MSIL, why not both? :)
当然你应该。 变得过于专业化和专一(并且相应地,市场技能有限)的最好方法是只使用单一类型的语言,并避开所有其他类型的语言,因为“与你当前的任务无关”。
每个程序员都应该对现代 JIT OO 语言(C#/Java)、较低级别的简单语言(C、FORTRAN 等)、非常高级的解释语言(Python、Ruby 等)和函数式语言(Scheme、Lisp、Haskell 等)。 即使您在日常工作中并不使用所有这些知识,这些知识所赋予的拓宽您的思维过程也是非常有用的。
Of course you should. The greatest way to become overly specialized and single-minded (and, correspondingly, have limited marketable skills) is to only work with a single type of language and eschew all others as "not related to your current task."
Every programmer should have some experience with a modern JIT'd OO language (C#/Java), a lower-level simpler language (C, FORTRAN, etc), a very high level interpreted language (Python, Ruby, etc), and a functional language (Scheme, Lisp, Haskell, etc). Even if you don't use all of them on a day-to-day basis, the broadening of your thought process that such knowledge grants is quite useful.
我已经了解 C,这在 1.1 期间对我很有帮助,其中有很多 .NET 基础库中还没有的东西,我必须从 Platform SDK 中 P/Invoke 一些东西。
我的看法是,我们应该始终分配时间来学习我们还不知道的东西。 为了回答你的问题,我认为学习 C 对你来说不是必要的,但如果你有空闲时间,C 是一门很好学习的语言,并且与任何其他语言一样有效。
I already know C and that helped me during the 1.1 days where there are a lot of things that are not yet in the .NET base libraries and I have to P/Invoke something from the Platform SDK.
My take is that we should always allocate a time for learning something that we don't know yet. To answer your question, I don't think it is essential for you to learn C but if you have some time to spare, C is a good language to learn and is just as valid as any other language out there.