Re:A Scripter at Heart
by rbanffy on Monday January 26, 2009 @08:16AM
(#450354)
Well... While coding mostly in Python, I am still a programmer. I am only using a more refined tool more adequate to my needs than C would ever be.
Obviously, I disagree with the "C programmers have to be masochists" view of the article. C is powerful and can be cruel and unforgiving, but once you get it (and it's not that hard), you can appreciate how powerful it really is.
As for the pain of going from interactive-prompt-nirvana to edit-compile-link-run-wonderwtf-reboot hell, it took me years to learn C++ because I was introduced to OOP in Smalltalk and then wrote some stuff in Actor. C++ most definitely, did not look like a step in the right direction. In fact, it wasn't.
For years, I used the following tagline in my BBS messages:
"Hello World in Assembly: 30 bytes, Hello World in Turbo Pascal: 10K, Hello World in C: STACK-OVERFLOW: SYSTEM HALTED"
Re:A Scripter at Heart
by sanswork on Monday January 26, 2009 @08:34AM
(#450363)
10-12 years ago I was hearing people say that exact same thing about asm when I was first learning C. I wonder what they will be saying in 10 years is essential?
Re:A Scripter at Heart
by lbrandy on Monday January 26, 2009 @08:40AM
(#450367)
Uhm. Maybe 25 years ago. That was when you had to actually check the output from time to time because the compilers were so bugged and often terrible at their job. 10 years ago you needed to learn C to understand how Perl worked.
In 10 years "they" will still be saying learn C because C is nothing but a glorified assembly language with some syntactic sugar. C shows you how your computer works. There is very little to gain by using assembly over C (with the special exception of specialized instruction sets, like SIMD).
Until the computer changes so fundamentally that a simple imperative language no longer matches the hardware, or some other simple imperative language does a better job (unlikely), learning C will always be good advice.
Re:A Scripter at Heart
by pwk on Monday January 26, 2009 @12:00PM
(#450649)
In 10 years "they" will still be saying learn C because C is nothing but a glorified assembly language with some syntactic sugar. C shows you how your computer works.
It's possible to be a solid C programmer (ie clear understanding of pointers, stack vs. heap, etc) while still not having the depth of knowledge one gets from understanding at least some assembly. When I first learned about the concept of stack overflows (ie as explained in Smashing The Stack For Fun And Profit: http://insecure.org/stf/smashstack.html) my understanding of C really expanded, mostly through the added insight provided by thinking about C in the context of assembly.
Re:A Scripter at Heart
by philh on Monday January 26, 2009 @11:31AM
(#450595)
I would say that assembly taught me more about how my computer works as compared to C, than C did as compared to perl.
Maybe I just didn't dabble with C enough before dabbling in assembly, but that was where I really learned about the stack, registers, variable allocation and function calls. With C I mostly just thought in terms of perl and ignored the implementation details. Static typing, malloc/free, strings-as-arrays and arrays-as-pointers were new to me, but I don't feel like I really understood what was going on at that point.
Re:A Scripter at Heart
by plinkplonk on Monday January 26, 2009 @09:02AM
(#450395)
"10-12 years ago I was hearing people say that exact same thing about asm when I was first learning C"
Learning assembly does teach you quite a bit. I think that at some point every programmer would benefit greatly from knowing (an) assembly language and C.
Is it absolutely essential? (Depending on what exactly you are doing) No. Is it very useful? Definitely.
For that matter, an understanding of digital electronics, sufficient to understand how the CPU , ALU, memory caches etc work, can be very useful as well.
Re:A Scripter at Heart
by sofal on Monday January 26, 2009 @07:43PM
(#451375)
I think it would be great to see a day when the relative abstraction distance between Ruby and C is negligible compared to the available programming abstractions. A day when you can tell computers what to do in English, and when commanding the machine via any articulate and pedantic programming language is thought to teach one about the fundamentals of a computer.
Re:A Scripter at Heart
by sofal on Tuesday January 27, 2009 @09:53AM
(#452150)
I don't want to program in English...
When you tell someone to do something, do you lament the fact that you can't tell them in a programming language, detailing every single step precisely? When I talk about programming in English, it is not the kind of "programming" that you're used to. It's obviously subject to all the ambiguities and interpretation problems that humans have, yet somehow we manage to get by pretty well with it.
I didn't think I would have to actually explain that. Do you want me to put it to you in a programming language?
Re:A Scripter at Heart
by orib on Monday January 26, 2009 @07:24PM
(#451353)
I still think asm is essential to know. And I'm not even an old fart. Knowing assembly makes it far easier to rationalize about what my C programs are doing, how things will perform, what the machine actually does, and so on, even up into my Ocaml code (which is what I tend to work in for much of my code these days).
Even C doesn't teach you about cache behavior, register spilling, calling conventions, and so on.
Plus, it helps to know assembly massively when you're in the embedded domain, or whenever you're close to the metal.
Re:A Scripter at Heart
by omouse on Monday January 26, 2009 @03:32PM
(#450985)
The best way to understand how a modern computer system works is to learn the ASM of that language, read the manuals for the CPU/motherboard. You need to learn about registers, memory addresses, L1 and L2 caches, interrupts, etc. I don't see how C forces you to learn about any of that aside from memory addresses which you don't really need to deal with much (aside from passing pointers around and using malloc/dealloc).
Re:A Scripter at Heart
by silentbicycle on Monday January 26, 2009 @08:54AM
(#450386)
It's often a better design to keep the parts that are largely set/need to be efficient in a "hard" language like C (or something like Common Lisp with type annotations), but keep the parts that need to be flexible in a "soft" language like an embedded Lua, Python, or Scheme, etc. You don't have to use just one language.
Re:A Scripter at Heart
by bayareaguy on Monday January 26, 2009 @09:15AM
(#450403)
Larry Wall's epic Programming is Hard, Let's Go Scripting attempts to survey the scripting landscape and identify commonalities.
I would hardly call it an "epic". To the contrary people I spoke with who saw his state of the onion keynote that year said that unlike his prior presentations (which were often entertaining) that one was a disappointment especially considering the state of Perl at the time.
Obviously, I disagree with the "C programmers have to be masochists" view of the article. C is powerful and can be cruel and unforgiving, but once you get it (and it's not that hard), you can appreciate how powerful it really is.
As for the pain of going from interactive-prompt-nirvana to edit-compile-link-run-wonderwtf-reboot hell, it took me years to learn C++ because I was introduced to OOP in Smalltalk and then wrote some stuff in Actor. C++ most definitely, did not look like a step in the right direction. In fact, it wasn't.
For years, I used the following tagline in my BBS messages:
"Hello World in Assembly: 30 bytes, Hello World in Turbo Pascal: 10K, Hello World in C: STACK-OVERFLOW: SYSTEM HALTED"
In 10 years "they" will still be saying learn C because C is nothing but a glorified assembly language with some syntactic sugar. C shows you how your computer works. There is very little to gain by using assembly over C (with the special exception of specialized instruction sets, like SIMD).
Until the computer changes so fundamentally that a simple imperative language no longer matches the hardware, or some other simple imperative language does a better job (unlikely), learning C will always be good advice.
It's possible to be a solid C programmer (ie clear understanding of pointers, stack vs. heap, etc) while still not having the depth of knowledge one gets from understanding at least some assembly. When I first learned about the concept of stack overflows (ie as explained in Smashing The Stack For Fun And Profit: http://insecure.org/stf/smashstack.html) my understanding of C really expanded, mostly through the added insight provided by thinking about C in the context of assembly.
Maybe I just didn't dabble with C enough before dabbling in assembly, but that was where I really learned about the stack, registers, variable allocation and function calls. With C I mostly just thought in terms of perl and ignored the implementation details. Static typing, malloc/free, strings-as-arrays and arrays-as-pointers were new to me, but I don't feel like I really understood what was going on at that point.
Learning assembly does teach you quite a bit. I think that at some point every programmer would benefit greatly from knowing (an) assembly language and C.
Is it absolutely essential? (Depending on what exactly you are doing) No. Is it very useful? Definitely.
For that matter, an understanding of digital electronics, sufficient to understand how the CPU , ALU, memory caches etc work, can be very useful as well.
My 2 cents.
May it never come to pass...
"The horse rode past the barn fell."
When you tell someone to do something, do you lament the fact that you can't tell them in a programming language, detailing every single step precisely? When I talk about programming in English, it is not the kind of "programming" that you're used to. It's obviously subject to all the ambiguities and interpretation problems that humans have, yet somehow we manage to get by pretty well with it.
I didn't think I would have to actually explain that. Do you want me to put it to you in a programming language?
Personally, I think the importance of C will remain, as it's basically portable assembly. But time will tell.
Even C doesn't teach you about cache behavior, register spilling, calling conventions, and so on.
Plus, it helps to know assembly massively when you're in the embedded domain, or whenever you're close to the metal.
http://c2.com/cgi/wiki?AlternateHardAndSoftLayers
I would hardly call it an "epic". To the contrary people I spoke with who saw his state of the onion keynote that year said that unlike his prior presentations (which were often entertaining) that one was a disappointment especially considering the state of Perl at the time.
So-called scripting languages were discussed a decade or so ago.