5 ms·
> Every new programmer needs to start with C. Wow, what an idiotic thing to say. C is one of the worst languages for learning the actual fundamentals of progra
by derleth 14y ago
> Every new programmer needs to start with C.
Wow, what an idiotic thing to say. C is one of the worst languages for learning the actual fundamentals of programming, which are algorithms and data structures.
- robomartin 14y agoAbsolutely not true. You can learn all of that and more with C. You might not like C and that is a different issue. Let's take it down even further: Every language you care to suggest ultimately ends-up in machine language. You can implement ANY algorithm or data structure management you care to mention in assembler. So, assembler isn't any less capable in that regard than any language anyone might care to propose. Now, of course there's the practical matter of the very real fact that doing object oriented programming --as an example-- in assembler would be extremely painful, so yeah, this would not be the first choice. Nobody who has done a reasonable amount of programming across tools and platforms would, for a minute, suggest that C is the be-all and end-all of programming languages. That I have never said anywhere. In fact, in a recent post I believe I suggested a progression involving assembler, Forth, C, Lisp, C++, Java (or other OO options). Even less popular languages like APL have huge lessons to teach. As the level of abstraction increases one can focus on more complex problems, algorithms and data structures. That is true. One of the problems with a lot of programmers I run into these days is that a lot of what happens behind the code they write is absolute magic to them. They have almost zero clue as to what happens behind the scenes. That's why I tend to like the idea of starting out with something like C. It is very raw and it can get as complex as you care to make it. One can use C to write everything from device drivers, operating systems, mission critical embedded systems, database managers, boot loaders, image processors, file managers, genetic solvers, complex state machines and more. There's virtually nothing that cannot be done with C. Is it ideal? No such language exists. However, I'll go out on a limb and say that if I have two programmers in front of me and one only learned, say, Objective-C and nothing more while the other started out with C and then moved to Objective-C, the second programmer will be far better and write better code than the first. All of that said, there is no magic bullet here. Start with whatever you want. No two paths are the same. Just different opinions.
- derleth 14y ago> So, assembler isn't any less capable in that regard than any language anyone might care to propose. You're arguing against a strawman here. > Nobody who has done a reasonable amount of programming across tools and platforms would, for a minute, suggest that C is the be-all and end-all of programming languages. And I never used that strawman. > As the level of abstraction increases one can focus on more complex problems, algorithms and data structures. And this is my point. You can focus on what you're learning without having to waste time on anything else. Why don't you advocate a return to punch cards? > One of the problems with a lot of programmers I run into these days is that a lot of what happens behind the code they write is absolute magic to them. And most programmers don't know enough physics to understand how a transistor works, either. You can learn stuff like that as and when you need it. The actual core needs to come first. > There's virtually nothing that cannot be done with C. Ditto machine language, as you just said. So why didn't you say everyone needs to start with machine language?
- robomartin 14y agoI merely used the fact that all languages ultimately compile to (or are interpreted by) machine code to illustrate the fact that you calling me an idiot and asserting that "C is one of the worst languages for learning the actual fundamentals of programming, which are algorithms and data structures." is, well, misplaced. You can learn just as much with assembler. It would be a huge pain in the ass. And, just in case there's any doubt, I am not proposing that anyone use assembler to learn complex algorithms, patterns or data structures. Your original comment "what an idiotic thing to say" is just false. You can learn ALL fundamentals of programming with C. And, yes, you can learn ALL fundamentals of data structures with C. Classes and OO are not "fundamentals". That's the next level. And there's a whole movement proposing that there are huge issues with OO to boot. I have a question. You were quick to call me an idiot for suggesting that newbies need to start with C. OK. I have a thick skin. Thanks. Now, let's move on. I noticed that you did not offer a solution. What would you suggest someone should start with? Why? How is it better than starting with C? Now, keep in mind that we are talking about STARTING here. We are not talking about --and I have never suggested that-- C is the ONLY language someone should learn. Quite the contrary. Your ball.
- javert 14y agoCoding algs and data structures in C lets you see how those things _actually work_ in the computer. A lot is hidden by the abstractions of higher-level languages. In particular, I am thinking about pointers and memory management, but there are other things.
- robomartin 14y agoYup. Exactly why I think C is a great starting point. This is also why I think we have so much bloated code these days. Everything has to be an object with a pile of methods and properties, whether you need them or not. Meanwhile nobody seems to be able to figure out that you might be able to solve the problem with a simple lookup table and clean, fast C code. There was a blog post somewhere about exactly that example recently but I can't remember where I saw it. I wrote a GA in Objective-C because, well, I got lazy. Then, after seeing the dismal performance I got I re-coded it in C. It's been a couple of years but I think that the performance was hundreds of times faster than anything the optimized Objective-C code could achieve. The heavy bloated NS data types just don't cut it when it comes to raw performance. Someone who has only been exposed to OO languages simply has no clue as to what is happening when they are filling out the objects they are creating with all of those methods and properties or instantiating a pile of them.
- derleth 14y ago> This is also why I think we have so much bloated code these days. 'Bloat' is a snarl term. It's meaningless. It literally means nothing, except to express negative emotion. > I wrote a GA in Objective-C because, well, I got lazy. Then, after seeing the dismal performance I got I re-coded it in C. Did you try any other algorithms? Any other data structures? Simply picking a new language is laziness.
- robomartin 14y agoNo, it's not a snarl term. It's very real. When dealing win an array is 400 times slower in a "modern OO language" then in raw C, well, the code id fucking bloated. When you can use a simple data structure and some code to solve a problem and, instead, write an object with a pile of properties and methods because, well, that's all you know, that's bloated code. Of course there are lots of places where OO makes absolute sense. And the fat and slow code is the compromise you might have to make. That's the way it goes. With regards to my GA example. No, I had to implement a GA. That's what was required to even attempt to solve the problem at hand. Later on we used it to train a NN, which made the ultimate solution faster. But, the GA was required. There was no way around it and Objective-C was such a an absolute pig at it that it made it unusable. > Simply picking a new language is laziness See, there's the difference. I started programming at a very low level and have experienced programming languages and approaches above that, from C, to C++, Forth, Lisp, APL, Python, Java, etc. I have even done extensive hardware design with reconfigurable hardware like PLD, PLA's and FPGA's using Verilog/VHDL. I have designed my own DDR memory controllers as well as raw-mode driver controllers and written all of the driver software for the required embedded system. My last design was a combination embedded DSP and FPGA that processed high resolution image data in real time at a rate of approximately SIX BILLION bytes per second. So, yes, I am an idiot and make really fucking dumb suggestions. Because of that I would like to think that, if the choice exists --and very often it does not-- I do my best to pick the best tool for the job. More often than not, when it's pedal-to-the-metal time C is the most sensible choice. It used to be that you had to get down to assembler to really optimize things, but these days you can get a way with a lot if C is used smartly.
- tptacek 14y agoWhich begs the question of what a freaking moron Knuth must be to have presented TAOCP in terms of assembly language.
- derleth 14y agoKnuth is Knuth. You are not Knuth.