Hacker News new | ask | show | jobs
by vortico 2916 days ago
I agree with meatbundragon's comment "learn whatever you need first", but for a computer science degree program, I've held the opinion for a decade that students should learn Python first to get a feel of how humans should think and then C in their second year to learn how computers think.

Assembly is too niche for all students to learn it, and Java/C# are each too isolated from other environments, whereas C is behind most everything we use and teaches you about linking/compiling more than any other environment. After students are comfortable with Python and C, they or their program can choose whatever they find fit for their goals.

5 comments

Assembly is not that difficult if you pick a suitable target and environment - possibly a virtualised one for early learning. Make sure you can single-step cleanly. And this is really how computers "think", while C is full of traps that fall between the language abstraction and the compiled realisation.

(The book "C traps and pitfalls" remains one of the most instructive programming books I've ever read, and more languages could do with one)

C is a good enough approximation to the level students need. Many will never use or even think about assembly again, especially on the architecture they happen to be taught, but most will use some derivative of C syntax and semantics. For the 25-50% that will, sure, that'll be a good third language, but remember that most will develop web frontends or industrial logic for the rest of their life.
> Many will never use or even think about assembly again, especially on the architecture they happen to be taught, but most will use some derivative of C syntax and semantics.

This is deems true in my case. At my community college, I took a lower division Computer Architecture course, also known as Computer Organization and Assembly Language, a year or two ago and I recall little from it unfortunately. Yet, I still go back to the practices I learned from taking a course in C.

Is that really true though? Looking at performance optimizations that people do, understanding C is a minimal part of understanding how computers work. It's sort of a codified fiction masking a much more complex reality.

C ignores the complexities of the cache hierarchy and register allocation and IPC extraction. If I code in a garbage collected language I can ignore one more complexity. But C is closer to Java than to the ALU.

Maybe learning LLVM IR would be more useful than either, as it will me allow to debug/reason about the performance impact of the abstractions of many languages backed by LLVM.

For the 25-50% that need it, sure, those would make good third or fourth languages. My point is that Python and C should be the first two, not the only two languages they learn in college. My reason for recommending C is to get an overview of what "writing for the computer" feels like with complex data structures, not memorizing the Intel x86_64 manual. Would you expect 100% of CS students to be prepared to learn cache hierarchy and register allocation in their second year? I know a few CS graduates that somehow didn't manage to learn single a programming language (to fizz-buzz level), even in state universities, not talking about community colleges. I think we should step back and look at what all students need, not only the advanced ones.
Im sorry but if someone graduated with a CS degree and can't write an if-else, the teaching was not the problem. I knew a few people like this, but they had to cheat their way through & do 0 work on team assignments.

Students need curiosity & motivation to get to the fiz buzz level, not a specific intro language

And then there are those that legitimately try really hard but still have difficulty with control flow logic and algorithms in their second year, so this is what they should be taught. You can't just ignore them. Skipping ahead to cache access, instructions, and registers in just their second year leaves them behind. There's tons to learn about programming in two years for even the best students that doesn't require intricate knowledge of the machine. Assembly is just not realistic for the majority of sophomores. Additionally, it would be a disservice to teach languages that don't align with industry attention. C is used perhaps 4 orders of magnitude more than LLVM IR.
I never argued for learning llvm, the comment I replied to mentioned CS grads that could not write fiz buz in ANY language. I would never suggest going 0 to 100 like that
I definitely agree. I took C first then Python. Where I took the courses, the C course was an intermediate programming course while the Python course was an introductory to programming course (I think this the case for many colleges, not entirely certain). Python, personally, seems like such a good introduction to programming language because the syntax seems so English-like. But otherwise, at my community college, after one takes the C course they usually go on to take a C++ course then a Data Structures course where the majority, if not all, the students use C++. All these courses being lower division.

I find it's a good skillset to have: Python for scripting, backend, and frontend with Django. C/C++ for other purposes I'm not entirely aware of, maybe if you like working with video games, browsers, operating systems, etc. Then a proficient understanding of HTML/CSS doesn't hurt, and anyways web development is pretty darn fun since designing and playing with things is cool. Those are my tools, or at least I like to think those are my tools: Python, C/C++, HTML/CSS.

Given what I mentioned above and the courses I have taken, I still don't feel like a programmer though. I mean you could give me a basic problem and I can probably write a simple, elegant solution in five hours or so but I'm going to have to look at the documentation or Google how to do some specific task. It might be that I've only taken lower division courses or only built stuff following tutorials online (Treehouse, etc), but I still don't feel competent and because of this, I've been thinking about finishing my degree in computer science but moving into product management as a professional job. I'm definitely going to try to program daily though.

> [...] I still don't feel like a programmer though. I mean you could give me a basic problem and I can probably write a simple, elegant solution in five hours or so but I'm going to have to look at the documentation or Google how to do some specific task. It might be that I've only taken lower division courses or only built stuff following tutorials online (Treehouse, etc), but I still don't feel competent [...]

What's wrong with that? If you are able to develop working stuff by yourself, with help of documentation and WWW, it's perfectly alright - those are the tools you will usually have in the real world anyway. You can't keep all the details for various topics, or different library APIs in your head anyway.

You're right. It's just, from an outsider's perspective that has only worked blue-collared jobs (think meat clerk, greenskeeper), the technology industry's interview or working in technology as programmer seems a bit daunting, even especially as a minority. I'm still an undergraduate (spending a fourth year taking interesting lower division courses at my community college) but it might be a combination of imposter syndrome on my part and not feeling I know enough. I mean, again for instance, I can tell you off the top of my head how six sorting algorithms work and their respective o-notations. But if I had to write them? I would probably need the entire day and no one looking over my shoulder. I can write a fizz buzz program in ten minutes or so but I can't tell you off the top of my head how pointers work or how polymorphism works, I would have to look it up.

I just feel if I ever get a software engineering internship one of these summers, I will ask myself: what am I doing here? After all, I take a long time to write good piece of code. I'll think I'm holding my team back. If I'm building stuff on my own, in my own time, I'm fine and dandy. But otherwise, I'll be stressed and nervous.

Everyone starts somewhere. Take into account that you are just studying it from time to time. At work you will be actively doing things 5-8 hours a day, almost every day. Take your time, people generally expect even experienced programmers to take a month to catch up to speed on a new job. After month or two of such intensive training you will learn a lot too. Make sure that your learning is directed i.e. don't just solve problems, but figure out how and why they occurred etc. What approaches people took before you etc. In general, read a lot of relevant literature, especially articles and books. And after a year or two you will start hitting point of diminishing returns. There is really only so much that people need to know to do day to day work.

Then there is elusive experience, but that will come with time as you will observe first hand how silver bullets turn into legacy ;).

I like your reasoning - as an old Smalltalk hand I'd love to replace Python with Smalltalk, but Smalltalk's shrinking ecosystem is making it too niche
I use and enjoy dozens of scripting languages including Smalltalk and Python, but colleges need objective reasons to teach a certain language, and the popularity and applications of Python can't be beat.
I think a good exercise is to build a CPU/Micro simulator in a more modern language. Followed by writing a compiler (for an uncomplicated language) to target that CPU. Should teach you most of what you need to know.

I remain reasonably agnostic to what language people should learn first, whether it be C / Java / C# / Python / <some other language>.