Live data from Hacker News

Learn C, Then Learn Computer Science

qrohlf.com

51–60 of 134 posts

Re: Learn C, Then Learn Computer Science

#51
post #2

Don't confuse the strategies :-) Small liberal arts school has a strategy of broad based understanding of theory and the 'art', with graduate school providing the nuts and bolts specialization, large engineering school (USC) has the strategy of maximally skilled in execution of the art with enough theory to be effective. USC will assume that you will go to work right after you get your 4 year degree, Lewis and Clark…

yes, and a significant portion of our famous scientists studied philosophy and then laid the foundations across multiple disciplines some of which many graduate students still don't understand even though they studied them.

i know a whole bunch of people are going to argue pro specialization, but i think we need to rethink the way we teach. we've built efficient workhorse factories which we call universities, and some of the top tier ones are slowly moving away from that system.

there are also a lot of known cases where crossdomain talent has brought a perspective which led to a whole bunch of problem solving. but i'm careful with conclusions here, because we know correlation does not imply causality.

we're not teaching people, we're indoctrinating them, to a point where your sound reasoning is valueless, because you don't have a ph.d in the domain you talk about. what's tested in your university exams is not whether you're good at something, it's how good we can recite the things that have been taught to us. it's a system that carries from primary school to everything else.

somewhat related is also this gem, someone posted on hn before http://pauli.uni-muenster.de/~munsteg/arnold.html

EDIT: you might wonder how that is related. one example: i struggled during the universities architectural classes. even though having grown up reading intel platform references and looking at disassembled c/c++ and delphi code i understood memory layouts, threading, pipelining much better than anyone else in the class. i also spent a lot of time learning basic mips architectures.

the problem was that none of that really helped me to do well on the exams. the reasoning behind it, is that class is structure in a way so that once you learn the theory behind it, you'll have a reference point once you actually need to do something in that domain. that reasoning is in fact sound, but only if we assume that no one actually knows what they want to do.

> In my experience, learning how the computer worked made it easier for me to learn to program it

yes, but the question is, do you need university to tell you that?

Re: Learn C, Then Learn Computer Science

#52

Earlier quoted context omitted.

"C is about as close to teaching the mechanics of the computer as you can get while staying portable" Why is it important to teach the underlying mechanics of a computer in a data structures course, or an algorithms course, or really anything beyond OS or computer architecture courses (and perhaps a compilers course)? The reality is that the way computers work "under the hood" is counterintuitive in an extreme sense.…

I agree with you except for your use of cryptography as an example. In anything dealing with security, unfortunately the nitty-gritty implementation details wind up mattering as much (if not more) than the theoretical portion. Most cases of crypto failing are not examples where the algorithm is flawed (or outdated), but rather where the implementation is weak. Any course on crypto needs to address both algorithms in…

"Any course on crypto needs to address both algorithms in the abstract and the particularities of how they're implemented in the real world."

I disagree. There is a rich theory of cryptography that is entirely abstract, for which the low-level details are an irrelevant distraction. Even the AES finalists, which were designed with low-level concerns in mind, are described abstractly and can be implemented at a high level (I have an implementation of Serpent in Common Lisp, for example -- no messing around with low-level details, just a functionally correct block cipher). Within the crypto research community there are people who work on high-level languages suitable for cryptography implementation:

http://www.charm-crypto.com/Main.html

To be fair, there is also an enormous body of work on implementing cryptosystems in the real world -- at least enough to have an entire course dedicated to the topic. If anything, we should really have two courses: an introductory course that covers the theory of cryptography, and a cryptography engineering course that deals with real-world implementations.

Re: Learn C, Then Learn Computer Science

#53
I am a recent graduate of CS and completed a year of C after my first year in Java. Then finished the final two years in something of interest and software development courses. I had the ability to do this at a single school and feel I got a full education in terms of covering a large area of study and understanding coding as well as the science behind it. I do however still feel overwhelmed at times and am constantly learning. Lynda for language basics because languages are cool and Two Scoops because Python and Django are awesome.

