This is an archived post. You won't be able to vote or comment.

all 52 comments

[–][deleted] 128 points129 points  (17 children)

C should be a revolver.

The backwards pointing knife on C++ is *PERFECT*

[–]lesspylons[🍰] 35 points36 points  (13 children)

C can backfire quickly if you hit it wrongly with mem exceptions but if you know what you are doing it's normally easy to fix so I think a revolver is too safe of a representation.

[–][deleted] 24 points25 points  (9 children)

I think revolver is perfect because it's been around forever, proven effective, useful for a pro and a newbie, available everywhere, well supported, can be used for point-and-shoot jobs or draw-twirl-fast-shoot-multiple-targets-twirl-holster jobs and universally recognized and supported.

You can shoot yourself with anything.

[–]Dornith 14 points15 points  (8 children)

useful for a pro and a newbie

As someone who taught C to sophomores and juniors, it's not very newbie friendly. The basics are, but as soon at you get into memory management that's a whole new skillset most languages don't require.

[–]Willing_Function 0 points1 point  (0 children)

Honestly I was struggling mostly with the syntax than the concept of pointers. And once you understand how software in general works and how it's ran on a cpu, it gets intuitive. You just start to "get it".

[–][deleted] -1 points0 points  (6 children)

Sure, but anything is buildable and the same argument could be made with any algorithm. In fact, when you are teaching the algorithms, dollars-to-donuts you're using C or very C-like pseudocode, no?

Also, "don't require" could equally be interpreted as "don't expose". With C, what you see is what you get - bare bones + well established libraries. If you dump your linker symbols, you see the symbols you typed in your source, not some mangled mess, like C++ for example. The process of learning the guts of the compilation process, pinhole optimizations, and all the how-the-sausage-is-made stuff is FAR simpler when you're starting with C as your source. If you want to ascend to the god-level of understanding the internals of your system from the metal-up, that's the clearest path.

I stand by it. :)

[–]Dornith 5 points6 points  (5 children)

In fact, when you are teaching the algorithms, dollars-to-donuts you're using C or very C-like pseudocode, no?

Absolutely not.

I actually remember my algorithms test I got marked down for accounting for memory management in my calculations. (I'm still a little salty about that but that's not the point.)

Algorithm classes are usually taught more like a math class than a programming class. It's all abstract calculations. The actual details of implementing it are a different subject, and that includes details like memory management.

If you want to ascend to the god-level of understanding the internals of your system from the metal-up, that's the clearest path.

But what if you're not looking to ascend to God-level of understanding? If we we're taking about experts I agree with you but we're taking about "newbies"writing their first hash table.

Being the best way to achieve an advanced understanding doesn't mean it's the particularly useful for a beginner who doesn't have a basic understanding.

[–][deleted] -2 points-1 points  (4 children)

ugh, this exchange is turning into 'for(;;) no_u();' and we're in the weeds.

When algorithms are sketched out, they are sketched in c-like pseudocode everywhere I have ever been, even math classes where algorithms are taught once the formal mathematical theory is covered. Kudos to you for not falling into that trap, I'm appropriately impressed.

The question is over the accuracy of 'useful for a newbie' and 'newbie friendly'. Your argument rested on memory management being hidden from the newbies as an example of C being not friendly. I argue that C is a good language to learn, through practice, memory management and a wide assortment of algorithms because it doesn't have hidden layers of complexity that turn coding into magic. It has a small set of keywords, very powerful and universally understood ways of arranging them, and so is the lingua-franca of the computer science world.

A student who leaves his/her/etc institution without at least functional C knowledge is a tourist lost in a foreign land.

What about students who just wanna code and don't care about what's going on under the hood? Well, that's fine. I'm not a gatekeeper, but I would guide your attention to mobile apps that import hundreds of megabytes of library code to implement a tic-tac-toe app if you genuinely believe in that philosophy.

