top | item 7332820

The Best Programming Language (or How to Stop Worrying and Love the Code)

179 points| alvatar | 12 years ago |blog.fourthbit.com

161 comments

order
[+] V-2|12 years ago|reply
Based on the code snippet, I'm not surprised he thinks C# is "verbose" with "lots of boilerplate" and "resembles Java", because the snippet is written as if it WAS Java, or at least written 10 years ago. Compare his GetFrequencies implementation with idiomatic, LINQ version: http://pastie.org/8834650
[+] ansimionescu|12 years ago|reply
This. I am as anti-Microsoft as the next guy, but C# is one of the few "insanely great" things they have.

edit: I'm not just blowing hot air, I've actually wrote C# code that went into production.

[+] koyote|12 years ago|reply
I completely agree. After having used C# extensively recently, and having used quite a lot of Java before that, I have a feeling that C# is what Java should have been/should be.

LINQ alone makes C# infinitely less verbose and 'boilerplate' than Java.

[+] skrebbel|12 years ago|reply
Same for his PHP examples. He seems to have picked notably horrible examples for the languages he doesn't really like.
[+] mcv|12 years ago|reply
I know nothing about C#, but I keep hearing announements of Groovy-like features in C#, and to me, Groovy is what Java should be (but with better performance). If C# is really like Groovy with better performance, then it should be a very nice language indeed.
[+] cpfohl|12 years ago|reply
+1 This. C# counter-example: NancyFx. A library that enables you to write a complete Web Server in a custom DSL that (if written correctly, of course) reads as close to English as you can imagine. Plus Type Safety. Plus awesome SQL Server Support.

P.S. The other reason you use C#: you want to interact w/ SQL Server. TDS works, but boy is it a pain compared to just adding a reference in Visual studio. Also the bindings for TDS are pretty weak in some languages.

[+] computerslol|12 years ago|reply
If you wanted to make a version with a live UI that's monitoring a stream instead of a file, I suggest Reactive Extensions. It adds support for IObservable, the stream version of IEnumerable (what LINQ is used against). Once you get your head around it, there is magic to be made. I think a bunch of Reactive Extensions is now bundled with .Net. It is produced by Microsoft.

http://rxwiki.wikidot.com/101samples - A cursory look; it goes far deeper than this.

[+] romanovcode|12 years ago|reply
BUT IT ISN'T SEXY ENOUGH!
[+] stinos|12 years ago|reply
Some nice angles in the article, but now I feel obliged to defend C++ (and actually C# and F# too, but I'll let that to others as I'm sure it will turn up in the HN comments) since the author seems to make no real points to support his view of it as a monster.

First of all, it's not because x [1] and y and a bunch of others say that "a == true", you can safely use it as a fact or a way to support your view (those logical fallacies are called Bandwagon Fallacy/Appeal to Authority).

Second: I don't know where those code samples come from, but that is not exactly how you write good C++, as it is called in the paragraph. And a paragraph lower there is mention of the dreaded C/C++ - a thing that does not exist, never has, and never will. Some might say that adds to the author's points (as in, it's so hard he doesn't know how to write it properly), but you might as well say: sorry, but if you don't know how to write it properly then you do not really have the bagage needed to start criticizing it let alone calling it a monster.

[1] esecially when x is called Linus and he's in one of his rage moments where every single being that does not think alike is violently insulted and reduced to the dirt of the earth, with or without arguments making sense :]

[+] NAFV_P|12 years ago|reply
> Some nice angles in the article, but now I feel obliged to defend C++ (and actually C# and F# too, but I'll let that to others as I'm sure it will turn up in the HN comments) since the author seems to make no real points to support his view of it as a monster.

C++ is incredibly popular, the term "C++" is even known among some non-programmers. This might partially explain why it gets a lot of flack .... oh, that reminds me:

There are only two kinds of languages: the ones people complain about and the ones nobody uses - Bjarne Stroustrup, http://www.stroustrup.com/bs_faq.html#really-say-that

I take the view that all languages are ugly and stupid, especially languages like C and English.

[+] andrewcooke|12 years ago|reply
i guess maybe now is a good time to repeat this request - does anyone know of a good, recent book that describes how to write correct, modern c++ using the latest standards and staying with the subset of the language that expert users recognise as elegant and powerful?
[+] GhotiFish|12 years ago|reply
Well isn't that a cute dilemma. You're either an idiot, which means you won't understand it and shouldn't criticize, or you're not an idiot and your lack of understanding is an effective criticism.

Reminds me of Haskell.

Personally, I'm of the view that the planet is populated by humans, and you have to work with them, and C++'s arcane tome of a standard is perhaps a hostile environment for such creatures.

[+] V-2|12 years ago|reply
I love how F# is among the "unreasonable languages". Why? Because it's "Microsoft trying to be cool", "many of us have learned to keep away from Microsoft the hard way" and "we have enough company-sponsored languages already". That's it.
[+] collyw|12 years ago|reply
I was surprised by that one, as I have not tried it, but it does sound like one of Microsoft's nicer efforts when I read about it.
[+] bromagosa|12 years ago|reply
«The first true object-oriented language. But it seems to me Smalltalk is pretty much a forgotten language.»

Why do so many people kill Smalltalk so fast?

I could give so many URLs to illustrate how Smalltalk has a stable and growing community, with so many open projects and people making a living out of it, teaching it in universities and using it for research, but I think these two links sum it all up:

http://forum.world.st/ http://smalltalkjobs.wordpress.com/

[+] sanderjd|12 years ago|reply
Well, just from my noob point of view, every time I've dug in and tried to get into Smalltalk, I've found the language to be really really nice, but I've found the ecosystem to be really really confusing. The concept of needing a development environment and a persistent image (probably not even using the right terms...) just doesn't click with me. I struggle to figure out where to put things, or how to use my editor, or how to use source control, or how to distribute my programs, and maybe some other things I'm forgetting.

I'm sure there are mind-expanding answers to all these questions, and I remain open to learning, but I wanted to give a counterpoint to the frustratingly inane "har har curly braces" sibling comment. Sounds like Pharo is nice (but that's what I heard about Squeak before...).

[+] klibertp|12 years ago|reply
+1 for this - Pharo is my platform of choice for developing hobby projects and I'm really pleased with it. And it moves really fast, with 3.0 release scheduled this month (IIRC) and with very exciting features planned for 4.0 too.

I checked out some other Smalltalks, including the GNU and VisualWorks ones, but Pharo comes as the cleanest all-in-one Smalltalk starter kit.

On a related note, I recently started playing with Io, which is very interesting too. It's smaller than Pharo and not image based, which makes it better suited for scripting (although it's possible to run Pharo in headless mode), has easily modifiable syntax and is pure object oriented with prototypal inheritance. If you like Smalltalk give Io a shot, chances are you'll like it too.