Re: Learn C, Then Learn Computer Science

#54
post #2

Don't confuse the strategies :-) Small liberal arts school has a strategy of broad based understanding of theory and the 'art', with graduate school providing the nuts and bolts specialization, large engineering school (USC) has the strategy of maximally skilled in execution of the art with enough theory to be effective. USC will assume that you will go to work right after you get your 4 year degree, Lewis and Clark…

"I think they are both valid approaches."

For limited ranges of valid. If you are implementing a low performance requirement CRUD app, certainly you can become an effective programmer without knowing the low level details.

But if you want to be an engineer? Good luck. I've worked with people that didn't know the stuff behind C, and they are pretty useless as soon as performance matters, or you need to talk to hardware, or crank through a lot of numerical computations, minimize watt usage of a cellphone, app, debug complicated situations, and so on. They don't have a good mental model of the machine in their mind, and so they cannot figure out what is going on, reason about the performance of a modern chip, and so on.

There are a lot of arguments for expediency on HN. Probably it is partially justified, but I will always advocate for an engineering education, as opposed to a 'learn rails in 3 weeks and get a job' approach. Education and knowledge enables you to tackle any problem that comes your way.

So, while you can learn to be an effective debugger of a Python script (say) and so on without detailed knowledge of the machine, mastering the fundamentals will make you an effective debugger and enable you to do so much more. To stick with the python, what happens if the python implementation is buggy? There is a large subset of programmers that can not cope with that situation.

Why limit yourself? If this is going to be your career, the way you pay your mortgage, feed your kids, and so on, invest in yourself. I'm having trouble of thinking of the downside of acquiring the knowledge, but I can trivially think of the upside.

Re: Learn C, Then Learn Computer Science

#55
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.

Could you elaborate more or give some references on the second and third part? I am done with the first. I seriously need some profound knowledge on second and third, which a lot of people like you talk about. I need to put a plan to get there too. Scheme to C looks fun though :-) . Where should I start first with?

Re: Learn C, Then Learn Computer Science

#56
I'm not convinced that these things need to be mutually exclusive. In the CS department at my university, the only language used for the first 3 years is C. But all of the courses are split in to a "lecture" and "lab" component. In lecture you learn about Computer Science; you learn data structures, algorithms, computational complexity, graph theory, proofs, summations, stats, combinatorics, etc. In lab you learn Programming; you implement a lot of these algorithms and data structures in C.

Abstract vs. Concrete Data Types are introduced very early as representations for the theoretical structures discussed in class and then we are given projects that can be solved using concepts and theorems introduced with the expectation that we will implement the appropriate structures and algorithms in C. The code itself is read over carefully and just as important as whether the output is good. Now, this is partially a luxury afforded by my university's small size; freshman and sophomore CS classes aren't taught in 200 person lecture halls, they're 30-40 students at the max. My first exposure to a linked list was writing one in C, not using one in Lisp. You model them, write proofs, recurrence relations, graphs, etc. on exams, and implement them in projects so that you show an aptitude for both the theory and the mechanics.

By the time you hit your fourth year, you take Programming Languages and Theory of Computation. Automata/Machines, Grammars, BNF, Compilers, etc. in lecture; seeing these concepts applied by studying and writing code in OO languages, LISPs, and Prologs in lab. And you'd sure as hell better understand how the garbage collector in your favorite high level language works or you'll get hosed on the exam. There's other staples mixed in of course; a whole semester devoted to Java/OO (I think a whole semester devoted to functional programming and Lisp would be better, but that's another story). A semester of OS, a semester of Networking. But just focusing on the whole programming/vs science side of it, there's no reason they can't both be taught effectively.

Re: Learn C, Then Learn Computer Science

#57
post #21

This article resonated deeply with my own experience. Like Rohlf, I learned to program TI-Basic in middle school, and like him, I've had the ability to see several different teaching paradigms when it comes to computer science. In the high school computer science courses I was able to take, the programs were relatively simple with an, in my opinion, too-overt emphasis on object oriented programming. It was in java, a…