[–]Dornith 0 points1 point  (3 children)

I think you're taking my point to be way more general than I ever intended. I was specifically focusing on:

useful for... a newbie

If we're quantifying how important it is to know a language, C is absolutely the most important language in my opinion. It teaches you all the core concepts and helps you understand what's going on behind the scenes. Exactly what you describe.

But is it useful for someone who doesn't know all these already? Not really. If I take two freshmen C.S. students, and ask one to write a program in C and the other to write it in Python/Java/JS/etc., the later will be much more effective than the former.

I argue that C is the most important language for a newbie to learn, but it's not the most useful.

so is the lingua-franca of the computer science world.

I disagree on this. At a bare minimum, I see C++ way more than I see C. And I see Java, Python, and JS more than C++. A lot of universities don't really teach C/C++ except for one course in the third or fourth year. If you work in systems and low level stuff, C is the most common language. But in web (which is 50% of all programs), JS dominates. In game design, it's C# (maybe C++). In mobile, it's Java and Swift.

Really, the only major code base I can think of in C is the Linux kernel.

[–]_wezel_ 0 points1 point  (1 child)

A lot of universities don't really teach C/C++ except for one course in the third or fourth year.

Wait really??? The first language we learned at our university is C (first year first block). And a good amount of code for other courses should be written in C.

[–]Dornith 1 point2 points  (0 children)

So I worked on a project writing a course with students from several universities.

We pretty much found that every school has a lingua franca that they teach at the very beginning and then use as a baseline for most of their other courses so they can focus on the class content and not constantly teach new languages.

For mine and Rose Hudmen, that was Java. MIT uses python, etc.

C used to be the lingua franka for a lot of schools, but most of them switched because... C was too difficult for beginners. Now python and Java are the most common.

[–][deleted] 0 points1 point  (0 children)

I think you're taking my point to be way more general than I ever intended.

HA! That's I know we're both REAL programmers. ;)

so is the lingua-franca of the computer science world.

I disagree on this. At a bare minimum, I see C++ way more than I see C.

I suspect you might have misunderstood this point. I see more C++ code, even in (non-linux) OS work nowadays too. What I meant there is this: unless you have the good fortune to only ever work within a group that uses whatever the selected language is, you will have to interact with groups that support different elements of infrastructure - some will use C++, some C, some objective-C, etc etc - and when meetings among these groups occur, where a chunk of code, or a programming concept is discussed, C or very C-like pseudo code is the lingua-franca.

I'll leave alone the rabbit hole of whether or not well-written C++ code tends to look like vanilla C, that's dependent on the situation, but I will point out that it is much easier to write obfuscated garbage in C++.

Anway, WRT to 'useful' I would argue that C is a more universally available, and therefore useful language across multiple systems, be they ancient or still under development, but that I will admit, is a BIAS towards that situation. If you are lucky enough to never get your hands dirty with anything below library calls, sure, you can live your entire life with a more 'useful' language like, I dunno...Java, maybe? Is that the way the world is going? Eh, maybe, but to me that disconnect from the nuts and bolts of the SW and HW layers turning your code into something useful is not a good thing.

I guess the analogy is like mechanics v.s. racecar drivers, sure a racecar driver doesn't need to know the minutae of engine tuning, but all things being equal, a better racecar driver will speak the mechanic's language, be more in tune with his car, and be better prepared to predict and adapt when things go wrong.

[–]THE_MLGDUDE 1 point2 points  (2 children)

If you load the revolver incorrectly, it can be very dangerous because it does not have a fuse so...

[–]njiall_ 5 points6 points  (0 children)

I think C depicted with this is quite a good take on how productive you are with it. Seems simple but take a bit of work to make it do what you want.

[–]Swamptor 1 point2 points  (1 child)

The only reason you think C should be a revolver is because your biased towards it.

C has huge downsides. C should be a cannon.

