Your foundation in C will prepare you to take on other popular coding languages


#1

Originally published at: http://boingboing.net/2016/09/18/your-foundation-in-c-will-prep.html


#2

On the one hand, I pretty much started with C, in the 90s, and I love the language.

On the other, if the pitch–for this being your first language to learn–is that then you go and learn something else, why bother? I think there’s an argument people sometimes make, and it’s analogous to how one might choose to study Latin before going on to learn another Romance language. Something that could be beneficial if you’re disciplined, but most will find tedious.

Where I live, the demand for C skills is limited to the financial industry and the occasional embedded systems gig.

I think the best argument for learning C is so that you can enjoy perusing the entries to The International Obfuscated C Code Contest. :wink:


#3

My best argument is that it teaches you an entirely appropriate paranoia for what users and compilers can try to do to you.


#4

I’m partially in agreement, but not totally. I would recommend C++ and not C. C++ has a lot of uses and works cross-platform. I would recommend it because in order to learn C++, one needs to have memory management down cold. If one’s disciplined enough, they could learn the fundamentals very well and very fast if they start with C++. If one starts with a language like Java, they would have an easier time of it, but not really learn about pointers vs references, constructors/destructors, malloc, etc. Java makes it easier to learn how to write bad code, plus Java has its own weirdness, such as factory methods. Then there’s C#, which I feel combines the worst parts of C++ and Java and is limited to Windows platforms. Learn C# if you’re trying to get a job in programming, but there’s probably no other point to getting started with C#.

If you want to learn to code quick, don’t really care about rigorous fundamentals, and just want to have fun playing around with stuff, I would recommend Python. I also hear good things about Ruby, but I don’t have much experience with that.


#5

C# has been open-sourced, to some extent, and compiles on multiple platforms.

Theoretically. I don’t know if anyone actually does that IRL.

If I’m not doing C# for work I’m doing NodeJs and heartily recommend the same to others.


#6

Same. I hear tell that it can be done, but I’ve never actually seen it done, or know anyone who’s done it.

[Shudders audibly]


#7

There are tons of programming courses and tutorials these days so it’s impossible to evaluate the quality of all those tutorials. https://hackr.io seems to be a great platform to find and share online programming courses and tutorials voted by programming community.


#8

Looks like
10 hours of C
5 hours of C++
28 hours of C#
I’m curious-- do any of these courses teach you the unique style associated with each language-- or is it more of a “How to write Fortran in the language of the day?”

As for myself, I plan to read Fluent Python over the coming month or so.

What’s happening with Java these days? Anything good?


#9

Mine is that there is tons of old C source code out there, and you never know when you’re going to be called upon to modify this 20 year old C program to output JSON so that your new web APIs can interact with it.

You also learn a lot about portability when working with a ‘portable’ language where the fundamental scalar types vary in invisible ways depending upon the target. And about memory management when you have to hold the compiler’s hand every step of the way. And about quality control, when the results of some constructs in the language are undefined and may vary depending on compiler and system, and pretty much all error messages are misleading and useless. It’s a very useful language to learn, and will make you appreciate your day-to-day language much more.

Unity3D is probably the #1 game engine now, and uses Mono. According to http://www.mono-project.com/docs/about-mono/showcase/companies-using-mono/, Mozilla uses it, “WikiPedia uses Mono for its search facilities. The indexing and the actual searching is done by Mono-based applications.”, and “Electronic Arts used it to power Sims3.”

C# is pretty interesting and powerful, kind of a bastard stepchild of Delphi + Java + C++, with some functional programming thrown in, along with LINQ and some other stuff. I wouldn’t consider it a beginner language since it has so much, but maybe having a bit of almost everything mixed in could be good for that.


#10

It’s quite specific, but C# is heavily used by the Unity game engine, on a wide range of platforms. You can also build apps using MonoTouch (now owned by Microsoft) on mobile platforms.


#11

