Live data from Hacker News

C, The Beautiful Language

tenaciousc.com

21–30 of 85 posts

Re: C, The Beautiful Language

#21
post #16
post #6

> we watch Ronaldo doing things on the pitch Hmmm... Lionel Messi does crazy things you never thought were possible. He's Lisp. Gareth Bale has few fancy tricks, but does what he does very well, and often relies on pure speed - C. Joey Barton is good, but has a bad reputation and a sordid history - Fortran? Etc :-)

I wonder which Ronaldo he meant. I can't quite get over the moody, cheating side of Cristiano Ronaldo to appreciate his abilities. Having a Cristiano Ronaldo as a developer would be a bloody nightmare. It'd be like having a co-worker who turned in some inspired code, but who lied, stole, picked fights and was generally a chore to be around. I hope he meant Brazil's Ronaldo circa 2002 :)

Of course I meant Brazil's Ronaldo...what kind of sports fan do you think I am? :)

Re: C, The Beautiful Language

#22
All it means is that he understands C better than other languages. Even Java (yes, Java) has these rhythms that he speaks of. You look at code and you feel the logic, even the necessity of it. That's just the feeling of being in tune with code and with the person who created it, thanks to a shared understanding of the language. Master any language and you'll get the same feeling when you read well-written code. Actually, though, the less boilerplate a language forces you to write, the less you'll feel that "inevitability," since much of the "inevitable" structure of the code -- the predictable patterns in the design of code, or, one might say, "design patterns" -- is code you shouldn't have to write in the first place.

Re: C, The Beautiful Language

#23
post #9

This is a nicely written tribute, but there are two generalisations that I feel are worth pointing out. Many parts of Linux kernel are really, really nice C code. Sadly, in my experience most C code is not especially nice. I don't know how this extends to the football metaphor, but certainly I wish most of the C code I have encountered (not to mention written) in my career to date was one tenth as neat. On balance, I…

What are some specific examples of beautiful C code in your view? Asking for a friend.

Plan 9 code is beautiful http://plan9.bell-labs.com/sources/plan9/sys/src/

Although there are a few extensions in its C compiler http://plan9.bell-labs.com/sys/doc/compiler.html

Re: C, The Beautiful Language

#24
C was my second love after QBasic. I still admire its simplicity, yet also admire the abstraction, readability, and community of Python.

As anyone on Stack Overflow would tell you, it's a matter of using the right tool for the job. I like to imagine programming language selection as an optimization problem: given a job, over the set of tools, maximize the appropriateness of tools for the job while minimizing the number of tools. Without a tool number constraint, you could call from an infinite number of tools, and one would be best, but that incurs overhead, obviously. The tool number constraint keeps the problem feasible.

For numerical computing, {C, Python} solves my optimization problem.

Re: C, The Beautiful Language

#26
post #20

Earlier quoted context omitted.

What are some specific examples of beautiful C code in your view? Asking for a friend.

After finding the documentation and guides for writing nginx modules woefully inadequate, I did a lot of poking around in the nginx internals to better understand how things worked. The code is very readable, follows good style guidelines, and has its fair share of brilliant workings. I found that the source code served as much better documentation than a lot of _actual_ documentation that I've read.

You beat me to it! I was just about to suggest the nginx internals. :)

Re: C, The Beautiful Language

#27

Stupid question: what do you do when you're working in C and want OOP?

Use OOP. :)

But seriously, you don't need a language to smack you in the face with OOP syntax to use OOP, and with anything in programming, if you try to do it just like you do in other languages, you're going to be disappointed.

Re: C, The Beautiful Language

#28
post #9

This is a nicely written tribute, but there are two generalisations that I feel are worth pointing out. Many parts of Linux kernel are really, really nice C code. Sadly, in my experience most C code is not especially nice. I don't know how this extends to the football metaphor, but certainly I wish most of the C code I have encountered (not to mention written) in my career to date was one tenth as neat. On balance, I…

What are some specific examples of beautiful C code in your view? Asking for a friend.

I like poking around FreeBSD's code, specifically some of the drivers and userland. I find a lot of code that rpaulo commits to be particularly clean and understandable. Some of rdivacky's work on boot2 and clangbsd is also inspiring to me.

http://svn.freebsd.org/base/user/rpaulo/

Re: C, The Beautiful Language

#29
post #15
post #7

Earlier quoted context omitted.

As such, any abstraction or syntactic sugar that distances you from the flow of the program fail. Bu that's for programs that are procedural. Functional programming has no flow. Truth neither moves nor changes. To use an analogy, a procedural program is like music, where rhythm and motion of the instrument are the essence of what you are representing. Functional programming is more like sculpture, where you create an…

I haven't done functional programming really, I didn't think of that case. Interesting that it still seems to apply, though. If your abstractions in functional programs obscure that flow, they still strike me as a failure. Though I'd be interested in if functional programmers would disagree, I obviously don't know functional design patterns.

If you reason about functional code with appropriate assumptions: they don't lie. A big part of functional programming is making code easier to reason about in isolation.

If you want good procedural C code, read Lua. That shit is polished.

Re: C, The Beautiful Language

#30
post #21
post #16

Earlier quoted context omitted.

I wonder which Ronaldo he meant. I can't quite get over the moody, cheating side of Cristiano Ronaldo to appreciate his abilities. Having a Cristiano Ronaldo as a developer would be a bloody nightmare. It'd be like having a co-worker who turned in some inspired code, but who lied, stole, picked fights and was generally a chore to be around. I hope he meant Brazil's Ronaldo circa 2002 :)

Of course I meant Brazil's Ronaldo...what kind of sports fan do you think I am? :)

... A Real Madrid fan?
Post reply on HN