4 ms·
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. B
by dljsjr 13y ago
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.
- YZF 13y agoAnd how did that work? I'm just trying to imagine those first year students staring at those segmentation faults or trying to decipher some other non-intuitive C behaviour (promotion rules, = vs. ==, pointer arithmetics, various implicit rules). Talk about being thrown into the deep end of the pool to swim... When a language like Pascal is taught as a first language students can focus on the mechanics of their algorithms rather than struggling with language oddities and machine architecture. I think that's important for new programmers to be able to focus on the flow and mechanics without worrying about other details. Once you get that you can "advance" to things that leak more of the underlying architecture into your program. There are probably many other languages that fit that bill. EDIT (replying to jkrems): E.g. in C if(a=1) assigns 1 to a. I think some modern compilers at least warn on this but they didn't use to and it's perfectly legal. You can't do this in Pascal. You can still make a mistake but you'll get a compiler error. This is a very common mistake for beginners...
- jkrems 13y agoCan you elaborate what you mean by "= vs. =="? Since you mention Pascal I'm guessing that you'd say ":=" and "=" would be better, but since the general model of math is different from procedural code, I'm not sure that's an uncontested truth. I learned Pascal in high school and ":=" was confusing to more people than "==", even among first time programmers.
- deleted 13y ago[deleted]
- elclanrs 13y agoI find this paper [1] very interesting and elaborates on this issue -- "From experience it appears that there are three major semantic hurdles which trip up novice imperative programmers. In order they are: assignment and sequence, recursion/iteration and concurrency". [1] http://www.eis.mdx.ac.uk/research/PhDArea/saeed/paper1.pdf http://www.eis.mdx.ac.uk/research/PhDArea/saeed/paper1.pdf
- amagumori 13y agothat was exactly my experience as a first-year CS student. i had no prior programming experience and CS 101 started with implementing several programs in C. for help i was told "use valgrind" and that was about it. the CS tutors were constantly busy and the class was so big that i couldn't get one on one help, so i had to just spend hours on my own trying to decipher how to dynamically allocate memory without fucking myself. we ended up having a final involving implementing a trivial program in C in front of a TA. my program wouldn't work, yet after trying and trying i couldn't figure out what was wrong with it, so i resigned myself to failing the class and said "i'm done" with a program that didn't run. i had a single syntax error but the implementation was otherwise correct..the professor took pity on me and passed me. had i failed that class i would've said "fuck this" and left CS forever.