>>52692238 Everyone should learn it at some point, because its important to understand how the machine actually works, but it's better as a second or third language, once they have actually gotten the taste for programming.
No. A beginner who is serious about learning programming should learn C.
In terms of syntax, it's fairly simple. There is no object-oriented nonsense to explain just to explain how Hello World works. Nor is there a large number of keywords, or a large amount of sugar syntax that may make beginners confused as to what the meaning of a particular statement does. It's not the simplest language, but it's simple enough.
In terms of benefits to the beginner, however, C is more attractive. C does not do a lot to hide what a machine is doing from the programmer. While one is not explicitly calling machine instructions, one does end up getting a general sense of how various operations move data around in memory. This becomes important to know when programming in higher level languages, particularly where optimization is concerned. It is difficult to make software more efficient if you don't know how the methods one is using are working. A C programmer, when writing Python, Ruby, Java, or similar languages, is capable of looking into the source code of the VMs for these languages, and seeing how various methods are implemented. This is good both because it enables them to use those methods more efficiently, but also because it encourages curiosity. A good programmer should often be questioning "how does this work?" when presented with a useful tool.
And if neither of these convince you, just remember that it makes it so people who can't grok C give up and find another profession quicker.
>>52692238 What I don't understand is why someone would "learn C". Why not just learn C++? I learned C++ first and when I found myself with a C compiler written for a microcontroller I had zero problems. It took me five minutes to figure out oh I can't use classes anymore. Everything else is the same.
>>52692562 >Everything else is the same No it isn't. C++ has namespaces, whereas C does not, but makes clearer distinctions between named special constructions.
Also, C++ is an overly complex language by almost any standards. It manages to have all of the complexity of something like java, without the nice safety features. It's incredibly powerful if you truly know what you are doing, but it sure as fuck isn't the language to learn about for loops on.
>>52692238 >C++ >not a mustang with dildos and blenders taped to it Hahaha no Also, C is objectively the best starter language to learn if you're seriously about learning. Not some shitty toy language like Python.
>>52692899 Nah, you need to understand how everything works down at the machine level so you don't get too lost in abstractions. Stuff like list comprehensions and generator expressions are great and all, but you need to be comfortable doing the same stuff on a bare array
>>52692659 You don't explain cout to a beginner by going in to what an object, template, or overloaded operator is. You show someone how to use it. Any book on C++ aimed at beginners is going to say something like
cout << "Hello world." << endl;
cout represents the console output. You send stuff to it using "<<". "Hello world." is a string and endl is like hitting enter. We'll show you how strings are represented a little later. When you show them variables you show them how you can send any variable to cout. You show them how to format cout.
Then later when you're ready to learn to make your own classes you learn what an object is. Once you learn that you learn how too overload operators. There's no point in worrying about overloading << when you can't create your own types yet anyway. Once they know how to overload operators and use templates you realize, "Oh hey that's what they already did with the built in types and that's how they get that functionality."
I could teach a 10 year old how to use cout like a boss in 2 hours. If wasn't easier to use cout than printf, then they wouldn't have invented cout. printf is available to the C++ programmer and to the teacher of C++. So if you really don't know how to teach cout, printf is still there.
Also an operator is a function and << is a function with side effects. It's easier to teach x + y than it is to teach add(x,y).
>>52692607 >No it isn't. C++ has namespaces Okay there are other differences, I admit to being hyperbolic. The thing is namespaces aren't taught to the beginner. They'll be shown how to use the statement using namespace std. Same with constructors.
>but it sure as fuck isn't the language to learn about for loops on.
Writing a for loop in C++ isn't any harder than any other language. The thing is you don't have to know how everything works before you can use C++. The thing is that once you learn the simple parts of C++ that knowledge applies to the more complicated stuff.
You will need to pick a starting language. You will learn more later, but for beginners, there are generally two recommended "programming families" that you can choose to start learning: -Dynamic programming languages, such as: Python, Perl, Ruby, Lisp -Structured programming languages, such as: C, C++, Java, C#
These are amongst the most popular languages in use worldwide, including 4 from the top 5. Both approaches are perfectly fine, and well-documented. -Dynamic programming may be a bit more suitable for those who need their programs to do heavy mathematics, and thus it is more popular in academia. -Structured programming is a bit more suited for making general applications, and thus it is more popular in industries. If you cannot decide, flip a coin.
If you choose dynamic programming, you may want to start with Python. It is very easy to pick up. Here are some good sources: http://www.learnpython.org/ http://learnpythonthehardway.org/book/ http://www.codecademy.com/en/tracks/python
If you choose structured programming, you may want to start with C or C++. C is very well documented, and C++ is generally "C, with a few extra concepts added". Sources: For C: http://www.cprogramming.com/tutorial/c-tutorial.html http://c.learncodethehardway.org/book/ http://www.learn-c.org/
For C++: http://www.learncpp.com/ http://www.cplusplus.com/doc/tutorial/ http://www.cprogramming.com/tutorial/c++-tutorial.html
>BUT I WANT MORE SOURCES! Read: https://wiki.installgentoo.com/index.php?title=Programming_Books
>BUT I WANNA START WITH [LANGUAGE X] INSTEAD! Sure, if you like. But the languages shown above are considered very good for beginners.
>BUT I WANNA MAKE iPHONE GAMES! Learn Objective C.
>BUT I WANNA MAKE ANDROID GAMES! Learn Java.
>>52693124 >Beginners should not need to be told "I'll tell you what all of these mean and how they work later."
You do this no matter what language you teach. What you need to do is create a model in the beginner's brain that accurately predicts what a language will do. When you teach a beginner to output variables you teach
unsigned int number = 1;
cout << number << endl; number = 2; cout << number << endl;
You tell the beginner an unsigned integer can store integers greater than zero. You tell them the assignment operator stores stuff in a variable. You tell them you send it to cout with <<.
Even if you teach printf you still have that element of I'll show you later. You don't show how printf actually converts everything to a string by doing conversion to base 10(oh but only if you don't use the binary,octal,or hex functionality), then doing an ASCII table lookup and then calls on the operating system, usually through an interrupt, to send that data to the emulation of a console that exists as a window in the OS.
In fact teaching all of that right away defeats the purpose of a HLL. cout and printf are supposed to be OS independent. What exactly happens when you call printf or cout.<< depends entirely on how the language was implemented on your platform. The purpose of HLLs is abstraction. A programmer needs an abstract model of what the << function or the printf function does. An abstract model necessitates "there's more to it than this, but here's what you need to know." The truth is << is a simpler model. That's why cout was created. what makes C++ unique as a teaching language is if the student wants to know more you can teach them to build null terminate strings a byte at a time. You can teach them to use printf to do the same thing. Hell if you want you can stick in some inline assembly, do the base 2 to base 10 conversion, create an ascii lookup, and call the software interrupt. But you don't have to so it doesn't get in the way.
>>52693463 >makes it hard for other people to know your code as well as you.
I seem to have that problem no matter what language I use. I cut my teeth on an ancient version of Pascal. I was in a high school class and I was one of about three people with a natural coding ability in a class of 25. So that means I got a couple weeks worth of work done in a day or two. That meant everybody came to me when they needed their code debugged.
I found it 100 times harder to debug someone elses code than my own. Looking at someone elses code was like reading code in a language I didn't know but could figure out what was going on if I thought about it.
In python I have the same problem. In C++ it's way worse because there are so many ways to do something. Like you can divide by 2 or shift to the right by one bit. But is that person shifting bits as a division by a power of two or are they setting up a bit mask? I knew better than to try with assembly. Fuck that shit. I even find myself going crosseyed when I look at someone elses code in a *.m file in GNU Octave. It was a simple and straightforward piece of code and I had to concentrate very hard.
I don't know if it is something I would get better at if I worked a job where I regularly looked at people's code and had to edit it. As a student who helped other students, a hobbyist, and user of open source software that looks at the source every once in a while I find the process baffling.
>>52692238 Honestly, it's a really good beginner's language. I feel that objects and classes muddle things up a lot and people should learn where the structures come from first. C is elegant and fast, and pretty easy to learn and grasp the syntax. It's really nice to aid people in knowing the tricks of imperative, procedural languages and gives people a lot of oversight over what happens in a class from pointers. There aren't too many annoying libraries in the way either, but it's easy to link one or implement it yourself. Either way, C is great for learning, and decent in practice.
There are reasons to dislike C, but they definitely don't come from ease of use, speed, or versatility. C is old, so a lot of code is pretty legacy and not really attuned for multithreading, although it gets better everyday. C lacks a lot of support for abstract libraries as writing structs are becoming the norm for massive monolithic routines. C is still, in the 21st century, woefully difficult to debug, even with lldb, let alone gdb, which gives little insight on code breakages. However, if there's any language to learn first, it's C. With it, you're granted knowledge of basically any procedural and structural langauge in existence. Knowing it hardly makes you a wizard; honestly, C and LISP are babby's first languages.
I think C is a good language to learn but not first. It gives a good pathway to learning assembly and hence how a cpu works. I believe it is good to have an understanding of the base working of the computer.
C makes the most sense as a first language. It isn't any different than learning math the hard way first before learning all the shortcuts and easy ways. You have to understand the underlying functionality before it is all handled for you.
Thread replies: 63 Thread images: 9
Thread DB ID: 477305
All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the shown content originated from that site. This means that 4Archive shows their content, archived. If you need information for a Poster - contact them.
If a post contains personal/copyrighted/illegal content, then use the post's [Report] link! If a post is not removed within 24h contact me at firstname.lastname@example.org with the post's information.