Live data from Hacker News

Learn C, Then Learn Computer Science

qrohlf.com

11–20 of 134 posts

Re: Learn C, Then Learn Computer Science

#11

Personally I take a different view: learn a high-level language, use it to study computer science, and if you feel like writing some low-level code go ahead and learn C (though even then, you could probably do better by bootstrapping a compiler for your favorite high-level language and adding some extensions for low-level operations). C is not the best or even a particularly good language to try to learn abstract CS…

The thing that makes C a good candidate is that it's a very very small language. Yes there are plenty of strange quirks that the experts need to deal with but you can come up with an elegant and compact implementation of every standard data structure.

High level languages tend to favor one data structure over another. Starting with those languages can give students the "hammer syndrome" w.r.t. that structure.

Re: Learn C, Then Learn Computer Science

#12

Personally I take a different view: learn a high-level language, use it to study computer science, and if you feel like writing some low-level code go ahead and learn C (though even then, you could probably do better by bootstrapping a compiler for your favorite high-level language and adding some extensions for low-level operations). C is not the best or even a particularly good language to try to learn abstract CS…

C is about as close to teaching the mechanics of the computer as you can get while staying portable. I've found that my ISA knowledge "just works" on any architecture though, so I would feel okay teaching something like C-- or LLVM IR along with an arbitrary ISA to allow the mind to have a lowest-common denominator. CS is to CE as Chemistry is to Physics. Chemistry lets you do a lot with less, but Physics is where you understand a lot and have the capability to do things that can't be introspected using only a knowledge of Chemistry. The guts of CS are a great place to expand after a certain point.

Re: Learn C, Then Learn Computer Science

#13
post #4

Lean C when you need to grok how memory works in computing. Learn Scheme to grok the science of computing. Learn BSD when you want to understand operating systems and the network stack. Grok engineering when you write a scheme->c translator running on BSD.

This feels highly prescriptive.

Re: Learn C, Then Learn Computer Science

#14
Learn C and learn computer science.

Let's get away from subjective "shoulds" and talk about practical stuff. You want to learn things, as much as possible, that (a) are likely to remain useful in 15 years and (b) are going to qualify you for the highest quality of jobs.

C, as a language, passes this test. So do the fundamentals of computer science; they may not bring you quantity in job opportunities, but they'll give you access to quality. Aside from that? Well, it's hard to predict the future. I can't make individual calls. Who would have thought JavaScript would be so popular in 2014? The whole language is a hack. But if you learned it in 2000, you still have a high-demand skill set.

Learning one thing or one small set of things won't do, though. You need to future-proof yourself with a wider knowledge portfolio, and very few jobs will teach a person to do that.

On the other hand, if you learn a lot of useless and parochial crap that won't generalize (i.e. the quirks of your own corporate codebase) you get to a semi-depressed state of "learnout" (you struggle to assimilate new things, because you've filled your brain with unrewarding crap) and that's no good either.

Re: Learn C, Then Learn Computer Science

#15

Personally I take a different view: learn a high-level language, use it to study computer science, and if you feel like writing some low-level code go ahead and learn C (though even then, you could probably do better by bootstrapping a compiler for your favorite high-level language and adding some extensions for low-level operations). C is not the best or even a particularly good language to try to learn abstract CS…

The thing that makes C a good candidate is that it's a very very small language. Yes there are plenty of strange quirks that the experts need to deal with but you can come up with an elegant and compact implementation of every standard data structure. High level languages tend to favor one data structure over another. Starting with those languages can give students the "hammer syndrome" w.r.t. that structure.

I see this a lot with functional programmers and linked lists. Yeah you can derive a lot of data structures from a list, but sometimes it's like putting a square peg into a round hole, and a custom data structure would be more efficient.

Re: Learn C, Then Learn Computer Science

#16
Joel Spolsky wrote a good article about this called "Back to Basics" (src: http://www.joelonsoftware.com/articles/fog0000000319.html ). My favorite quote from it (capitalization modified) is, "If you want to teach somebody something well, you have to start at the very lowest level. It's like Karate Kid. Wax on, wax off. Wax on, wax off. Do that for three weeks. Then knocking the other kid's head off is easy."

Re: Learn C, Then Learn Computer Science

#17
post #4

Lean C when you need to grok how memory works in computing. Learn Scheme to grok the science of computing. Learn BSD when you want to understand operating systems and the network stack. Grok engineering when you write a scheme->c translator running on BSD.

This feels highly prescriptive.

It's mostly true though, especially about BSD. The BSD TCP/IP stack code is used for teaching about network stack implementations, and Scheme is extremely useful for exploring theoretical ideas.

Re: Learn C, Then Learn Computer Science

#18
> This semester I used function pointers in an assignment and later heard them described as “Quinn’s magic C voodoo”.

I still think I have to polish up on 'em:

  #include 
  #include 
  //
  int chk_arg(char *s, int (*f)(int)) {
    while(*s)
      if(!(f(*s)))
        return 1;
      else
        ++s;
    return 0;
  }
  //
  char *s[]= { "1048leet576", "numbers only pls\n" };
  if(chk_arg(*s, isdigit))
    printf(*(s+1));
> This was confusing - my classmates were juniors and seniors who were 3+ years into a computer science degree, yet many of them didn’t seem to have an understanding of how computers worked. They could write high-level code and analyze algorithms, but had never used malloc.

What the hell, CS students who haven't used malloc? I've got no formal background in CS, yesterday I wrote a binary search tree in C that passed valgrind.

Re: Learn C, Then Learn Computer Science

#19
post #3

Does any one know of any good self study resources (or online courses) on this subject?

The C Programming Language by Brian W. Kernighan and Dennis M. Ritchie (Kernighan has 2 other good programming books too) and/or look around youtube for tutorials on C. MIT has this online, lecture notes were good enough for me plus K&R book http://ocw.mit.edu/courses/electrical-engineering-and-comput...

This is a good course about architecture http://www.nand2tetris.org/course.php

Re: Learn C, Then Learn Computer Science

#20

Personally I take a different view: learn a high-level language, use it to study computer science, and if you feel like writing some low-level code go ahead and learn C (though even then, you could probably do better by bootstrapping a compiler for your favorite high-level language and adding some extensions for low-level operations). C is not the best or even a particularly good language to try to learn abstract CS…

The thing that makes C a good candidate is that it's a very very small language. Yes there are plenty of strange quirks that the experts need to deal with but you can come up with an elegant and compact implementation of every standard data structure. High level languages tend to favor one data structure over another. Starting with those languages can give students the "hammer syndrome" w.r.t. that structure.

Scheme is a small language as well, and it is worlds better for teach abstract concepts. You can write far more elegant and compact implementations of data structures in Scheme than you can write with C.

As for preferring one data structure over another, C does that as well: arrays are the only data structure with first-class support.

Post reply on HN