Live data from Hacker News

Why Learn to Program in C?

philipbuuck.com

101–110 of 123 posts

Re: Why Learn to Program in C?

#101
post #99

Earlier quoted context omitted.

Ruby is written in C Python is written in C Lua is written in C

I don't write Python in C /s You meant Ruby, Python and Lua have their reference implementations written in C. They all also have other implementations written in other languages.

That's what I meant. Most important programs are written in C. Look at what program you are running now. See if you can find the standard C library it links to.

Re: Why Learn to Program in C?

#102
post #100

Earlier quoted context omitted.

I hesitated to say that, but to me the most important part is paradigm and structures/patterns. lisp will teach you untyped tree recursion and metalevel perspective. ml/haskell will teach you typed composition. prolog goal based space exploration. forth stacks. APL arrays. C/Pascal etc are supposed to teach you 'imperative' but I believe imperative is mostly a conflation of lots of things, mutable state.. at best you…

I agree with you but I think paradigms are more of a "second" language problem than a "first language" problem.

You may be right. It's hard for me to really put myself in the shoes of a completely new learner.

Re: Why Learn to Program in C?

#103
post #93

Earlier quoted context omitted.

Learning to program is about solving problems using a computer. Any programming language allows this, however some languages make it harder than others, and C is in that category. A language like Python has very little quirks that will stump a person coding for the first time in their life; in C they'll wonder "what does int main(int argc, char argv) mean?", "why is there a & before my variable in a scanf but not in…

>in C they'll wonder "what does int main(int argc, char argv) mean? They'll only wonder that if the book / course / instructor teaching them C, does NOT explain it to them. Which would be more of a reflection on said book / course / instructor than on the C language or the students.

For students who are just learning to wrestle with the programming concept, python is far superior because it lets the student focus more on what to express and when, and less on remembering silly things like curly braces and semicolons.

Re: Why Learn to Program in C?

#104
Interesting. I havent' delved quite much in to C but no doubt I will try to get more in to it during my spare time. IT's a good basis that some other high entity languages drew their cues from

Re: Why Learn to Program in C?

#105
post #76

Earlier quoted context omitted.

Which languages ? How common is it for people to get better understanding by travelling in other programming cultures ? My personal experience goes this way but I rarely hear it.

I'm not the parent poster but in my opinion, any language that doesn't frustrate the beginner is fine. The most important thing for learning is practice and if that is not fun people will end up quiting to do something else.

Yeah exactly a simple language like Python, with simple rules, one way to do a thing, and not the opposite.

Re: Why Learn to Program in C?

#106
post #103
post #93

Earlier quoted context omitted.

>in C they'll wonder "what does int main(int argc, char argv) mean? They'll only wonder that if the book / course / instructor teaching them C, does NOT explain it to them. Which would be more of a reflection on said book / course / instructor than on the C language or the students.

For students who are just learning to wrestle with the programming concept, python is far superior because it lets the student focus more on what to express and when, and less on remembering silly things like curly braces and semicolons.

First, braces and semicolons are not silly. They are just a different form of syntax than indentation. (And I say that as a Pythonista of many years, who also learned and then used C a lot before learning Python.)

Second, your point may (or not) be correct, but it is at best tangentially related to the point I was replying to, or to mine.

Re: Why Learn to Program in C?

#107
post #84

Earlier quoted context omitted.

> hardware support for base+displacement addressing Not sure exactly what you mean by the "hardware support" part, unless it is machine instruction support of some kind for C syntax. (But I thought that a basic level of support for that was present in most processors - things like base + offset addressing mode, indirect addressing via the value in a register, etc.) But: a[i] is equivalent to star(a + i) in C. (The K&…

> Not sure exactly what you mean by the "hardware support" part, Yes I should have been clearer, and said no penalty or minimal penalty, support for base+offset address calculation. A fair number of machines a couple decades ago, had additional latency or throughput penalties for addressing modes that required address calculation. This is still true in some cases for more complex calculations. So the use of pointer a…

Got it now, thanks. Did not know that.

Re: Why Learn to Program in C?

#108
The problem with learning C is it's easy to code things that work most of the time, but not always. A great many C coders don't really understand the architecture, and they don't get the immediate feedback that learning requires.

In my last big C project it wasn't uncommon at all to find memory leaks and out of scope references to stack variables. You'd add a line of code and the whole thing would blow up because it changed the state of the stack and unmasked a problem in another module. I would find the culprit and figure out if they were being sloppy or they just didn't understand, and it was usually the latter. This from people who had been programming professionally for a year or two.

Re: Why Learn to Program in C?

#109
post #105
post #76

Earlier quoted context omitted.

I'm not the parent poster but in my opinion, any language that doesn't frustrate the beginner is fine. The most important thing for learning is practice and if that is not fun people will end up quiting to do something else.

Yeah exactly a simple language like Python, with simple rules, one way to do a thing, and not the opposite.

What I like the most in python is, until you peek too much below, the curated features that make it small yet expressive:

- tiny set of builtins: list, dict, set - literal - slices - small syntax, and canonical indentation - simple mapping between some operators and class methods

you have enough to abstract a bit but not too much without drowning in details.

Re: Why Learn to Program in C?

#110
post #106
post #103

Earlier quoted context omitted.

For students who are just learning to wrestle with the programming concept, python is far superior because it lets the student focus more on what to express and when, and less on remembering silly things like curly braces and semicolons.

First, braces and semicolons are not silly. They are just a different form of syntax than indentation. (And I say that as a Pythonista of many years, who also learned and then used C a lot before learning Python.) Second, your point may (or not) be correct, but it is at best tangentially related to the point I was replying to, or to mine.

I don't think it's tangentially related at all. The cognitive load of trying to program for the first time is quite high.

If the student doesn't have to focus on remembering whether or not you need a semicolon or a colon on switch statement cases, they can focus more on actually grokking the process of translating thoughts and algorithms to code.

Post reply on HN