[+] overgard|12 years ago|reply
> Why do so many people kill Smalltalk so fast?

Because it doesn't have curly braces. Entirely unfair, but it seems like if you want to sneak in an innovative language it needs to be a wolf in sheep's clothes. (IE: it need to vaguely resemble C)

[+] klibertp|12 years ago|reply
> First of all, a disclaimer: unless you’ve developed in 30+ languages, and suffered the code of others in all (or most) of them, you can’t really be objective. So yes, I’m biased. Like most of the people writing about this topic. Actually, I believe that this topic becomes absurd as soon as you are well-versed in many languages.

I fully agree with this sentiment and I wish more people either already had 30+ languages experience or at least realized that most of what they say now will sound stupid to them once they got this experience.

[+] isxek|12 years ago|reply
No mention of Lua? I guess the author hasn't tried it yet, either. (I haven't, but I was curious about his opinion on the language.)
[+] Tomis02|12 years ago|reply
After years in the C++ swamp, programming Lua feels like being a world-class sprinter. Sure, there are places where it could be less verbose (the 'function' keyword, if-then-end), but overall it's liberating to have so much power with so little typing. Ok, it's a visceral (not technical) impression, but there's plenty of places to read about Lua online. I highly recommend giving it a try.
[+] declan|12 years ago|reply
Agreed. It's not as terse as something like Python, but it's pretty speedy and generally a pleasure to program in. (I'd get headaches if I had to look at Objective C blocks all day.) On the other hand, the availability of pure Lua libraries and even the official documentation aren't as complete as they could be.
[+] jbeja|12 years ago|reply
The whole post i was expecting a mention of it.
[+] amirmc|12 years ago|reply
For OCaml, there are many more companies using it than just JaneStreet. Facebook and Bloomberg being some of the well known ones.

http://ocaml.org/learn/companies.html

[+] rwmj|12 years ago|reply
Red Hat .. somewhat kicking and screaming, but we've shipped the OCaml compiler, libraries and programs written in OCaml since RHEL 6 (note that Red Hat does not support the OCaml compiler, although there are customers that use it).

Edit: The chances are if you used a program that started with virt- on any Linux distro, then 50/50 OCaml was involved in the making of that program. It was either written in OCaml or used OCaml to generate large amounts of C boilerplate.

OCaml binaries look a lot like C binaries, so it's hard to tell from the binary. And it turns out that functional languages with pattern matching on data are extremely good for generating all that C boilerplate, like crap you need to write for FFIs or dealing with remote parameter marshalling.

[+] pjmlp|12 years ago|reply
Including Microsoft, which many aren't aware of.
[+] MisterMashable|12 years ago|reply
Have you ever seem a simple Prolog program solving the 'four coloring problem'? Try programming that in anything else. Prolog or something similar like Lisp with pattern matching is the tool of choice for speech recognition programs. Why these tools get dismissed in a world of tablet devices using Siri or Google is beyond me.
[+] dmunoz|12 years ago|reply
I'm not sure I agree with this line of reasoning.

The computation model of Prolog is fairly simple, relies on few primitive, and could be reimplemented in many language without much hassle. The abstract interpreter fits on a 1/4 page.

With unification and backtracking, you're into nondeterministic programming. It's great for some problem, and I agree it should perhaps be more regarded than it is, but it can be emulated inside other languages to solve such problems. You also have to be quite careful when using non-determinism.

That being said, my main point is that I think the "simple Prolog program solving" X is misleading. Of course a solution to a problem that requires exactly the model of computation the language provides is going to be simple in that language. But that model of computation isn't exclusive to that language, and I don't feel the implementation of the model in other languages suffer.

[+] kkoch986|12 years ago|reply
I think prolog gets a bad rap because people don't spend the time to learn how it really works and how awesome it really is. More than matching which you can get in most functional languages, non-determinism from prolog makes solving all kinds of problems (four coloring included) elegant and simple. If prolog had more of a community behind it, I think it would move up that list pretty quickly.
[+] mbillie1|12 years ago|reply
It's a bit sad that we keep reading these articles and keep falling into the same trap of rush-to-defend-your-favorite-language and rush-to-complain-that-your-favorite-language-was-omitted. I find these articles seldom thought-provoking and the comments they inspire even less so. It's like reading "10 best ski runs in the country" or something. It's entirely subjective and hardly anyone will agree for any decent set of reasons.
[+] mcv|12 years ago|reply
No Groovy? If you want to address which is the best JVM language, you've got to at least mention Groovy. Its advantages include being trivial to learn for the vast hordes of Java developers, while making programming a lot more fun in a Ruby-like way.

When to use it? When you want the JVM, and productivity is a bigger concern than performance.

[+] michaelfeathers|12 years ago|reply
Progress is when languages move from the unreasonable list to the reasonable list. I was happy to see Haskell there. I don't think it would've been 5 years ago.
[+] nzonbi|12 years ago|reply
This was an excellent article. Agree with the author on many points. Some notable mentions:

- Scheme: One of the best languages. A shining example of the beauty of simplicity. I personally envy folks that got to learn programming with SICP. Unfortunately, I didn't crossed with the SICP as a kid, when I would probably had devoured it.

- Haskell: possibly the most advanced programming language, with the downside of having way too much syntax.

- Opinions on programming languages are biased most of the time. Significant experience with dozens of languages is required, to diminish the bias.

[+] sfvisser|12 years ago|reply
Haskell too much syntax? That's a very weird claim. Haskell's syntax is one of the leanest around.

You could even argue the lack of syntax can be confusing sometimes. Beginners often mix up types, patterns and expressions, because there isn't a huge syntactic difference.

[+] pcwalton|12 years ago|reply
> If there is something that could debunk C is a low-level language with great support for concurrency. Or maybe a mythical language with the properties of Haskell and the pervasiveness of C.

So, Rust? :) (Minus the pervasiveness, right now—but you do have the low-level control.)

