4 ms·
"I also think that Clojure is particularly enjoyable, elegant and beautiful, while at the same time extremely practical, easy to learn, and well suited to moder
by sramsay 13y ago
"I also think that Clojure is particularly enjoyable, elegant and beautiful, while at the same time extremely practical, easy to learn, and well suited to modern application development; it is the best designed programming language I have encountered in my almost-two-decades-long programming career . . ."
I am absolutely with you there, but after writing a reasonably serious, production-level system in Clojure, I suddenly realized a fatal flaw in this and in many other hip and cool languages. It is very, very difficult to write clear, readable code.
I accept that it might just be my lack of skill, but as the stuff I was writing became more complicated, I found myself writing the Lord's prayer on the head of a pin more and more.
In the end, I started to actually long for a language that had fewer language features -- something that allowed far, far less flexibility in the way ideas are expressed. C is far from perfect, but more and more I see the wisdom of one of the early statements in the K&R in which they say that figuring out what to remove is part of the art of creating programming languages (or something like that).
There's no language in which you can't write unreadable gibberish, granted, but some of these newer languages make it damn hard to write non-trivial programs that are easily read by others.
- ww520 13y agoAmen. People often don't realize we read code far far more than we write code.
- tikhonj 13y agoC has quite a few features, and the language design is pretty arbitrary. (Yes, it's often based on (old) hardware, but then hardware design is pretty arbitrary.) I haven't used Clojure much, so I'll mostly talk about Scheme. I suspect the two are similar in all important ways. If you look at the matter critically, you'll find that Scheme (and, I suspect, Clojure) are actually simpler and smaller languages than C. Neither has nearly as much syntax. There is far less undefined behavior. C has way more corner cases than Scheme: there are a ton of C quizzes out there which basically nobody can solve; I couldn't imagine much of that for Scheme. You just have to memorize the relatively obscure rules for what types get automatically coerced to each other. C has whole classes of hard-to-solve bugs that other languages simply do not. Bus errors, segmentation faults, buffer overflows... All the exposed low-level details obscure the meaning of the code; unless they're important to your application, they just make your code harder to follow. Moreover, common C idioms (some of which are just workarounds for missing features) make code much harder to follow than it should be. Thanks to the use of out parameters, you never really know where the result from a function is, without reading the documentation. I recently wrote some code that depended on ioctl--that single function sometimes returned the result as the return value and sometimes modified fields inside the struct you passed into it! Hard to follow is an understatement. Errors are signalled as integers instead of some semantically meaningful data type. Of all the languages I know, C is the one that makes it the hardest to write non-trivial programs that are easily read by others. I suspect you're just making the common mistake of confusing familiarity for some sort of innate quality.
- sramsay 13y agoI don't really mean to defend C (though I rather like it, despite its many flaws). I only meant to point out the wisdom (which I recall reading in the K&R) of this idea that "taking away" features might make it easier to read and debug -- and maybe even write -- programs. In fact, Scheme is a sterling example of that very principle (relative to, say, Common Lisp, and I would argue of Clojure as well). I agree with you about Scheme, which is a very minimalistic, wonderful, eminently readable, "one way to do it" language. But Clojure has something that Scheme doesn't: a massive set of libraries. C has that as well. That, of course, is a different subject entirely . . .
- comex 13y agoAt least it's not C++, where out parameters are often written as references, which appear exactly the same as normal arguments, rather than usually having a telltale &. :)
- dustingetz 13y ago"a language that...allowed far, far less flexibility in the way ideas are expressed" that is a design goal of Java, and it turns out that "everything is a class" is a really expensive way to write software. As in large systems take thousands of man-years and $100MM and contain AbstractFactoryFactoryProviders. Not because the engineers are bad, but because that's what you end up with when everything is a class. Sometimes, Scala codebases are criticized because they use monads or have too many arcane unicode symbols in them. But I'll take scalaz over AbstractFactoryFactoryProviders any day. At least scalaz makes sense.
- cmccabe 13y agoYes, absolutely. Anyone can add features to a bloated language. The most beautiful designs know what to leave out and why. C was one of those designs. If you like the C design aesthetic, you should check out Go. It's like a garbage collected and yes, memory-safe version of C, which substitutes composition for inheritance and goroutines for threads.
- inerte 13y ago"In other words, the only way to do good, efficient, and system-level and portable ... is basically C." http://harmful.cat-v.org/software/c++/linus http://harmful.cat-v.org/software/c++/linus