Extremist Programming
blog.ezyang.com
blog.ezyang.com
What I'm a little annoyed with can be summed up with a single banal and overused phrase: "the right tool for the right job".
For one, this phrase really doesn't say all that much--it's basically a tautology. Yes, using the right tool would be good, but with programming languages, it's rarely obvious what the right tool is! It's just a specialized version of the advice to "make the right choices", which is not much advice at all.
Another problem is that people inevitably ignore how much programming languages overlap. Virtually any languages worth comparing are going to be general-purpose languages. Choosing between a functional language and an OO language is not like choosing between a hammer and a screwdriver to pound in a nail, it's more like choosing between different types of hammer. In a world where hammers can do anything. (I don't know enough about carpentry to extend the analogy properly.) There are very few applications where one language clearly fits and another is clearly unsuited--and if you're in a vertical like that, the question just won't come up in the first place!
Another thing that comes up is people assuming that a multi-paradigm language has the benefits of all the paradigms it supports. I've found this is never the case. Even very multi-paradigm languages tend to favor one paradigm or the other more. And even if they didn't, there are benefits to being consistent. You can do much more by being functional everywhere than you can by merely supporting functional programming in some places. Any mix of paradigms is necessarily going to be a compromise, and the advantages of prioritizing one main paradigm can outweigh the flexibility of supporting more than one to any large extent. Doing one thing, and doing it well, is a powerful idea that doesn't stop applying in designing programming languages.
Now, I'm not leaning one way or the other here in any comparison of languages (I'm sure my biases are pretty evident and show through, they're just not germane to this comment); I just think that summarily dismissing a language for being too focused or too "extremist" or not multi-paradigm is rather short-sighted. Also, often, unless you've tried doing something in a language yourself, don't assume it's more difficult than what you already know. There is much "common wisdom" about (like "functional programming is bad for GUIs") which is often more "common" than "wisdom".
Take it one step further and ditch the terrible "tool" analogy altogether. It isn't like choosing between two hammers. Nothing we do is like driving a nail. We can't mix and match the way a carpenter can, taking hammer A for pounding these big nails, hammer B for the small ones, 4 different saws, a lathe, planer, etc. You can't use java's classes and perl's regexes and haskell's laziness. You have to pick the whole toolbox together, and take it as it is.
But if you're looking to do cross-language like that, you have to know a lot about both languages and place some constraints on yourself.
I don't really see .NET as a viable implementation of your vision, but I wanted to at least point out that it does make those claims in case you were unaware.
Another approach might be to look at things as objects, and to try and model functional programming in terms of objects. I'm sure you're familiar with how F# is implemented, and you'll probably agree that it's a disaster (although the language itself isn't terrible). The idea of building functions on top of an OOP which is defined in terms of functions clearly misses the point somewhere. The end result is a very specific compatibility layer between two different languages, but very far from solving the more general problem of language compatibility.
.NET isn't the only platform, or even the first to attempt this approach though, and it's hard to really blame them for not solving this problem, which they didn't set out to solve, but merely added as an afterthought. The author's article is about solving problems on principle, rather than making practical solutions and then trying to adjust them to solve other problems.
Nemerle is an interesting language on the .NET platform. The idea behind it is to have a syntax which can be extended from the language's own macro system - using a type-safe AST which is targeted with a PEG grammar. The eventual idea is that you should be able to use any syntax to target the same semantics in the AST, essentially merging the language and compiler into the same tool. 2.0 version is an attempt to define all of Nemerle's own syntax as it's macros - making it a good example of the "extremist programming" the article is talking about (and certainly a bit closer to jonsen's vision than .NET in general).
For a simple example, I might write my prototype in Python. After profiling I might decide to rewrite a couple of inner loops in C (or Cython). I might tie it to SQL Server as a datastore and use T-SQL in the interface.
This also allows the possibility that it is possible to do great art with scrap paper or to crumple up a beautiful sheet of handmade paper. OOP/FP/etc are like various folding techniques.
Which is (i) a pity, and (ii), not entirely true. Sure, current modern compilers represent huge piles of code, but others are small enough that you can realistically craft your tool like a jedi would her lightsaber.
Of the top of my head, I have 3 example of language implementation small enough to be customized, ported, or otherwise scavenged for ideas. Lua, OMeta, and Maru.
It's interesting to consider how you can exploit parallelism more easily, for example from going from a sequential instruction set and language to an inherently parallel instruction set and language. Nobody has found the ultimate answer to that yet. GPUs execute thousands of sequential threads in parallel, and while that works for problems with massive and regular parallelism, it does not work for irregular parallelism or parallelism that requires fine grain communication or short lived parallelism or not-so-massive parallelism. FPGAs do work well for those types of parallelism, but they have other problems for general purpose computing. With hardware trends, it's inevitable that we'll see more and more parallelism and eventually a paradigm shift to inherently parallel architectures. Interesting times ahead.
For instance, let's take the problem of multiplying ten numbers. In a normal processor, you have a loop of instructions, each instruction has to go through a "fetch" state (to load it from memory), a "decode" stage, to figure out what the instruction is, an "issue" stage, to figure out which processor pipeline can best execute this instruction, an "execute" stage, to finally execute the instruction, and maybe a "commit" stage to write the outputs back to memory. (The exact number of stages and amount of parallelism depends on the microarchitecture and pipeline depth, of course). What if we wanted to just build a chip that did this? We could put ten multipliers on the chip, and then do the exact same operations in just a few clock cycles, since we would have no instruction fetch or decode, no commit, no loops, and so on. This is a contrived example, but my point is that general-purpose processors are incredibly slow compared to dedicated hardware, precisely because the extra transistors necessary to make processors general purpose also take a large portion of the computing time.
I find the idea of FPGAs reconfigured per-application to be really interesting. Celoxica (http://www.celoxica.com) seems to do some sort of FPGA-based software acceleration for trading software, for instance. I wonder if it's possible to do something like this for a more general market...
http://chester.id.au/2009/10/21/upsetting-the-natural-order/
Pragmatic languages FTW!
Shameless Plan 9 plug.
http://en.wikipedia.org/wiki/Plan_9_from_Bell_Labs#Design_co...
Edit: Which came from Multics, I know.
Or better yet, a listing that shows where a given principle hasn't been extremified, so we can go try it out and see what happens?
Don't get me wrong, experimentation is a great for learning about limitations and capabilities; but I personally wouldn't use it as my primary means for learning about the design of something (unless it was very poorly documented, in which case I would try to avoid using it at all).
The thing that impressed me most isn't the article though, but the amazingly beautiful clean look of that blog. Really a pleasure to look at and read on the iPad :-)
"Mass is awesome. What if every object in the Universe had mass?"
"Liberty is awesome. What if there should be no such thing as slavery and every human being should be free?"
If you pick the wrong principle and take it to an extreme, then yes, it'll lead to undesirable results, but that means you should throw bad principles out, not all principles.
Yes, he said that sometimes it won't work; but the whole point of the article is that you can discover and learn new things when you try taking one principle to its logical conclusion.
Where did you get the idea that he was arguing against that?
That would be an argument against science, which labors under the same constraint (i.e. with rare exception, things don't work), but as it turns out it really isn't an argument against science at all, because the rare "thing that works" tends to change the world.
No. Great science is done by people who are more like Newton and Tesla, not people like you and Edison.
Apart from the fact the "great science" isn't the topic of discussion, on the contrary: in terms of maximum effect on the human race, the "greatest" science is the man of the street who can't be bamboozled by an idea that has no supporting evidence.
That's a rather grandiose claim. Where's your supporting evidence?
Modern times is my evidence. The reason the Church didn't burn Galileo at the stake in 1633, as they did Bruno in 1600, is, not because they didn't want to, but because public awareness of science, of the value of comparing ideas to reality, had changed enough in that interval to make it a practical impossibility. And that was just 33 years.
The single most important manifestation of science is the general increase in everyday scientific reasoning, not the specialized form of science practiced by professionals, as important as the latter surely is.
Professional, high-level science gives us vaccines and modern medicine, certainly very valuable. Everyday science gives us the notion that an unfamiliar idea or claim must be accompanied by evidence. The second trumps the first.
IOW, who you have decided to credit is morally perverse.
What? Are your reading what I'm posting? There was no mob, there was an all-powerful Church. It was the Church, not the public, who objected to what Galileo had to say and who put him on trial.
> But the credit still goes to Galileo for his insight, not the common man ...
You completely missed the point of this history lesson. The reason Galileo didn't share Bruno's fate wasn't Galileo, it was the common man. Times and perceptions had changed. Galileo and the common man both benefited. Everyone moved ahead except the Church.
The Church wasn't reluctant to burn Galileo at the stake because of his discoveries. Quite the contrary -- he was prosecuted for precisely those insights and the degree to which they contradicted Church dogma. But they could only go so far, because of public relations and changing times.
> IOW, who you have decided to credit is morally perverse.
Since I did no such thing, I don't have to defend it.
It's clear from what you're posting that you have no clue about this historical period, so ...
http://law2.umkc.edu/faculty/projects/ftrials/galileo/galile...
What's clear is that you haven't actually provided enough evidence to support your claim, that your original attack on me is pure hypocrisy, and that you now wish to cover your tracks by pretending that I just don't understand you.
"Wildly unsubstantiated"? Do you go outdoors much? It is a fact on the ground -- a dramatic reduction in religious persecution, indeed of religion altogether, a decline in the acceptance of superstitious beliefs, an increase in intellectual freedom demanded by the common man, and a thousand other examples. And the assumption that an idea with no supporting evidence is assumed to be false, by itself the most important evidence for public acceptance of the scientific outlook.
The true revolution in science is not the existence of scientific specialists (as important as that is), it is the fact that the public is willing to pay for the science, because they know it works, both as public policy and as an intellectual model for everyman.
Science is not about "actual scientists" as you put it. Science is about reality testing instead of blind belief. That's what distinguishes modern times from 500 years ago, a time when superstition ruled. Science cannot survive without public support, and public support requires public comprehension. The existence of working scientists is an effect, not a cause.
Look, I'm not going to bring you up to date on the last 500 years of human history, you're responsible for your own ignorance. Solve the problem st its source -- start now:
http://en.wikipedia.org/wiki/History_of_science
> What's clear is that you haven't actually provided enough evidence to support your claim
It's not my claim, as you would know if you knew anything at all.
I know it went over your head, but the dispute here isn't about the basic facts of history, it's about your grandiose misinterpretation of those facts and your inability to distinguish a "fact" from an extremely broad generalization.
"Mass is awesome. What if every object in the Universe had mass [and did not have liberty, only mass]?"
"Liberty is awesome. What if there should be no such thing as slavery and every human being should be free [and had no mass, only liberty]?"
Pure mass without liberty is wrong. Pure liberty without mass is nonsensical.
That's a photon.
You can also notice this technique in a debate, someone takes the emotional stakes to an extreme - while it's usually used as an attempt to convince you, it's actually a useful practice because it can magnify otherwise overlooked elements of the positions, opinions, and principles.
The only medication I remember from Nineteen Eighty-Four was Liberty Gin. I think you're thinking of Brave New World with soma.