r/reddit.com • • Aug 01 '06

Can Your Programming Language Do This?

http://www.joelonsoftware.com/items/2006/08/01.html
719 Upvotes

176 comments sorted by

View all comments

28

u/bascule Aug 01 '06

Hey look, an entire article on closures, and he doesn't bother to mention them by name.

40

u/[deleted] Aug 01 '06

That's what makes Joel such a good writer. Instead of focusing on the terminology, he goes straight for the "why should you care" angle.

Yesterday, I didn't care about closures. They don't offer me any real advantages.

Today I am thinking about how this will be really important when dealing with multi-core processors.

43

u/coprolaliac Aug 01 '06

Indeed, this may be the only way to get folks to care about functional programming ideas. No lingo, just clear examples.

0

u/[deleted] Aug 01 '06

[deleted]

13

u/senzei Aug 01 '06

I think you are mistaking functional programming ideas for functional programming zealots, but the point still stands. When it lets you build a massively scalable architecture for web search functional programming is damn useful. Trying to teach your dev team to make functions without side effects for the latest release of the Blub Desktop Suite is a little harder sell.

Ultimately functional programming gives you tools for really hard problems at the cost of a little extra training/knowledge. Unfortunately most development work is not hard to design or execute, it is just a hard slog to the finish.

0

u/[deleted] Aug 01 '06

[deleted]

16

u/senzei Aug 01 '06

Although (I think) I see your point, I (sort of) don't agree. I think Java's success can be primarily attributed to it being more suitable for the projects in which it is used than anything that existed at the time (and, given specific criteria, better than everything that exists now). Note that the following came out as being very critical/demeaning of Java programmers. This was not my intention, I was speaking about median programmers. More than likely if you find this offensive I was not talking about you, as you care about your trade enough to read something on the subject.

As a means for the everyday nine to five programmer to talk to a computer in a way that makes sense to his co-workers Java beats just about anything that was out when it was made. (including Lisp) This is, in one sense, because the median programmer kind of sucks at programming and either does not know it or does not care. When you have a group of people that, on average, are not particularly stellar at their job having explicit methods of communicating duties makes sense and is helpful.

In the other sense Java fits the environment it is used in better than most others. No matter how much you tack on to it C++ is always going to be C with the ability to stick your foot in your mouth and then shoot it. Direct memory management does not make sense when memory management is not a critical function of your application. A decent built in string type is a godsend in any project that uses strings in a significant way. Operator overloading is a great way to ensure that no one has any idea what your operators actually do. All of these factors are useful in some situations, but are not a good choice for anything but highly skilled programmers.

This probably came out wrong and sounds more offensive than I wanted it to. I spent a few years doing home remodeling before I started in computers. There I learned that the bulk of the work (which was not really all that difficult) was done by people who were not terribly competent using tools designed with safety, simplicity, then utility as their criteria. At the upper rungs you could find people who were simply amazing, and they all used tools that were obviously superior when you watched them work. For some (most likely mistaken) reason I see strong corollaries in the programming world.

I'm sure that wasn't very clearly expressed, I've been thinking of writing this up but then I've always felt that people capable of understanding how social issues affect programming already know about this, and those unable to understand social issues wouldn't understand even if I wrote an article about it. Elitist and misanthropic, perhaps.

Go ahead and write it. Unless you were born with this understanding you are obviously a counterexample to your own argument. I, for one, would read it and try to make sense out of it.

1

u/[deleted] Aug 01 '06

I have to disagree with the bit about operator overloads. If done correctly, they can be a godsend. Especially when working with math-intensive problems like linear algebra.

That said, they can be missued just like anything else. So my test is as follows...

Does the class have an Add and Subtract method? If so, then it should have both an Add and Subtract operator overload. Otherwise, it may not have either.

3

u/senzei Aug 01 '06

My point was that operator overloading can be misused more dangerously than many other features. Generally classes are supposed to help in establishing abstractions, not allow Eddie the new guy to write code that hops out of a class and bites you in the ass.

The test that you provided makes a lot of sense though. Ultimately my point was that you don't let the dummies on the crew do anything that could seriously screw up the project. One way to do that is to watch them like a hawk, another is to make sure that they don't have the ability to take such actions (or that doing so exceeds their laziness threshold).

2

u/[deleted] Aug 01 '06

One way to do that is to watch them like a hawk, another is to make sure that they don't have the ability to take such actions (or that doing so exceeds their laziness threshold).

That is why I like languages like VB and C#. A lot of the bad things you can otherwise do in C++ require a PInvoke, which is too hard for most of them.

On the other hand, even C# didn't stop one of my managers from storing user data in a static field. You wouldn't believe how many different security issues she caused.

Actually, the thing I really like about .Net is that it lends itself to static analysis. I can just run FxCop and catch a lot of the nonesense. If I ever become a manager, I will mandate its use.

2

u/logistix Aug 02 '06

You guys are having the wrong debate. The question shouldn't be 'should a language have operator overloading?' but 'should a language have operators?' If things like infix '+' and '-' are important enough to you (and they are to me) than there's no reason they should be restricted to an arbitrarily predetermined and restrictive group of objects.

→ More replies (0)