Ada's powerful. The typing system is the best of the mainstream imperative languages. You can write good cross-platform code without thinking about endian issues. Almost as fast as C, strong gcc support.

It's a shame it's so damn verbose. A fortnight ago I was trying to brainstorm how I could put a tighter syntax on it, possibly with some kind of pre-processor. Ideas welcome!

Re: Learn C, Then Learn Computer Science

#58

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…

Somehow we managed to do so in the 80s.

Classes at the time were a mix of C, Pascal, and Lisp (at my school, YMMV). Certainly all the chances for getting pointers wrong made developing in C harder, at first. Even today I prefer to reach to Python to throw together some algorithm I am musing about. So I definitely acknowledge your point.

But, I just don't see a way around it. Today I am refactoring code to make it stay in the cache better. Doing that is not an exercise in pointless efficiency; it is the difference between the program being usable or not (it is a real time system). I contemplated compiling to assembly and eyeballing it, but a few sessions with the profiler got me the answers I needed. But to do this I had to keep in mind the pipeline architecture (cost of if statements if you don't get the branch prediction), the size of the cache, the cost of function calls, etc.

I recognize there are careers out there where you never have to touch that stuff. You write SQL calls and use a 4GL language, and so on. But what happens when your SQL runs to slow? Do you randomly vary the various server settings until it seems to run better, or do you actually understand (say) the cost/benefit of making the cache for the indexes larger? How would you talk to a piece of hardware your boss drops in your office? How..., well, you get the idea.

None of that is advocating building an entire 4 year curriculum solely on C/C++. Certainly it makes sense to do the algorithms class largely in a language like Lisp or Python. But after a certain point if you want real performance you are in C, battling low level details, and I think that is as important, if not more important, than proving the O() complexity of Fibonacci heaps.

Re: Learn C, Then Learn Computer Science

#59
post #22
post #9

Please don't! Learn Delphi/Object Pascal, Ada, Modula-2, Rust and discover control over memory managerment doesn't require throwing safety out of the window. Performance can be fine-tuned to the 1% hotspots that really require playing dirty tricks. That there are modular systems programming languages with compile times times that leave C to shame. Then cry as you are forced to adopt C to be understood by the rest of…

The problem being, if you show up and all you know is Delphi / Pascal / Ada, you're going to be unemployable. [I'm a veteran of a ton of Object Pascal, btw. Done some Delphi, too -- it was nice. But.] In general, pushing a niche language as The One does not do a beginner a service. Delphi has never been more than a niche. We had a guy at Apple decide to do his project in Oberon. Super smart guy who pretty good work.…

> The problem being, if you show up and all you know is Delphi / Pascal / Ada, you're going to be unemployable.

Sure, it is all about learning for the job I guess.

My rant goes into another direction actually.

Young kinds nowadays tend to think that not only C is the only player on its field, it never existed nothing else before it.

Whereas many of us, remember the days when C was just another systems programming languages among many others to choose from.

So if they learn only C, then they get into this mentalit that bounds checkings, modules, proper vectors belongs to the realm of VM languages, while only C allow for full control.

If on the other hand they learn about the Algol family of systems programming languages, besides C, they will be aware of other languages that offer the same feature set of C, compile to native code as well, while offering higher productivity.

Having that knowledge will make them better C programmers as well, as they might learn a better sense of safety and disciple while coding C.

Re: Learn C, Then Learn Computer Science

#60
post #23

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++ and C are completely different beasts. C is an elegant clean small language with few distracting elements, making it very suitable for a teaching language. C++ is a grotesquerie more suitable for a carnival horror show than something you want to introduce to new programmers. Unfortunately at some point, teaching OOP became all the rage in schools, and so C++ is chosen instead. That's a mistake, Java or C# should…

The majority of C++ warts are caused by its C compatibility.
Post reply on HN