background preloader

Criticism

Facebook Twitter

Stm

Functional Programming Doesn't Work (and what to do about i. Read suddenly and in isolation, this may be easy to misinterpret, so I suggest first reading some past articles which have led to this point: Admitting that Functional Programming Can Be AwkwardFollow-up to "Admitting that Functional Programming Can Be Awkward"Back to the Basics of Functional ProgrammingPurely Functional RetrogamesPuzzle LanguagesHow I Learned to Stop Worrying and Love Erlang's Process Dictionary After spending a long time in the functional programming world, and using Erlang as my go-to language for tricky problems, I've finally concluded that purely functional programming isn't worth it.

It's not a failure because of soft issues such as marketing, but because the further you go down the purely functional road the more mental overhead is involved in writing complex programs. That sounds like a description of programming in general--problems get much more difficult to solve as they increase in scope--but it's much lower-level and specific than that. In C, this is easy! The problem with Python namespaces modules (or, Python Namespace. Tales of a Semantic Web Skeptic. Right now the world’s premiere semantic web conference is happening in Washington, D.C. As a graduate student of the fellow who’s chairing the conference this year, and working down the hall from Sir Linked Data himself, I’ve had my fair share of semantic web experiences.

But my background is not in Semantic Web technology, so joining a group so focused on the semantic web threw some of its core tenets into sharp relief for me. So here, from the perspective of a human-computer interaction guy, is what I’d like to see changed about the semantic web: Stop Calling Everything ‘Semantic’ At worst, the term ‘semantic’ in a title can mean “we re-did existing research using {RDF, RDFa, N3, OWL, SPARQL, DBpedia, Semantic MediaWiki},” without a clear notion of why this would be a good thing.

At best, the term is still very unclear about what it implies. Who’s the User? That’s not a jab. To solve important problems, you need to know who your users are. Is Java dead? September 21, 2009 by Stephan Schmidt Is Java finally dead? There has been much discussion about the end of Java. As a developer, do you need to care? How do you need to change your decisions in the case that Java is dead? I have pounding this question for the last several years, beginning with my adventures into Ruby at the end of the 90s. In a very interesting thread on LtU Sean McDirmid wrote: The Java death watch continues. While Ross Smith is adding: I think Sun will be widely recognised as doomed, if it isn’t already dead, by the end of 2009, and they’ll take Java (and the JVM) down with them.

A lot has happened since then: Orcale is buying Sun, the JRuby team has jumped ship to Engine Yard. 2009 has not yet ended, we will see if that prediction holds true. Searching for java is dead with Google, one gets Results 1 – 10 of about 8,620,000 for java is dead. Dead indeed. For a start we first need to explore what “dead” means, and in particular what dead means for Java. Faster to write? Inconsistencies in the .NET Enum class. During a recent project of mine, I had to do a lot of enum manipulation using the .NET Enum class and I have to say I wasn’t impressed. Besides the shortcoming of it not being a generic class (and thus not being especially type-safe), Enum also has some strange inconsistencies in terms of how it handles matched integral types.

GetName Why does GetName return null for any integral type you pass it except those that correspond to a constant? For example, this is completely valid: In every other case in the Enum class where you pass an integral value outside the range of the underlying type, you get an exception. Except here. IsDefined Why does IsDefined throw an exception when you pass it an integral value that can be safely narrowed to the enumeration’s underlying type?

For example, this will throw an exception: Why? ToObject Why does ToObject silently overflow for values outside the range of the enumeration’s underlying type? For example, this code will give the following non-intuitive result: Why OO Sucks. When I was first introduced to the idea of OOP I was skeptical but didn't know why - it just felt "wrong". After its introduction OOP became very popular (I will explain why later) and criticising OOP was rather like "swearing in church". OOness became something that every respectable language just had to have. As Erlang became popular we were often asked "Is Erlang OO" - well, of course the true answer was "No of course not" - but we didn't to say this out loud - so we invented a serious of ingenious ways of answering the question that were designed to give the impression that Erlang was (sort of) OO (If you waved your hands a lot) but not really (If you listened to what we actually said, and read the small print carefully).

At this point I am reminded of the keynote speech of the then boss of IBM in France who addressed the audience at the 7th IEEE Logic programming conference in Paris. Why OO sucks Objection 1 - Data structure and functions should not be bound together Consider "time". Why WeakHashMap Sucks. Function inlining in JVMs is a solved problem, right? It's a key performance optimization routinely done by JIT's everywhere (some might say: THE key optimization).

Inlining has more than a decade of fine tuning in the Java context and over 40 years of production experience in the compilers and systems before that. I'm off to another conference - this time TSSJS in Las Vegas. Well, I’m baaaaack….. after a nearly year-long hiatus. I went to FOSDEM this year, in Brussels. About Unsafe and CompareAndSwap (and NonBlockingHashMap). A reader asked me: where is the volatile-like orderings guaranteed in NBHM? CAS - Compare-And-Swap instruction (or on IBM Power chips: Load-Linked / Store-Conditional). Unsafe - Java-level access to raw memory. Gadzooks, time flies! Part 2: Lisbon to San Francisco, via Toronto - plus ISMM and PLDI 2010 ISMM & PLDI in Toronto, CA Skip to the techy parts... As mentioned in my last blog, I am flying into Toronto from Lisbon, Portugal. Copyright© 2011 Azul Systems, Inc. I laugh at your puny human 'objects' Let's say that Earth is being invaded by aliens. The last tatters of the US government (and a motley crew of scientists and caravan enthusiasts) are holed up in a secret government base in the desert, where a crashed alien ship is stored.

One of the dashing action heroes realises that he can engineer a computer virus to take out the alien shields that are preventing any meaningful counter-attack. Our brave hacker whips up some code, which must be delivered to the alien mothership using the (now-repaired) alien fighter. They sneak into the mothership undetected and upload the virus. At the moment of truth, as they are about to detonate a nuclear device and make their escape, the virus program throws an exception because the behaviour of the 'AlienMothership' class differed slightly from our hero's interpretation, and the aliens succeed in taking over the world. I'll freely admit that this is a bit of a rant.

You're entitled to disagree. Objects are a bad model for the universe. OOP Criticism. Things to dislike about Java. Back in August I started working with Java the majority of the time. I still do a bit of Ruby, but the vast majority of my work these days is in Java. Java is good for a lot of reasons, but that is absolutely not what this post is about. This post is, in no particular order, the things about Java that I really dislike. Closed ClassesI'm not sure if there's a term for this, but it's the opposite of what Ruby calls Open Classes. Open Classes allow you to define or redefine behavior on any class at any time. String.empty? In an Object Oriented language, where objects are supposed to have appropriate behavior, I like having the ability to add the correct behavior to the correct class.

In Java, I'm stuck doing something very different. If you are in the .net camp, don't laugh too loud. Lack of Closures, Blocks, Anonymous MethodsWhenever I manipulate a list of items I find Java severely lacking. (map #(* % 2) [1 2 3]) Army of NNPPsJava is currently the "one language to rule them all". What Sucks About Erlang. What Sucks About Erlang There are the languages everyone complains about, and there are the languages no one uses. Having said that, it's time to whine about my favorite language I use quite extensively. Erlang, I love ya, but we need to have a word. Basic Syntax Erlang is based originally on Prolog, a logic programming language that was briefly hot in the 80's. Surely you've seen other languages based on Prolog, right? No? The problem is, unlike the C and Algol based languages, Erlang's syntax does away with nested statement terminators and instead uses expression separators everywhere.

Because Erlang's expression terminators vary by context, editing code is much harder than conventional languages. Consider this code: blah(true) -> foo(), bar(); blah(false) -> baz(). Lets say I want to reorder the branches: blah(false) -> baz(); blah(true) -> foo(), bar(). Or change the order which foo() and bar() are called. blah(true) -> bar(), foo(); blah(false) -> baz(). What's the problem? If Expressions. Design patterns are from hell^2! Some anonymous soul emailed me regarding my “Design patterns are from hell!” Post, arguing that “somehow, knowing patterns exist is the same as knowing different data structures exist” and that “understanding the different ways for creating objects (hello creational patterns) is like understanding the implications of deciding to use a dequeue rather than an array or rather than a linked list.”

I was also bravely asked what I thought about these statements. Well, guess what, since one can never diss design patterns enough, this is what I think… They’re from hell! No, there are no similarities between data structures and algorithms on one side and design patterns on the other side! A second important distinction is that data structures and algorithms do not come encumbered with preferred usages. Design patterns are spoonfeed material for brainless programmers incapable of independent thought, who will be resolved to producing code as mediocre as the design patterns they use to create it. Functional code != Good code.

There’s a dangerous trap to fall into: The belief that functional code is automatically good code. Hopefully not too many people would come out and actually claim this, but it seems to be an unstated common belief. It’s also utter bollocks. Functional programming gives you tools for writing good code. Good functional code can be very good (good imperative code can be very good too! But that’s not the point of this post). Bad functional code can be just as bad as its imperative cousin. Now, what post about functional programming would be complete without some trivial one liners? Imperatively: Functionally: The functional code is a little shorter. And it would have been exactly the same thing (literally. One advantage of the fold here is that you can use it as an expression without binding it to a variable. Thing is, both of these examples are the wrong way to do it in the middle of other code. (Unfortunately there is no sum method in the Scala standard library.

Imperative version: Um, no. Interface design and the iPhone. Response to critics For the iPhone video, we hacked into the network ID field on our iPhone and put in the names of fast networks that are nonexistent or not available in the slow-network United States. Thus "ET 3G," "WiMax," "700 MHz," and "DoCoMo" as shown above . This idea of this prank was (1) to make a little joke about the very slow AT&T Edge network in comparison to fast networks, (2) to indicate that our iPhone redesigns are for fast networks, and (3) to see if our viewers of the iPhone video figured out (1) and (2). All this turned out to be pretty much an insider joke. (In 200 people at Google who watched the video, about 5% raised their hand when I asked if they noticed anything special about the iPhone network shown in the video.

This reminded me of the amazing video of the moving basketballs and the gorilla.) Our comment thread on the iPhone video thread received a a number of earnest, detailed critiques. Well, I don't do Lowest Common Denominator Design. -- Edward Tufte. C++ Frequently Questioned Answers. Generics Considered Harmful. Posted by arnold on June 27, 2005 at 10:53 AM PDT I don't know how to ease into this gently. So I'll just spit it out. Generics are a mistake. This is not a problem based on technical disagreements. It's a fundamental language design problem. Any feature added to any system has to pass a basic test: If it adds complexity, is the benefit worth the cost?

The more obscure or minor the benefit, the less complexity its worth. Generics are way out of whack. We went through that chapter multiple times, consulting with several people who wrote the specs and are otherwise experts. Learning to use generified types can get very complicated. Interface Holder<T> { T[] toArray(); } Why, you ask? Actually, I'm only mildly embarrassed to say that I've forgotten. Although there is an exception. T[] toArray(Class That's OK to do. Which brings up the problem that I always cite for C++: I call it the “Nth order exception to the exception rule.”

Humans can't track this stuff. And we are grateful.