The impracticality of c & projects - Printable Version
+- nixers (https://nixers.net)
+-- Forum: Development & Graphics (https://nixers.net/forumdisplay.php?fid=7)
+--- Forum: Programming On Unix (https://nixers.net/forumdisplay.php?fid=21)
+--- Thread: The impracticality of c & projects (/showthread.php?tid=1745)
The impracticality of c & projects - Houseoftea - 23-08-2015
I've been playing around with c, beginning stages of course. I've been having a great time making various little text games and conversion programs.
I have two questions for the senior devs out there.
First: I've been Reading a lot and people keep saying c is impractical for modern projects. Useful only on embedded systems or for kernels. Is this because its a low level language or its lack of objects or are they wrong?
Second: I was considering playing around with swm, I was going to fork and play with wmutils but poor z3bra and dcat might die of shame if they saw the damage my novice code would do on those beautiful tools.
My question is, are there any other little projects you've come across on github that would be worth checking out?
And because I don't like to ask without giving a little here are some projects I dug up that you all might find interesting:
Texas hold em, written in c
Irc bot to record conversations
Text adventure written in c
Just some things to think about.
Also inb4 venam closes this ;)
RE: The impracticality of c & projects - cjm - 23-08-2015
C is a great language for many reasons. As a second year software dev student C is my favourite language for a couple of reasons.
* It's simplicity is its strong suit. C is often said to be one of the harder languages due to the fact that it is low level. Although I would argue that it is one of hte better languages to start beginners off with. This is because it allows one to write simple code, but have to maintain a level of understanding of the underlying mechanisms of the computing environment. C has very few core elements but those elements come together in a way that is eloquently simple to understand when you know what you are doing (the same could be said about the UNIX development environment :-)). The beauty of C is that once you learn it, the program structure itself enforces good coding practice to maintain readability. And its not a forced trope of the language in a way that python or ruby's is. Mind you I know that one has to _want_ to write clean code when it comes to C, but the fact that you have to carefully analyze each step you make can become a great asset in future programming.
* Another area is that is it is everywhere. I mean you can put a C compiler on a piece of metal. That portability is a leading factor in why it has been around for so many years now. With the new internet of things, I believe embedded devices will still run C as long as embedded devices stand.
As you can see C is one of my favourite language. I love writing code in it to be honest. Don't get me wrong there are tons of great languages out there, but C will always hold a special place in my heart.
Overall its about whats best for the job and what tool you are most comfortable with. I think computing in general is about choice and freedom, so writing software in your favourite language is your own prerogative. I just love being able to read code and peoples thoughts patterns.
As for projects:
https://github.com/rmccullagh/libmutablestring This is a cool small library that is fun to read through. I found it today!
http://cvsweb.openbsd.org/cgi-bin/cvsweb/ This is the OpenBSD repo, any utility they create is always worth a read through.
RE: The impracticality of c & projects - z3bra - 24-08-2015
C is a special language. It's one of the oldest programming language, it's low level and used everywhere.
It's especially true in the unix world, where even the filesystem is shaped around it (/lib, /include, environment variables, ...).
But C is hard. And not only because of the syntax. Nobody really care about the syntax, it's just another set of keywords to get used to.
C is hard because of it's pedantism, and its mulitple way to screw things up.
When you write in C, you're coding without a safety net. You get no out-of-bound error checking, you can overwrite anything in memory, you can't "catch" errors, or fix them "later".
When you make a mistake, the program either crash or misbehave (remember heartbleed or shellshock?)
Most scary bugs happens in code written in C, and everytime it does, freshmen be like: "That'd never happen with haskell".
Still, most softwares are written in C. Coreutils, libressl, nginx, linux, systemd, gpg, ... You name it.
C is, and will remain the most used language IMO, because of the freedom it gives you when you write. The syntax doesn't matter, you can manipulate the memory however you want, you're assured that the environment will be setup for it, and there are a shitons of tools to work with it.
Because of its simplicity, you can create complex data structures, shape it however you want, and manipulate it to your likings. But some programmers don't like this "freedom" (as in, you're free to make bugs), and thus prefer languages that will prevent you from making errors. Some people just don't need the freedom C gives, and it's perfectly fine. But some people prefer shitting over it without even trying to understand why C is used this much. Just ignore these people.
So to answer your first question: NO. C isn't impractical for modern languages. It's just better suited for some project, like any language.
For your second question... Dude, play with wmutils however you want! I'm just affraid you won't be able to have a lot of fun with it, because of how simple the tools are.
If you want to play with a few projects, I'd suggest 2bwm. It's well written, and has a huge potential to implement new features.
A good way to play with it is to take the Euler project, and go as far as you can. exercises 1 to 8 are a good start. You could then start rewriting some of your shell scripts in C to optimise the perfs and similar things.
After you're done with it, just search for cool libraries and create tools using them (termbox, inotify, libcaca, ...).
Also, read other's people code, it's the best learning source.
PS: as for the last line:
RE: The impracticality of c & projects - venam - 24-08-2015
The impracticality of c & projects
Let's check the definition:
Quote:1) Unwise to implement or maintain in practice.
I would agree with the second definition but not the first.
C, like all programming languages, has its place and usage.
I won't explain what it's good for because it has already been done in this thread.
Let me just add this; You'll soon get the hang of many languages and libraries and you'll be able to discern in what situation one language is more appropriate than another. It will depend on factors such as the framework, environment you are working with, your needs, your time, etc..
Unfortunately, unlike scripting languages, C programs take time to polish and secure which makes it impractical in today's ever moving world. It needs investment! Companies have to make trade-offs to be able to use C.
(24-08-2015, 07:38 AM)z3bra Wrote: PS: as for the last line:I don't get that line, what do you mean?
RE: The impracticality of c & projects - vain - 24-08-2015
(23-08-2015, 09:41 PM)Houseoftea Wrote: First: I've been Reading a lot and people keep saying c is impractical for modern projects. Useful only on embedded systems or for kernels. Is this because its a low level language or its lack of objects or are they wrong?
I know some Java and Python programmers who work on "modern" projects. Those people think on a completely different level. It's a bit hard to explain... They're more like "software architects" instead of "programmers". They don't build rooms nor houses, they build entire cities and countries. Some of them even try to build an entire planet. From their point of view, using C is like using scissors to cut a tree.
It's also important to note that those people are often professional programmers (as in: they get paid for writing code). With very tight schedules and huge piles of TODO lists, they simply can't afford taking the time to write good C code.
They are very pragmatic people. They want libraries and frameworks that do most of the job. Why? Because it's less time consuming, it's much easier and it's less error prone.
Thus, they rightfully argue that C is impractial -- at least for what they do.
At the other end of the spectrum, there's us. I guess that most of us "work" in our spare time. We're enthusiasts. It's not even "work", we're doing this for fun. There's no nagging customer. There's no manager. We care about clean code and simplicity. We care about the little details. And we're not forced to comply to weird specifications (most of the time).
For us, it's a lot easier to use C. It is indeed practical.
However, I don't know any professional C programmer in person. I'd be interested to know: How does the work of professional C programmers differ from the work of Java and Python programmers? What kind of software do they write? Why do they use C? Did they even choose C or is it a requirement?
RE: The impracticality of c & projects - z3bra - 24-08-2015
(24-08-2015, 01:37 PM)vain Wrote: However, I don't know any professional C programmer in person. I'd be interested to know: How does the work of professional C programmers differ from the work of Java and Python programmers? What kind of software do they write? Why do they use C? Did they even choose C or is it a requirement?
I know a few of these guys. They're especially knowledgeable and I consider them as "code gurus". One of them writes drivers for a living, so you might argue that he works with hardware and that's why he writes in C. But as a hobby, he also uses C for totally different projects, eg using ncurses. And you'd have a hard time finding flaws in his code, because C isn't a language anymore, but his preffered tool to be build, well... tools.
It's like when you build a house, you don't think about which hammer you should use for what. You just grab that good'ol hammer that's been with you for the last 10 years, and use it like an extension to your arm.
It's just a matter of habits. The language really doesn't matter in the end.
@venam: I read it like an implicit complaint that you close all threads, not sure why.
RE: The impracticality of c & projects - apk - 24-08-2015
(24-08-2015, 08:54 AM)venam Wrote:There have been times in the past where you have closed Houseoftea's threads for breaking forum rules. I am sure he meant it sarcastically.
RE: The impracticality of c & projects - Houseoftea - 24-08-2015
Thanks for all the great responses!
I did mean it sarcastically by the way, sorry for any confusion
RE: The impracticality of c & projects - pranomostro - 31-08-2015
I am not sure about C.
I have done a lot of programming with it, and in the future it also seems like I will do more with it, but sometimes I bang my head on my table and against my wall because my malloc sets a struct and a string to the same memory position (I still remember it: 0x6010111) and I can't find out why and then I wish I had done it in lua.
I would say C is good if you want to write a small, self-contained command line-utility, like cat, or a programming language. These are tested often, speed is crucial, and it is _very_ portable.
Things I wouldn't use C for is developing something security critical. Seriously, we have to ban this. Heartbleed was one example, and there is so much more that we don't know-this should be stopped. seriously.
RE: The impracticality of c & projects - vypr - 01-09-2015
(31-08-2015, 07:26 PM)pranomostro Wrote: Things I wouldn't use C for is developing something security critical. Seriously, we have to ban this. Heartbleed was one example, and there is so much more that we don't know-this should be stopped. seriously.
I don't see any specific programming language being beneficial in security applications. That's like me making a shitty PB&J and blaming the breadmakers for it.
Stuff like that is human error when they develop the application. Programming languages aren't made with security in mind (besides any runtime-based languages, such as Java and the HotSpot VM). Anyone can make an insecure program in any language.