News for hackers. Stuff that matters.
Re:12 (Really) Controversial Programming Opinions by munin on Sunday September 02, 2012 @12:46AM (#4466192)
guys,

>The first language should NOT be the easy one, it should be >one that sets up the student's mind and prepare it for >serious computer science. >C is perfect for that, it forces students to think about >memory and all the low level stuff,

as one low-level programmer to another, I hate to break it to you, but "low level programming" is not "serious computer science". the two have very little to do with each other.

Re:12 (Really) Controversial Programming Opinions by lucisferre on Sunday September 02, 2012 @01:27AM (#4466263)
Ironically C is technically a high level language anyways.
Re:12 (Really) Controversial Programming Opinions by RonPaul2012 on Sunday September 02, 2012 @02:10AM (#4466353)
Not if you live in the 2012
Re:12 (Really) Controversial Programming Opinions by qznc on Sunday September 02, 2012 @02:57AM (#4466427)
Originally, the term "high-level" meant that programs were portable between machine architectures. You can do this in C, but in assembly. This is a precise definition.

I cannot find a precise definition, which puts C and Javascript on different levels. Has garbage collection? A big standard library?

Re:12 (Really) Controversial Programming Opinions by prodigal_erik on Sunday September 02, 2012 @04:44PM (#4468049)
I think there's a spectrum around how many different ways the machine could choose to execute what you wrote. E.g., V8 creates hidden classes rather than naïvely following the prototype chain, where C pretty much dictates how things are actually laid out in memory.
Re:12 (Really) Controversial Programming Opinions by heretohelp on Sunday September 02, 2012 @01:54AM (#4466321)
'ish.

C exists in the middle territory between high (colloquially right now) and "original" low-level programming.

By all accounts, virtually any language that operates relatively close to the semantics of the machine in terms of operations and memory (pointers are a standard abstraction in assembler) is a low-level language.

The only things that detract from C's low-level credentials are that it is more of a hybrid attempt at grafting a harvard machine onto von neumann machines and its functions. The functions/stack are a bit of an abstraction depending on which architecture you're using.

Calling C high level isn't accurate or descriptive, but I'd be willing to concede that it's not truly low-level either if you know enough C to explain why.

You don't, though.

Re:12 (Really) Controversial Programming Opinions by lucisferre on Sunday September 02, 2012 @02:13AM (#4466362)
"You don't, though"

Interesting, though I'm not sure how my knowledge of C is relevant to the conversation.

Re:12 (Really) Controversial Programming Opinions by heretohelp on Sunday September 02, 2012 @02:20AM (#4466370)
You made a false assertion about C.

          o
             
     o         o
Connect the dots.
Re:12 (Really) Controversial Programming Opinions by lucisferre on Sunday September 02, 2012 @10:58AM (#4467134)
"C is not high level because you don't know C" is not exactly the most cogent of arguments. The rest of it I pretty much agree with, nonetheless the actual definition of "high level" language doesn't change just because you (or I) feel it should, which is why I said it was "technically" high level.
Re:12 (Really) Controversial Programming Opinions by javert on Sunday September 02, 2012 @02:19AM (#4466366)
That's pretty true. However, in C, you can actually write interesting data structures and algorithms that come up in computer science. I think that makes for good "theory meets practice"-based learning.

I'm not saying all algorithms classes should incorporate writing C code all the time. But probably every budding computer scientist or software engineer should take at least one such class.

I'm also not saying C is the only language for which this is true. But it's definitely not generally true for interpreted languages.

Also, C is pretty much the language everything higher-level is implemented in. So once again, at least some exposure to C can help someone conceptualize what's happening on the computer at every level.

Re:12 (Really) Controversial Programming Opinions by mistercow on Sunday September 02, 2012 @02:37AM (#4466389)
Hmm, can you give an example of a typical "learning CS" level algorithm that you can't implement in, say, JavaScript?
Re:12 (Really) Controversial Programming Opinions by killahpriest on Sunday September 02, 2012 @02:50AM (#4466415)
Not an algorithm, but used in many. Pointers.
Re:12 (Really) Controversial Programming Opinions by mistercow on Sunday September 02, 2012 @02:12PM (#4467659)
Emulating pointers in JS is pretty easy; you just wrap the values in objects or arrays.
Re:12 (Really) Controversial Programming Opinions by z92 on Sunday September 02, 2012 @02:47AM (#4466411)
B-Tree indexes in JavaScript
Re:12 (Really) Controversial Programming Opinions by mistercow on Sunday September 02, 2012 @02:07PM (#4467649)
Googling around, I see a number of implementations. What's wrong with them, and why do you feel this is impossible?

(And hint: it's guaranteed not to be impossible since JS is Turing complete)

Re:12 (Really) Controversial Programming Opinions by javert on Sunday September 02, 2012 @01:45PM (#4467600)
You could probably implement any of them in JavaScript, but it would be sort of silly, because the actual runtime complexity and memory usage aren't really going to be close to what they "should be" due to the interpreter.

I haven't given it a lot of thought, but I doubt it makes sense to implement "textbook" algorithms and data structures without pointers.

Re:12 (Really) Controversial Programming Opinions by mistercow on Sunday September 02, 2012 @04:13PM (#4467975)
As I said in another thread, you can get the same functionality as pointers by using arrays or objects, which are always passed around by reference.

You're right that this is an inefficient way to implement those algorithms, but I disagree that that makes it silly. The purpose of writing those algorithms is to learn how they work, not to use them in practice. Generally, if you're using them in practice, you shouldn't be rolling your own in the first place.

Re:12 (Really) Controversial Programming Opinions by snogglethorpe on Monday September 03, 2012 @04:36AM (#4469622)
I like this quote from Knuth: "People who are more than casually interested in computers should have at least some idea of what the underlying hardware is like. Otherwise the programs they write will be pretty weird."

C is only marginally closer to the hardware than other languages, and programmers really should be aware of even lower level concepts, but I think learning C is a hugely useful and relatively digestible step towards really understanding what's going on.

Re:12 (Really) Controversial Programming Opinions by munin on Sunday September 02, 2012 @03:17AM (#4466453)
absolutely! C is so widespread that you should be conversant in it as a software practitioner, whether as a programmer shipping code or a scientist making tools and working with others tools.

however you can explore what computer science has to offer without subjecting yourself to C. I think that "computer science" has more to do with "optimizing algorithms for efficiency" and less to do with "staring at stack traces and wondering why gdb is so bad"