[+] santialbo|12 years ago|reply
If by "F" the author means F#, he has no idea of what he's talking about. The language is open source with an Apache license.
[+] onli|12 years ago|reply
The bash-example is not very bashy. It is sh, like the header says. Bash fully supports a native for:

  for i in {0..5};do
      echo "$1"
  done
[+] wes-exp|12 years ago|reply
I'm sorry Common Lisp is not elegant enough for the author, but it has a great community and library support. (At least compared to scheme)

Efforts are also underway to spruce things up a bit. https://github.com/fukamachi/cl21

[+] nhmit|12 years ago|reply
Whenever someone says PHP is useless I know that they have no idea what they are talking about. Being ugly is one thing, being useless is something quite different and in case of PHP this could not be further from the truth.
[+] timje1|12 years ago|reply
Strange, this article doesn't call PHP useless.
[+] jbeja|12 years ago|reply
Breath, breath, he never say somothing against PHP.
[+] pjmlp|12 years ago|reply
C, or how to keep your job safe as security consultant.
[+] rottyguy|12 years ago|reply
A bit surprised by how much attention this article is getting here. Someone nailed it by saying it has much breadth but little depth. A speed dating synopsis of competing programming language to speak. Obviously the author likes brunettes with fair skin.

I recall reading the "Design and Evolution of C++" and found it quite enlightening. One wishes this type of book was a mandatory delivery for all Language authors...

[+] edem|12 years ago|reply
Clojure is definitely __NOT__ a sibling of Scala. Being a sibling of scala would mean that it is something like C to C++ or Java to Ceylon.