Maybe you should learn Fortran too. If the goal is to learn about all the ways languages can be horribly broken, then Fortran brings a lot to the table. Surely beginners would be better served if they were to learn how to program well in a half-way modern language instead of a learning how to program badly in a language from the dark ages of computing.

This drives me crazy. Beginners should be taught good languages, like C# (or Java) – languages in which they’re not going to fall down incredible rabbit holes that require years of full-time experience and training and unrelenting discipline to to overcome, as they do when working in C. The reason why Java and C# are popular languages is because they are dramatically easier to use. And they are easier to use for beginners too.

As to the question of complexity, C# really isn’t that complicated. Most of the learning curve in learning to program isn’t in the language: it’s in the system libraries that you’re programming against; And learning how to write maintainable code that will age gracefully. And learning how to structure code-in-the-large. And learning that anything worth doing is hard. And requires enormous discipline, and sustained focused attention for unreasonable periods of team.Learning the language itself is a tiny inconsequential part of that process.

If C has any value at all, it is that it is the last language left where programmers can get a reasonable sense of being close to the metal without having to drop into assembler. Every statement and expression in C has an obvious mapping to a handful of assembler instructions, unlike modern languages in which simple expressions can generate huge amounts of machine code.

You could argue that C++ has the same relationship to the metal, but the difference in the case of C++ is that C++ has cruftified into a horrifyingly complex language that really is difficult to learn, and the correct idiom for writing modern C++ uses templates so heavily that the proximity to metal is no longer present.

Just don’t let beginners do anything in C.


#12

Fortran is still the lingua franca of mathematical programming. Now that we don’t have to use punch cards anymore it isn’t so bad.


#13

Yes, a mastery of C will prep you for ANY procedural language. However, jumping from C to C++ or C# from C isn’t trivial. It requires you learn an object oriented mindset, not just a bunch of new keywords and syntax. Although you may spend $39 for course materials that purport to help you learn C, C++, and C#, if haven’t spent hundreds of hours writing code that makes use of most of a language’s features, do NOT put it on your resume – you WILL fail the programming part of your job interview. I’ve seen plenty of people claim they “know” C or C++, only to have them fall down on that claim when talking about how data typing actually works for multidimensional arrays, and when discussing when it does and does not make sense to use recursion in terms of stack space. If you are willing to put in the time, then you WILL get something out of learning C… C++, and C#. But you must be willing to push through and persevere in the face of frequent confusion.


#14

Java 8 has a lot of improvements over earlier versions to help reduce the tedious verbosity, make threads safer, and better take advantage of concurrency, but it’s the addition of lambdas that really improves things. Sadly my current project’s not ready to move to Java 8, so I only get to read about features I can’t use yet.


#15

Huh. Would not have expected that at all. I was very much under the impression that it is strictly a legacy language.


#16

Yeah, there’s the language syntax itself (not necessarily hard to pick up) and then’s there’s learning the tools and culture around it, which is often much more important. Even if you can “learn C” in 10 hours, knowing the tools to debug it & compile it, good idiomatic coding style, working with the standard library and other popular libraries without having to access the docs every 5 minutes, etc, can take years. I “know C” on one level, but studying code by someone who’s been working professionally in it for a long time is always a very educational experience. I don’t think I would ever hire someone to write C who’s only had a ten hour crash course in it, even if they were very proficient in other languages.


#17

Kernighan and Ritchie: The C programming language, is 272 pages. It lists for Sixty Seven Dollars

Stroustrup: The C++ Programming Language, is 1368 pages. It lists for Eighty Dollars.

Seems like one language is far more complex than the other. And yet you can learn C++ in half the time.


#18

Oh, the hours and hours I spent poring over that book… takes me back, it does.


#19

I think I have the 3rd edition somewhere. I’ve managed to avoid C+±2011. Probably because the person who pushed me to learn such things is no longer with us. He did say I should learn Mono, but it never took.


#20

Ah, this is the exact one I had:

I’ve been doing mostly Python & Java since then, both being more civilized languages.

Edit to add: Mono’s just another name for C#, correct? C# is actually a really nice language, I’d much rather use it than either Java or C++.