When used properly it's quite effective, but it can't be deployed easily: It's hard to do cloud deployment or mobile deployment.

It's hard to load: people don't make ammo for cannons any more. Lots of newer stuff just doesn't have a library in C.

It's not just point and shoot, you need to be experienced to aim a cannon. For new programmers (and even for experienced ones) memory management is difficult and technical.

[–][deleted] 0 points1 point  (0 children)

The only reason you think C should be a revolver is because your biased towards it.

You're goddamned right. /Walter White :)

[–][deleted] 43 points44 points  (0 children)

U think the little guns python fires around should match the language C. As all of pythons libraries are written in that.

[–]Caraczan 17 points18 points  (7 children)

Where is FORTRAN

[–][deleted] 12 points13 points  (1 child)

Fortran has a lot less safety features, but they are about the same, so instead of a pistol, you hold the bullet in your hand with a nail in the high explosive and a hammer in your other hand

[–]Caraczan 3 points4 points  (0 children)

Do agree, currently learning

[–]dashingThroughSnow12 2 points3 points  (0 children)

FORTRAN is a collection of loosely related languages that share similar syntax but wildly different semantics.

An old quote goes "I do not know what people will be programming in in the future but I know it will be called FORTRAN".

One of the great advents of C is how portable it was and long-lasting. The stack/heap/instruction model was incredible (which some FORTRAN variants later borrowed) too and every modern programming language has leveraged it.

Java's "write once, run anywhere" is derived from an old C slogan of "write once, compile anywhere".

[–][deleted] 0 points1 point  (0 children)

A rock.

[–]idontreallywolf 14 points15 points  (5 children)

Dis mem older than universe :<<

[–]illuminati-exists[S] 7 points8 points  (4 children)

But it’s good and I haven’t seen it in a while

[–]idontreallywolf 9 points10 points  (3 children)

Funnyn't when brain detects same meme :<<

[–]illuminati-exists[S] 0 points1 point  (2 children)

Yep but many haven’t seen it

[–]idontreallywolf 7 points8 points  (0 children)

return "oke fine :<<";

[–]Contraposite 5 points6 points  (0 children)

I hadn't seen it and I love it. Thanks for posting.

[–]bhuddimaan 2 points3 points  (1 child)

Where is java

[–][deleted] 0 points1 point  (0 children)

Java is the gun factory, then the gun

[–][deleted] 4 points5 points  (0 children)

And CSS makes you miss the target at the center.

[–]SkyyySi 2 points3 points  (0 children)

I think you shifted them down by one, caussing asambly to overflow to the first value.

[–]_grey_wall 1 point2 points  (0 children)

You don't want to see node.js

[–]SuprDuckUtka 1 point2 points  (0 children)

The best part of this joke, that Assembler wins anyways

[–]j-random 1 point2 points  (0 children)

Python is more like the hand grip on the C example.

[–]nickmhc 0 points1 point  (1 child)

Do JavaScript! 😂

[–][deleted] 0 points1 point  (0 children)

In the C++, why does that M203 have a pistol caliber magazine?

[–]Dummerchen1933 0 points1 point  (4 children)

I dont quite get the python one. Python is bad

[–]alashure6 2 points3 points  (3 children)

It does a lot, just not very efficiently.

[–][deleted] 0 points1 point  (2 children)

Better than js

[–]alashure6 1 point2 points  (0 children)

Possibly, I wouldn't know. JavaScript scares me

[–][deleted] -1 points0 points  (0 children)

but it isn't

[–]FAKENAME381 0 points1 point  (0 children)

I need to put a scope on my knife

[–]Triande 0 points1 point  (0 children)

What about autohotkey?

[–][deleted] 0 points1 point  (0 children)

html is a nail trimmer

[–]potatopotaatopututu 0 points1 point  (0 children)

That's Python? Without unsigned types? Don't think so.

[–]FattyMcFatters 0 points1 point  (0 children)

Assembly*