831
STOP WRITING C (lemmy.world)
submitted 8 months ago by Maven@lemmy.world to c/programmerhumor@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] RubberElectrons@lemmy.world 45 points 8 months ago* (last edited 8 months ago)

I really like C because I can just get to the heart of an action and make it happen without much surrounding code.

I could make classes and blah blah blah if I want to make a large, complex program but I'd rather write several small, simple to grok programs which pass information around so each program can do its one simple thing, quickly and easily. Chain the small programs together with bash or something, and bingo, you've got a modular high speed system.

I'm not a programmer, actually a mechanical engineer. But the Unix philosophy of simple, modular tools is great, provided one properly checks and sanitizes inputs.

[-] macaroni1556@lemmy.ca 14 points 8 months ago

What you're describing sounds like Python. Not really C's strong suit.

If you haven't checked it out yet, you certainly should!

[-] remotelove@lemmy.ca 8 points 8 months ago

I agree with your main point. Python does a great job of replacing lots of tiny, chained scripts. Simple API calls with wget or curl have a place, but can spiral out of control quickly if you need to introduce any grain of control like with pagination, as an example.

Maintaining one Python app (or "script") can still adhere to the unix philosophy of simplicity but can bend some rules as far as monolithic design is concerned if you aren't careful.

It all boils down to whether you are introducing complexity or reducing it, IMHO.

[-] macaroni1556@lemmy.ca 3 points 8 months ago

I'm not suggesting replacing the small programs with one mega Python script, I meant that even C is not a good language for that either.

If you're chaining a bunch of stuff together through your shell environment anyway, you're not using the low level benefits of C, so you're just punishing yourself with having to implement everything by hand every time! Python is amazing because the syntax is clear and readable and the standard library has nearly everything you'd need if you're not building a large application.

However since most of these things are going to be one-liners then yeah you may want to just put them in one script!

[-] RubberElectrons@lemmy.world 1 points 8 months ago

I'm supporting embedded devices, and I like the performance of C. I've used python, it's meh. At least you don't have to compile it.

[-] macaroni1556@lemmy.ca 1 points 8 months ago

Aha on embedded not much choice there. It's what keeps C alive and relevant for sure

[-] frezik@midwest.social 1 points 8 months ago

Rust is starting to show up in embedded. And micropython, though that obviously has some limitations.

[-] macaroni1556@lemmy.ca 1 points 8 months ago

Totally, but I'm not aware of anyone using either properly in a truly production environment. Both are more on the hobbyist or tinkering side, or in the Linux space anyway where you can already just do anything.

(From what I've seen? Would be thrilled to see examples!)

I really like Micropython too. I made a "game" that communicates state between multiple boards over wifi in almost no time compared to how long it would take in C++.

[-] masterspace@lemmy.ca 9 points 8 months ago

That sounds a lot more like functional programming languages / frameworks

this post was submitted on 21 Jan 2024
831 points (100.0% liked)

Programmer Humor

32044 readers
1356 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS