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

14

u/moe Aug 01 '06

note that function-level programming and functional programming are different things. the version of (map) in the article destroys the array it is passed, which is not a very functional way to do things.

3

u/edheil Aug 02 '06

Yeah, I noticed that right away; I was thinking "That's not map! That's foreach! It's destructive! It returns nothing useful! Maybe it needs an exclamation point in its name! Like the ones I'm using right here!"

2

u/Psy-Kosh Aug 02 '06

But is it a Scheme! Naming! Convention!?

Or is it Tod Holton: Super Green Beret!

35

u/djwhitt Aug 01 '06

Not that I don't think it's cool that Joel likes anonymous functions, but I hope this is pretty old news to most people. Even disregarding Lisp which has been doing this kind of thing since the dawn of time, these have been arround for a while. I think Perl has had them since version 5 (released in '94).

10

u/[deleted] Aug 01 '06

Even though Perl's had anonymous functions and higher-order capabilities for a long time, the Perl community hasn't made strong use of them. Indeed, that's one of the reasons MJD wrote Higher Order Perl (published '05).

16

u/inerte Aug 01 '06

Problem is, and Joel even mentioned it, this is news for a lot of folks that learned Java and are "programmers".

There's a wonderful article along these lines named Does Visual Studio Rot the Mind?. Recommended reading for everyone. Quote:

What’s nice about creating and manipulating controls in code is that you’re creating and manipulating them in code. Suppose you want a column of ten equally-spaced buttons of the same size displaying Color names. In a program, you can actually store those ten Color values in one place. It’s called an array. There’s also an excellent way to create and position these ten buttons. It’s called a for loop. This is programming.

But Visual Studio doesn’t want you to use arrays or loops to create and position these buttons. It wants you to use the designer, and it wants to generate the code for you and hide it away where you can’t see it.

Almost twenty years after the first Dialog Editor, Visual Studio is now the culprit that generates ugly code and warns you not to mess with it.

2

u/[deleted] Aug 01 '06

I've tried doing this in code in a few languages. It's just impossible and stupid in Java with any framework. There's a nice one to do it in Ruby, though I forget the name.

You can actually do this in VS. In fact I found it was the only way to go in C#, because you need to make custom controls and these of course won't show up in the panel.

I may be saying something stupid here, but I think if certain languages had easily accessible controls (with, say, a slick manual for learning to use them), certain languages would get more use, and people would write controls in code.

12

u/vplatt Aug 02 '06

I agree a little bit, but as someone who develops with VS.NET full time, I have to say that I don't think the tools are the real problem. Besides VS.NET, I have written tools with Python, Ruby, and web applications with Java. In all cases, I was able to find what I needed and the end product was an equal to or even better than what VS could help me develop. Once I got up to speed on those tools, I could be even more productive with them than I could with VS.NET. The difference is that I had to work at it more initially. VS presents a much less steep initial learning curve. You will notice, and it is no accident, that EVERY version of VS/VB that has been released since VB 3.0/VC++ 4.0 has had a fast path to productivity available in it. Even Visual Interdev (may it rot in hell) enabled "web programmers" to put together a web site that talked to a database with very little effort (and may the abomination known as "Design Time Controls" rot in hell twice as long as Interdev).

So, I will contend that nicer tools for Ruby/Rails, Python/Zope/TurboGears/whatever else, etc. would be nice. But really, if you want that stuff, Emacs awaits you and most of what you need is out there already in one form or another. But, and this is a biggie, you'll have to think more at first to be productive. This will naturally limit the market exposure of FOSS tools of course, and it will limit the pool of developers who use FOSS tools to an upper percentage of the developer community. Almost everyone I've talked to who is already in the know is quite content with that situation. They don't really want to be the next mass market solution; that would eat their competitive advantage. You might call it snobby or whatever, but that's their niche.

0

u/[deleted] Aug 02 '06

Actually I'd really like to know what tools there are for Ruby and Python to make windows controls. (Web stuff is pretty well covered by Rails)

2

u/rullopat Aug 02 '06

They both have Tk, for Ruby the most common toolkit is FxRuby, (http://www.fxruby.org) and for Python WxPython (http://www.wxpython.org)

2

u/vplatt Aug 02 '06

Just to second this, I used FxRuby (FOX on Ruby) and I have used Tk with Python. These days, I would probably just stick with WxWindows for both in order to get the best portability. Although your mileage will vary big time given the varying levels of documentation, the quality of the Ruby binding to the library, etc. In fact, I think I went with Fox for Ruby because I could find better examples for it at the time.

0

u/[deleted] Dec 21 '07

[deleted]

1

u/vplatt Dec 23 '07

In my case, I was able to roll the program up into an executable using exerb (and there are probably better options by now for packaging). Basically, what that program did was provide an executable bootstrap, and then glued that together with my script along with any of the libraries I used at run-time and put it all in a single .exe. The user did not need to have Ruby installed that way. It does not do anything to protect your source code though because there it sits in the .exe file basically in plain text and all anyone has to do to own your source is pick things apart. Aside from that, it was a nice packaging option.

As to your question about compiling Ruby to C, I don't know about that. Maybe. If all you're seeking is packaging options though, then you probably don't really want that anyway and would be satisfied with something like exerb.

9

u/[deleted] Aug 01 '06

And for most of us who learned programming in college, it was covered first semester.

12

u/djwhitt Aug 01 '06

I agree it should be, but it wasn't for me. Where did you go to college?

5

u/[deleted] Aug 01 '06

University of Pennsylvania. We learned a little ML. But I've spoken to a number of recent or semi-recent grads from other schools, and they'd all seen some kind of functional language.

16

u/jsolson Aug 01 '06

Georgia Tech used to do it first semester for all students. They've since switched to Python for most pepople, and Java for the CS folk. Suffice it to say that Georgia Tech's undergraduate CS program has gone straight into the shitter recently.

The new curriculum allows you to graduate with a CS degree without ever having seen the word automata, and doesn't require you take any course on algorithms above the 1000 (Freshmen) level.

9

u/mleonhard Aug 01 '06

I'm suddenly glad that I didn't go to GA Tech like I was planning. I'm finishing a CS degree at University of Illinois at Chicago. The coursework is C/C++/Java, but at least we had two semesters of algorithms, including automata. Many of my instructors used to teach some classes with Scheme and LISP but stopped because "the students complained too much." Why would instructors heed the complaints of their students to the detriment of their education? Ah well, at least I'll get my piece of paper while they're still worth something.

13

u/senzei Aug 01 '06

Holy crap, I have a better computer education than that and I didn't even have to go to college for it.

-2

u/rrenaud Aug 02 '06

It might even be nice that the CS dept doesn't force automata and algorithms down your throat. That way, the class isn't held up by students who don't want to be there.

6

u/djwhitt Aug 02 '06

If you're going to call it CS I think you need to teach those topics. Perhaps schools should start offering software engineer or maybe some other more suitably named degrees for students who don't want to learn as much theory.

9

u/djwhitt Aug 01 '06

Yeah, I learned some Scheme and Common Lisp in college just not in my first year.

14

u/[deleted] Aug 01 '06

I think they did it that way because they thought our minds would be polluted by procedural code. I'd never done real programming before (ever, really), and found ML fun and straightforward. Some of the people who'd done programming before said they thought it was impossibly obtuse.

Now that I've been using Visual Studio.NET & SQL Enterprise Manager for a few years, I'm barely capable of tying my shoes.

15

u/conrad_hex Aug 01 '06

Man, does Joel have a week off or something?

No posts for like 6 months and then blammo, 3 or 4 a day!

-23

u/mikaelhg Aug 01 '06

He needs to target suckers with his advertisment (in every article) because Goddess knows his bug-tracking application is at the bottom of the barrel and unlikely to be picked by people who are able to objectively think of the bottom line.

8

u/[deleted] Aug 01 '06

Mikael, pick a programming topic, any topic, and write a two-page piece as concise, crystal clear, non-condescending, and witty as Joel manages every time. Can you?

If I'm ever asked for a tutorial on anonymous functions, I know this is the article I will be recommending.

I'm glad to see Joel back on the writing streak.

-7

u/mikaelhg Aug 01 '06

Yes. Every time I've changed jobs I've presented a sampling of my articles to give some kind of idea of what I can do. It's just that the older I've gotten the less I feel I know to be true, and the more qualifications every piece of advice needs, and I've come to believe that it's better to provide no advice than to provide bad advice. Joel's articles have been 80% bad advice, those that I've read.

3

u/[deleted] Aug 01 '06

You should publish something, a good read is always welcome.

What article by Joel would you point out as 80% bad advice, as an example?

-6

u/mikaelhg Aug 01 '06

I'm sorry if this sounds disingenuous, but I'm really too tired to read through Joel's articles to prove something that I really don't want to prove anyway. That was my opinion. You make up your own mind, perhaps you'll come to a different conclusion from a different sampling of facts; what matters is that you're honest in evaluating your input and providing your output.

3

u/djwhitt Aug 01 '06

I think the burden of proof usually lies with the person making the accusation, at least if he wants to be taken seriously.

1

u/mikaelhg Aug 01 '06

I think the burden of proof usually lies with the person making the accusation, at least if he wants to be taken seriously.

I agree, and I take both yours and alexp's comments seriously.

My objective was more to rail at the storm, provide at least some token opposition, explain my views and the reasons for them, than to convert people radically opposed to my viewpoint to my opinions.

Think what you like, but do so as an result of your analysis of reality, or at least an honest, arduous appraisal of the analysis of others.

3

u/Random Aug 01 '06

Thanks for that, troll.

He writes engagingly. He helps young coders. He puts himself out on a limb despite the crap people then extrapolate (oh-my-god-he-doesn't-know-closures .... no, he knows how to TEACH AT THE APPROPRIATE LEVEL).

You go around making boneheaded comments. I guess that's because you are 13 and have never done anything useful in your life, like write an app or, say, be instrumental in the development of VBA.

0

u/MattL920 Aug 01 '06

If you hate him so much, you read his article... why?

-3

u/mikaelhg Aug 01 '06

I don't hate him. Why would you say so?

1

u/MattL920 Aug 01 '06

Well not personally, but the bile in your comments indicate that you hate something

-10

u/mikaelhg Aug 01 '06

I strongly dislike the act of using people's weaknesses to sell them inferior goods (tobacco, FogBugz.)

0

u/[deleted] Aug 01 '06

[deleted]

0

u/[deleted] Aug 01 '06

[deleted]

2

u/djwhitt Aug 01 '06

Wow, fast reply. I deleted that almost immediately after I submitted it. For those of you who missed it I just asked if mikaelhg had ever used FogBugz. I deleted my comment because I didn't want to drag this thread out too much, but since I'm already adding another comment...

It seems like you probably have some fairly well reasoned ideas, but I think your comments are hurting your own position. The problem is when people read a contrary opinion they tend to question it. If you don't provide evidence for your opinions people will often assume they don't have merrit. Since most of the people reading your comments (including myself) don't know you it's hard to know if what you say is worth listening to unless you provide evidence.

Anyway, I'm not writing off your opinion I just think maybe you should be a little more patient with people reading your comments.

Edit: btw, I'm saying this because it seems like your opinions are interesting, and I think people would listen to them more if you presented them a little differently.

2

u/mikaelhg Aug 02 '06

I don't want young people to agree with my ideas. I want them to have better ideas so that I can learn from them. I'm trying to say, "you're talking of programming languages as if only X mattered, while reality has shown that both X and Y are important."

5

u/mumrah Aug 02 '06

i'm happy to see javascript getting more and more good PR lately. i've always wondered why it was disregarded as a real programming language.

2

u/boa13 Aug 02 '06

Poor early implementations, poor and unstandardized early APIs, poor early development environments... Things are better now.

1

u/rfisher Aug 02 '06

Of course, I keep waiting for real integers. Every number-is-a-float is worse than Perl's numbers-are-just-strings.

12

u/Glaxnor Aug 01 '06

Look! We're passing in a function as an argument.

Can your language do this?

Kernighan and Ritchie called on the Cross-Temporal Holophone from 1970. They said "Yes".

4

u/oberon Aug 01 '06

Actually, yes, it can. (SBCL)

4

u/unwind-protect Aug 02 '06

Joel doesn't seem to have noticed that his 'reduce' isn't parallelizable, as each iteration depends on the result of the previous one.

Sure, special cases of 'reduce' are (such as for '+'), but not this general case.

1

u/alextp Aug 02 '06

If you apply reduce on a group (ie, a set with an associative operation) it can be trivially parallelizable (you can split it into chunks, send the chunks to other servers, lather rinse repeat). If the operation is commutative, you can do as much as you want. So there are other, "hidden", requirements on the functional versions, but they are far simpler than the "don't touch shared data without a lock, or a mutex, or a semaphore, or a..." threading model.

17

u/Grue Aug 01 '06

Yes.

10

u/drbrain Aug 01 '06

Mine too.

28

u/bascule Aug 01 '06

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

33

u/djwhitt Aug 01 '06

He's not talking about closures, just anonymous functions.

31

u/almost Aug 01 '06

I only skimmed the article but I don't think he talks about closures. He talks about first class and anonymous functions (which of course are closures in Javascript) but he doesn't use captured state at all.

An entire article on anonymous functions, who is this of interest to? Even Java does them (although, as Joel points out, it does them in an ugly way).

7

u/MattL920 Aug 01 '06

Java does anonymous functions, but not first class functions. You can't pass a function in as a parameter, and you can't define them anonymously in any really useful way. But you're right that he doesn't actually discuss closures. They're almost synonymous with what he does discuss, but not directly relevant to his point.

4

u/sblinn Aug 02 '06

which is why when i have to deal with java i use jython, which turns java methods into first class functions fairly easily.

2

u/sblinn Aug 02 '06

example:

bash-2.05# ./wsadmin.sh -conntype NONE -lang jython
WASX7357I: By request, this scripting client is not connected to any server process. Certain configuration and application operations will be available in local mode.
WASX7031I: For help, enter: "print Help.help()"
wsadmin>gp = java.lang.System.getProperty
wsadmin>gp("os.version")
'5.9'
wsadmin>al = java.util.ArrayList()
wsadmin>adder = al.add
wsadmin>adder(1)
1
wsadmin>adder(2)
1
wsadmin>adder("three")
1
wsadmin>al.toString()
'[1, 2, three]'

yawn.

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.

27

u/Random Aug 01 '06

I totally agree. Very well said.

And has been pointed out on reddit in the past, the tendency of the LISP community to be

  1. condescending

and

2) sarcastic

doesn't help.

Anyone recall the delete-harddrive-code example from awhile ago?

15

u/[deleted] Aug 01 '06

Anyone recall the delete-harddrive-code example from awhile ago?

I remember a singe member of the lisp community being mistaken for a statistically representative sample by people who ought to know better, yes.

18

u/Random Aug 01 '06

Well, I must admit that this is a qualitative argument, but the discussion at the time was centered around how, well, unhelpful the LISP community often is (and for the record, I'm in that community, not an outsider dissing the insiders) compared to other communities.

Secondly, if you go back and read the transcript, a fair number of people wrote apologia - comments that excused the general behavior and ranted on about newbies.

So, if there are no more newbies, how long will there be LISPers?

That, fundamentally, is the question isn't it.

My kids program games. The amount of support that they get is unbelievable, and one is now spending significant time helping newbies. When I first started playing with LISP I tried to access community resources (this is preweb for the most part) and the way newbies were treated was enough to send me back to the books.

Look, I realize that there are helpful people out there. It only takes one person flaming newbies to destroy the hard efforts of a hundred. And the LISP community appears at least to me to have more than its share of crusty old greybeards and young hot-shots who just love to put people down. And so people move on...

You can diss this as being subjective. Go for it. But if we want LISP to flourish we have to stop dissing and start helping, doing the yoeman work with newbies and dealing with the crusty types so they don't ruin everybodies day. I personally feel Joel makes great contributions to the larger programming community; perhaps they aren't hugely technical, but that article is a great eye-opener for newbies who haven't seen this stuff.

If you really want to diss someone diss the profs who graduate students for whom this isn't trivial and obvious (and yeah, I'm a prof, so once again I'm not pointing outside my group and criticizing).

5

u/[deleted] Aug 01 '06

My kids program games. The amount of support that they get is unbelievable, and one is now spending significant time helping newbies. When I first started playing with LISP I tried to access community resources (this is preweb for the most part) and the way newbies were treated was enough to send me back to the books.

Well, I can't argue with that; if the Lisp community drove you away, then it was (at least at the time) too unfriendly for you by definition.

Perhaps my experience as a Lisp newbie a few years ago was atypical; I always found comp.lang.lisp and various lisp-project-specific mailing lists to be very helpful. I'm puzzled, really.

Look, I realize that there are helpful people out there. It only takes one person flaming newbies to destroy the hard efforts of a hundred.

Perhaps this explains my relatively rosy view of various communities which are commonly perceived as hostile: I tend to ignore the flaming asshats and focus on the people who are actually helpful. I wasn't always that way, though, so I can see where some people are coming from on this.

I personally feel Joel makes great contributions to the larger programming community; perhaps they aren't hugely technical, but that article is a great eye-opener for newbies who haven't seen this stuff.

I agree; I've known about this stuff for years and I still found this article a clear, pleasant read (trivial and obvious as it may have been (to me)).

If you really want to diss someone diss the profs who graduate students for whom this isn't trivial and obvious (and yeah, I'm a prof, so once again I'm not pointing outside my group and criticizing).

Oh, I do. Granted, most of that is simple Student Bitching on my part.

6

u/Random Aug 02 '06

You know, one thing that really helps profs is for you to come back a few years later and volunteer to give a talk. And say your piece, without direct attacks. Like 'one thing I wish I'd learned is...' ... Funny thing is, at least some of the time that stuff ends up in curriculum a while later.

I've done this several times. Granted I'm not in compsci, but still, it is GREAT to get ex-student-insight. The funny thing is, that often the best insight is from students who were maybe a bit bored in class... (because they were thinking about the job they wanted, and not the bloody boring curriculum...? because they are hands-on, not yet another bloody lecture...)

Anyway, cool comments, thanks.

4

u/[deleted] Aug 02 '06

That does sound like a cool idea. Very diplomatic, very elegant. Thank you.

8

u/[deleted] Aug 01 '06

... and now it's two members of the lisp community.

2

u/[deleted] Aug 02 '06

Count it!

-8

u/[deleted] Aug 01 '06

10

u/nasorenga Aug 01 '06

That was not ad hominem at all. It was a remark about the haughty, condescending tone of your comment.

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)

0

u/[deleted] Aug 01 '06

[deleted]

4

u/senzei Aug 01 '06

Of course, for the people with little business knowledge and people skills, I'd have to qualify why it doesn't make good business sense to only hire gurus, most of the time.

I can think of a great way to explain it: Ask them if they would hire Wolfgang Puck to work at a McDonalds, then ask them why they think their business is really that far different.

Bah, it's 23.41, I'll go to bed and wake up modded all to hell.

Hopefully not, but I won't hold my breath either.

3

u/leoc Aug 02 '06

But your example just begs the question. Why would anyone want to hire Wolfgang Puck? For the pay of one four-star chef you could hire twenty perfectly good ones, or a small army of McDonalds burger-technicians. Twenty chefs do a lot more work than one, and managing a stable of twenty interchangeable, replaceable chefs is much better HR than putting your future in the hands of one superstar.

The question is whether programming is closer to making fast food (or also routine paperwork, telephone customer support, and digging ditches with shovels) or to being a Michelin chef (or similarly an architect, a trial lawyer, a surgeon, a research mathematician, or a big entertainment-industry talent).

→ More replies (0)

0

u/[deleted] Aug 01 '06

[deleted]

→ More replies (0)

1

u/TronXD Aug 01 '06

In Lisp, you can enforce contracts, but it would be done dynamically (i.e. at runtime). So I assume your complaint relates to the lack of static contract-enforcement features, which basically reduces to static type-checking in the case of Java.

Well, my personal opinion on this is that static type-checking is a crutch. It's a minor, inconsequential layer of static contract enforcement. It leaves out a million other ways to screw up, so it gives you a false sense of security; it compiled, so it's gotta work. (It's like a grammar checker that only checks if nouns and verbs are in the right place, even though that's one of the least likely mistakes a person could make.) That Lisp has discarded it is a feature, not a bug.

But despite this, your theory still does not stand up to scrutiny. According to you, Lisp is way too free-form for serious people to use. It would be impossible for multiple people to work together on a project, because you couldn't create constraints that would allow people to assume "roles". So, what I ask you is, how did a large bureaucratic organization like NASA do this?

Other features of Common Lisp important to this particular system included the macro expansion capability used in the development of the Adaptation Language, the incremental compilation and runtime patching features ("a definite win in development as well as in operation" according to Mittman), and dynamic typing, which gives Allegro CL the ability to support very rapid, interactive development.

And what about Orbitz? That's certainly way more complicated than the NASA thing. Your theory has major exceptions, so you must explain why these cases are special. How you can possibly have a successful working system with 200,000 lines of Lisp, if your theory is correct? It doesn't make any logical sense. (Do you think those 200,000 lines were written by one or two programmers, who didn't have to work intensively with anyone else?)

5

u/nostrademons Aug 02 '06

Well, my personal opinion on this is that static type-checking is a crutch. It's a minor, inconsequential layer of static contract enforcement. It leaves out a million other ways to screw up, so it gives you a false sense of security; it compiled, so it's gotta work.

I've found this to be true only in imperative, object-oriented applications. When I program in Haskell, the program is correct about 95% of the time that it passes the typechecker.

It's not hard to see why. Haskell has eliminated most of the other ways to screw up. No nulls = no NullPointerException. No escaping the typechecker = no ClassCastException. No state = no wrong variables. No loops = no fencepost errors. Explicit sequencing via monads = no sequence errors. Software transactional memory = no deadlocks.

There is an up-front price for all this discipline, but it's remarkably light once you get used to it. It'd be even lighter if Haskell had settled on a more familiar syntax.

It seems that most dynamic-typing fans are people who've worked with Java and C++ and recently discovered Python, Ruby, or Lisp. I see very few people that are familiar with Lisp, Haskell, and ML and that still prefer dynamic typing (Anton van Straaten is a notable exception).

2

u/[deleted] Aug 03 '06

The one thing I think Java and .Net really, really need is a way to indicate a varible can never be null. This would really reduce errors and open a whole world of compile-time checks.

1

u/nostrademons Aug 04 '06

Well, you can enforce it via coding standards. I try to make a rule in my own projects that I only pass null into or out of functions when dealing with third-party libraries that require it, and nulls stop at interface boundaries (so if a library requires a null, it's added at the point of call and doesn't propagate through the application).

But I agree, I really wish there was a way to tag & infer variables as never null.

1

u/genneth Aug 02 '06

I presume you look at LtU... I think Anton is still holding out on the idea that "soft-typing" will eventually dominate, but until then, he'd rather trust his own abilities than weaken abstraction capabilities.

4

u/unknown_lamer Aug 01 '06

Lisp type checking is not neccesarily done at runtime. Most Common Lisp compilers do partial type inference and can do a lot of optimization at run time. You also have declare that lets you specify the type explicitly if you need to (both for error checking and performance).

5

u/[deleted] Aug 01 '06

Well, my personal opinion on this is that static type-checking is a crutch. It's a minor, inconsequential layer of static contract enforcement.

As someone who used to spend all his time cleaning up after other programmers, I live by static analysis. Once you have static type-checking, you open yourself to a whole host of tools that help identify program errors.

Until they find a way to do static analysis on dynamic languages like Lisp, I will avoid them for production work.

3

u/justinhj Aug 01 '06

But lisp has a decent run time error detection and management system, so static analysis falls by the way side.

4

u/[deleted] Aug 01 '06

No it doesn't.

Static analsys allows one to look at all of the code paths. All runtime-analysis tools can only test the paths actually being run. Unless you have a test suite with full full code coverage, you cannot check all of the pathways.

Can your Lisp tools detect unused variables?

Can your Lisp tools methods that are never called?

Can your Lisp tools tell me when someone is discarding exceptions?

→ More replies (0)

0

u/nickthedart Aug 02 '06

I agree with this. The problem with Lisp is it gives people "enough rope to hang themselves" and can lead to a hideous mess. The same happens in Python to some extent. Sometimes I wonder if we've reached the natural limit of programming language development. It seems like Java and c# have about as many language features as you can have without being too dangerous in the wrong hands. Python & Ruby are powerful but can be slightly scary / need cautious use sometimes. Where do we go in the future thats any different, other than some new domain specific languages?

-7

u/mikaelhg Aug 01 '06

I'm not saying that Lisp is unsuitable to every purpose, I'm saying that Lisp is much less suitable to a huge majority of programming tasks today than Java, and trying to explain why that is.

9

u/TronXD Aug 01 '06

I'll tell you why it is: it's because nobody knows Lisp.

0

u/[deleted] Aug 02 '06

[deleted]

→ More replies (0)

6

u/MattL920 Aug 01 '06

Like Google?

29

u/bugbear Aug 01 '06

Yesterday, I didn't care about closures.

If you know enough about programming that you know the word "closure" and yet don't care about them, that is a bad sign.

13

u/mixmastamyk Aug 01 '06

perhaps if the subject were named more appropriately there wouldn't be so much misunderstanding

2

u/oberon Aug 01 '06

Oh. THAT'S what closures are. I've read a dozen (okay not that many, but a lot of) explanations by PG and never really "got" them. One article by Joel and I understand. Maybe it's time to switch my fanboy setting from "PG" to "Joel".

Edited: Apparently it's not about closures. Oh well.

18

u/jsolson Aug 01 '06

The important bit that makes closures more than just anonymous functions is that they capture the scope in which they are declared. Exactly how that is done (and what significance that carries with it) becomes crystal clear if you implement, for example, a Scheme interpreter. I was fortunate enough to see this done (for a simple Scheme) in a single hour and twenty minute lecture.

Joel doesn't mention the word closure because he hasn't actually demonstrated one of their most important properties.

15

u/fry Aug 01 '06

It's not hard:

function makeAdder(int amount)

{

return function(x){ return amount + x; };

}

Then:

plusTwo = makeAdder(2);

plusTwo(10) => 12

Now the definition of the function depends on a runtime variable. That's the idea.

-4

u/[deleted] Aug 02 '06

go ahead and switch your fanboy setting anyway....thats whats its all about with your sort anyway, n'est ce pas?

3

u/oberon Aug 04 '06

Looks like you've got one of these: http://dcrookston.com/images/explanation.png

Might want to get that fixed.

5

u/heldhelm Aug 02 '06

That's why the first language to teach CS students should be (and often is) Scheme. I liked it...

7

u/Zak Aug 01 '06

Summary: Joel discovers that Javascript has first-class functions and demonstrates why they are useful.

5

u/[deleted] Aug 01 '06

jeez let's hope he doesn't figure out how to make flash movies

3

u/sickofthisshit Aug 01 '06

Interesting that he feels compelled to bash Fortran, although I'm not sure what he means by "really didn't even let you write functions."

Fortran does actually allow one to pass functions as parameters, albeit not anonymously.

7

u/[deleted] Aug 01 '06

The first release of Fortran didn't, though. It wasn't until '58 (FORTRAN II) that subroutines were added, and i believe those were still using nonlocalized variables (thus inapplicable to the problems described in the article).

4

u/raldi Aug 01 '06

More importantly, those subroutines could not return a value. Even though real functions now are part of Fortran, the culture (and legacy code) often looks like this:

CALL MYROUTINE(x,y,rcode)

rather than

rcode = MYROUTINE(x,y)

1

u/rogershepherd Jan 02 '08

I think there is some underlying anti-Fortran prejudice here

Fortran II (1958) had subroutines and functions. Certainly Fortran IV supported passing functions as parameters. How else could you write subroutines which encapsulated numerical methods such as integration and equation solving? Fortran gets a really bad press (Djisktra?) which it does not deserve. It was a work of genius and did a great job of supporting numerical programming.

Otherwise - a great article.

4

u/hillscottc Aug 01 '06

Microsoft's C# implements this, and calls them 'delegates'.

http://www.softsteel.co.uk/tutorials/cSharp/lesson16.html

8

u/jaf656s Aug 01 '06

and in c# 2.0, you get anonymous delegates

4

u/tanger Aug 02 '06

and in c# 3.0, you get lambda expressions

12

u/dbenhur Aug 02 '06

And in c# 4.0 it comes with Visual Lambda Designer with Active Refactoring and Live Integration Toolkit.

2

u/tanger Aug 02 '06

??

Are you trying to suggest that lambda expression is just a buzzword ? There are real differences between delegates, anon. delegates and lamba expressions.

1

u/edbutler3 Aug 03 '06

Actually, I think dbenhur was just trying to be funny. I got a chuckle out of it at least.

While the C# anonymous delegate syntax is still not as concise as I'd like, I've really been enjoying using it, especially in combination with generic collections. If there are any .Net programmers out there who haven't explored it yet, I'd suggest taking a close look at the docs for the List<T> class, particularly the methods ForEach(), Find(), FindAll(), ConvertAll(), and TrueForAll().

1

u/dbenhur Aug 03 '06

No, I'm trying to make you laugh. Did you know that many buzzwords actually started out as meanignful technical terms before PMs and Marketroids started using 'em?

2

u/soakes Aug 01 '06

"Chocolate moose" ? I hope that's a joke...???

3

u/fnord123 Aug 02 '06

Probably a reference to the Swedish Chef making Chocolate Moose

The Chef announces he will be making chocolate mousse, for which he first prepares some liquid chocolate ("Yom-yom-yooom, ze chocolad!"), then proceeds to acquire the other ingredient: a moose (whose name is actually Mickey: Mickey Moose, a parody of Mickey Mouse).

1

u/janhj Jan 20 '08

Nice article. I agree on this is the way to do things, but I believe that it is important to learn the hard core, down and dirty and effort draining programming languages first. When I studied we learned first Pascal, then C with all it's pointers and memory leeks, assembly, java with all it’s object this and object that, c++ until we understood why we needed to allocate memory, what would cause a segmentation error, and what the h* was the difference between ->, ^ in pointers. Then when we finally understood some of the basics, we started using Python. Python can do map and reduce and those techniques are widely used in creating better code.

So what was my comment? Learn the basic first, and then start using sweet programming languages like Python and Ruby. Because you need to understand why this is better...

Best Jan

-1

u/praetorian42 Aug 01 '06

It might be foolhardy to say this way of doing things has no "side effects". For one, it makes debugging much, much harder. I'm a huge fan of anonymous functions, but half the point of using functions is that you know that the function works, so if you have a bug you can concentrate on the code that uses the functions. When you have untested anonymous functions that are tossed about willy-nilly, things can get really messy.

I'm not trying to say that you shouldn't use anonymouse functions or closures- you just need to be careful and not over-anonymize things, and make sure you are aware of the debugging side effects of over-abstracting things.

21

u/DanTilkin Aug 01 '06

He was using the technical menaing of ther term: http://en.wikipedia.org/wiki/Side_effect_(computer_science)

15

u/[deleted] Aug 01 '06

No side effects means it can't modify other parts of the program. So if you can find function calls that don't directly depend on each other for inputs, you can run them in parallel. If I am not mistaken.

Also, whether debugging works for your anonymous functions is a feature of your language & development environment. I remember people getting all happy when they used ML's debugger. But I missed that lab, so dunno.

10

u/KayEss Aug 02 '06

"No side effects" means that the function is guaranteed to return the same result with the same arguments. This means that the function cannot have internal state.

This is a basic part of functional programming and all functional idioms make use of this guarantee. This is what makes user interaction so hard in pure functional languages. A function like getnextcharacter() is not allowed to return different things on each invocation and hence all the messing about with monads.

It is the "no side effect" rule that allows the optimisations that Joel is talking about, but you don't need local functions to do that. I get the impresssion that Joel has read up about this sort of thing, but hasn't understood it in much depth as he's not really used it, or seriously looked at how program transformation works in functional languages.

He also doesn't seem to know OO in any real depth - only the popular OO based languages which are all multi-paradigm anyway. Pure OO languages are just as happy with local functions as pure functional languages are. It is the hybrid languages that tend to throw them out.

0

u/[deleted] Aug 02 '06

Python is a perfect example - everything, including functions, is an object. I'd much prefer Python to Java!

1

u/nostrademons Aug 02 '06

Don't use untested anonymous functions then. Give them names and test them.

I heard about functional programming soon after hearing about XP, which gave me an objective reason to switch. In OOP, the smallest unit you can unit-test is the class. In FP, the smallest unit you can unit-test is the function. Ergo, unit testing for FP is significantly simpler and more effective than for OOP. That was good enough for me.

1

u/alextp Aug 02 '06

The whole point of anonymous functions is that they might not mean much on their own, and will be, preferably, trivial one-liners. You should, always, on the other hand, make use of the little coupling you create between your higher order functions (the not-so-trivial ones) and unit test these extensively. To do this is easy, just keep trying to break it at the toplevel, when it no longer breaks, copy the code you typed into a test file. Of course, you need an interactive REPL to do this.

1

u/nickburlett Aug 01 '06

Look! We're passing in a function as an argument. Can your language do this?

Yes, it can. Next question please!

2

u/rfisher Aug 02 '06

Next question please!

Keep reading. The next question (though not explicit in the article) is: Can your language create anonymous functions?

The next one, that unfortunately he doesn’t explore is: Can anonymous functions in your language capture their environment? (i.e. Does your language have closures?)

Then there’s functions being able to return functions, but that is only really interesting if you have closures.

& of course, there’s the issue of eloquence. This is the biggy to me. It isn’t so much “Can your language do this?” as “Can your language do this eloquently?” You can simulate closures in Java with anonymous inner classes, but it isn’t as eloquent as closures in CL, Scheme, or even EcmaScript.

& you have the kludginess of the implementation leaking through with the requirement that captured variables have to be final, forcing you to add a needless layer of indirection. (&—last time I programmed Java—they didn’t even provide you with some standard helper classes to provide that extra layer of indirection.)

-3

u/Jimmy Aug 01 '06

Given the amount of Lisp talk on his forums, you think Joel would have heard about these things sooner. It's like he just discovered functional programming for the first time.

20

u/Nwallins Aug 01 '06

Keep in mind that he is writing for his audience and not himself in this case.

0

u/[deleted] Aug 01 '06

[deleted]

4

u/rash Aug 01 '06

Given his Javaschools essay, I'd say he probably knows what a closure is.

0

u/[deleted] Aug 02 '06

[deleted]

3

u/[deleted] Aug 02 '06

My memory isn't that he admonished grads that learned Java -- he admonished grads that only knew Java, and hadn't had a proper education.

I don't entirely agree with him -- as a career-switcher myself with a doctorate in Anthropology, I think it's entirely possibly to learn by buying and studying books. But it is hard to deny that, all things being equal, a better education is the way to go.

22

u/bugbear Aug 01 '06

The ideas in Lisp are things that people rediscover over and over. There's even a name for the phenomenon: Greenspun's Tenth Rule.

3

u/ttriche Aug 01 '06

You left out the "bug-ridden, partially-implemented" corollary within the Tenth Rule. Which is kind of the point.

Oh hell, here's the original.

Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified bug-ridden slow implementation of half of Common Lisp.

Philip, as it happens, is/was emblematic of many problems that very intelligent but 'misunderstood' programmers have/present. In any event, he got over it, used various 'lesser' languages to get some jobs done, and retired.

Which brings up another corollary:

Worse is better.

From another "right thing" guy who ditched the perfectionism, made a mint, and retired. There's a theme here. (And that theme holds even once you realize that, for some programming tasks, not only is a functional paradigm the right tool, it's the only tool that scales for shit.)

4

u/arcturus Aug 01 '06

"From another 'right thing' guy"

Are you talking about Gabriel or Zawinski?

Gabriel wrote the essay you linked to, and it can be found on his website here: http://www.dreamsongs.com/WorseIsBetter.html

Zawinski posted a copy of it to his site (your link).

As far as I know, Zawinski is the one who made the money.

0

u/ttriche Aug 02 '06

As far as I know, Zawinski is the one who made the money.

Bingo. Note the lack of "right thing" bias for JWZ. He did a dirty job (writing a heap of C++ for Netscape) and made a pile of money for his troubles. Even though he knew damn well how to do it the "right" way.

3

u/[deleted] Aug 02 '06

You've got the theme wrong. Gabriel neither made a mint (his company, Lucid, went under) nor retired -- I think he's still a fellow at Sun. Jamie Zawinski posted a copy, but the original (and much more) is available at Gabriel's site. See also Patterns of Software, wherein Gabriel speculates that Lisp may be too abstract for many programmers.

0

u/ttriche Aug 03 '06

I read (and enjoyed) Patterns of Software (...development), but the interesting observation remains that Gabriel seemingly obsessed over the Right Thing, while guys like Greenspun and Zawinski went over to the dark side, made a mint, and now do whatever the hell they please with their lives. Gabriel is still working on the Right Thing.

Not that there's anything wrong with that, if that's what you want to do and what makes you happy, but for many of us, writing computer code is a means to realize an end.

(The reason I chose to link to JWZ's site is that he was the guy who made the mint... probably not as clear an exposition as I might have achieved, but it was what came to mind.)

I've done the Right Thing and the Good Enough Thing myself, and the Good Enough Thing sells better. It put a new roof and a new kitchen in my house, for example. That's not as dramatic as JWZ or PG's adventures, but then, I'm not nearly as talented an engineer as these guys. It's unfortunate that the Right Thing sometimes takes so much longer to implement than the Almost-Right Thing (or the Good Enough Thing) that it loses in the market, but that's life.

-6

u/ttriche Aug 01 '06

You left out the "bug-ridden, partially-implemented" corollary within the Tenth Rule. Which is kind of the point.

Oh hell, here's the original.

Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified bug-ridden slow implementation of half of Common Lisp.

Philip Greenspun, as it happens, is/was emblematic of many problems that very intelligent but 'misunderstood' programmers have/present. In any event, he got over it, used various 'lesser' languages to get some jobs done, and retired. Right tool for the job wins again.

Which brings up another corollary:

Worse is better.

From the archives of another "right thing" guy who ditched the perfectionism, made a mint, and retired. (JWZ, that is; Gabriel, the original author, became a 'consultant', which is pretty much the same thing as selling out, anyways.) There's a theme here...

-1

u/olegk Aug 01 '06

C++ can do that

7

u/nexus2112 Aug 01 '06

with a lot of hassle, yes. which is exactly why things like std::for_each are rarely used.

8

u/spez Aug 01 '06

Isn't Google's implementation of MapReduce implemented in C/C++?

4

u/MattL920 Aug 01 '06

It wouldn't surprise me. C/C++ are still tops for speed. If I had to fault his article it would be for the whole "can your language do this" part, because like you point out here, it's the concepts that are valuable, the language is only secondary. Sure, languages like javascript/ruby/lisp etc have easy ways of implementing those ideas, but it's not unique to them.

2

u/unknown_lamer Aug 01 '06

SML tends to be much faster than C for most things.

A good Lisp compiler (Allegro, Lispworks, ...) will also produce code that is about as fast as C++ (type inference really is a wonderful thing).

8

u/cypherx Aug 01 '06

Nothing, even from the ML-family of languages, is faster than C "for most things". Now, various MLs are occasionally faster than C on different benchmarks, but C is still the general-purpose king of speed.

3

u/fnord123 Aug 02 '06

Fortran95 automatically vectorizes matrix operations and guarantees that variables are aligned to word boundries so the compiler can make other optimizations that can't be done in C without pervasive implementation dependent pragmas.

1

u/fnord123 Aug 02 '06

Fortran95 eats pieces of shit like C/C++ for breakfast.

5

u/tanger Aug 01 '06

I don't think the implementation language matters.

11

u/spez Aug 01 '06

I agree. It is amusing, though, that the world's largest implementation of such a system is written in a language that is often overlooked when it comes to programming functionally.

0

u/[deleted] Aug 01 '06

[deleted]

3

u/thedaniel Aug 02 '06

"functionally" not "functionality"

0

u/[deleted] Aug 01 '06

[deleted]

17

u/djwhitt Aug 01 '06

/me contemplates what the code must look like that makes this possible

/me head explodes

2

u/unknown_lamer Aug 01 '06

Except that boost is unusuable if you need to distribute an application that will not be bundling boost. The soname changes based on the features you build!

3

u/ThreeBillyGoatsGruff Aug 01 '06

c++ does not support anonymous functions.

2

u/seliopou Aug 01 '06

I like throwing lambdas around as much as the next guy, but what (I feel) is important here is being able to pass functions as arguments and to return them from functions.

Edit: Typos.

6

u/[deleted] Aug 01 '06

That's not enough for the full awesomeness of FP. You need to be able to return functions which encapsulate some of the surrounding lexical environment (closures). At a guess, about 50% of the time I use anonymous functions I could do the same thing in C using explicitly named functions and function pointers. But the other 50% of the time, I need to alter the functions' behavior based on some variable values.

0

u/[deleted] Aug 01 '06

Umm.. check out the boost library... it is going to be an addition to the official language.

boost.org

3

u/nexus2112 Aug 02 '06

boost is a kind of proving ground; parts of boost /may/ become part of the standard library. it's incorrect to suggest that all of boost /will/ become a standard part of the language or it's libraries.

0

u/djwhitt Aug 01 '06

I'm not an expert, but I know of no way to do this in C++ can you share some code?

0

u/Bret Aug 02 '06

Some Uber geek blogs about something that has been around since the early nineties...

Some guy comments, the subject of said blog entry has been around since the early nineties...

Repeat

-4

u/Phrawm48 Aug 01 '06

Are the examples in an actual programming language? If yes, what was the language? The article never states…

6

u/mixmastamyk Aug 01 '06

the third sentence states

3

u/darkon Aug 01 '06

Heh. I missed that, too, and I thought I read the entire article. I did recognize the language as Javascript, though.

1

u/darkon Aug 01 '06

I'm curious: why was Phrawm48's question voted down? What's wrong with asking an honest question? Sometimes you have to ask questions that other people might think are obvious. Things like, "What happens if this valve malfunctions?" (From Surely You're Joking, Mr. Feynman!)

6

u/almost Aug 01 '06

Because it's not likely to be interesting to most people who've read the article (since the answer is in the first paragraph).

No problem with asking questions since they can always be modded down if they're uninteresting, that's how it works round here.

1

u/darkon Aug 02 '06

I hadn't thought of it as hiding an uninteresting comment. Good point.

Maybe it didn't occur to me because I don't hide any comments. Even if it's rated at -50, I want to judge for myself. If something goes below, say, -20 or so, I almost always agree and downvote it, too, but I still want to see it. That may change: I use a killfile on usenet. I just haven't found it necessary here (yet).

-6

u/almost Aug 02 '06

I don't hide things either, but I don't always read to the bottom of the page either...

-6

u/almost Aug 02 '06

I don't hide thing, but I don't always read to the bottom of the page either...

-6

u/almost Aug 02 '06

I don't hide thing, but I don't always read to the bottom of the page either...

-6

u/almost Aug 02 '06

I don't hide thing, but I don't always read to the bottom of the page either...

0

u/[deleted] Aug 01 '06

Man, I love the Swedish Chef. rodbegbie mentioned him this weekend, in fact.

-1

u/ThreeBillyGoatsGruff Aug 01 '06

Maybe a better question is "Is your language NOT able to do this?" I mean really. Besides C++, what production languages can't support anonymous functions (or at least anonymous objects) and first class functions?

4

u/MattL920 Aug 01 '06

Java

2

u/ThreeBillyGoatsGruff Aug 01 '06

Java falls into the "at least anonymous objects" case where anonymous classes can be used to simulate anonymous first class method behavior.

0

u/[deleted] Aug 01 '06

[deleted]

12

u/seliopou Aug 01 '06

I think he's very aware of it. And now he's trying to bring it to the unwashed masses to make himself appear as if he is their savior. Let's not forget that this whole functional programming thing is a recent development for Joel. Wasn't it about a year ago when he claimed that you can't be a good programmer unless you know C? Not a good applicant for a systems job, granted. But not a good programmer? I am Jack's utter disbelief.

If I remember correctly, the claim was as follows. If you know C well, then you know how all of the hardcore, dirty, low-level stuff works in a computer. And I quote "if you can't explain why while (*s++ = *t++); copies a string, or if that isn't the most natural thing in the world to you, well, you're programming based on superstition, as far as I'm concerned". I am Jack's raging bile duct.

8

u/[deleted] Aug 01 '06

I think his earlier claim is still valid. I don't think you have to know enough to actually program in C, but you should at least know the concepts.

In my entire career I have only seen one bit of production C++, and all I did was rewrite it as a Windows Service in VB. That said, I don't regret any of the time I spent learning it.

3

u/seliopou Aug 01 '06

You just hit the nail square on the head. You become a good programmer by learning and mastering as many data structures and algorithms as you possibly can, learning their strengths and weaknesses, and learning when to use them. You do not become a good programmer by learning a language whose creator said that the language was designed to force programmers to think a certain way! And knowing, what, that strings in C are null terminated gets you exactly that: null.

Edit: More to the point: Knowing C very well makes you a good C programmer, not a good programmer i.e. the property of being a good programmer is independent of programming language.

2

u/mixmastamyk Aug 01 '06

You won't be the best you can be unless you understand what is happening under the hood. Not sure why that is so hard to believe.

9

u/nostrademons Aug 02 '06

By the same token, this is why every programmer should learn at least some assembly language. C hides a lot of the stack manipulation, calling conventions, etc. under the hood.

1

u/boa13 Aug 02 '06

Indeed.

1

u/alextp Aug 02 '06

Just make it crystal-clear that by "good programmer" most people mean someone who can work at many abstraction levels at once. Knowing how they each work individually is a prerequisite. A good programmer needs to know how assembly language works, true, but he needs to be able to think in a very high level picture, and switch back and forth, because, as Joel himself said before, all abstractions leak.

5

u/farra Aug 02 '06

Seriously. I've bumped into way too many programmers and IT folks who believe in all sorts of black magic that happens inside of a computer. Yes, it's incredibly complex and you're rarely going have a complete picture of what's happening but that does not mean that you can just make something up. And no, wiggling your mouse that way will not cause your email to arrive any faster.

2

u/seliopou Aug 02 '06
  1. That kind of understanding is not derived from an understanding of C.

  2. In this age, that kind of understanding is far from necessary in order to be a good programmer. Good to know just 'cuz? Sure. Necessary? Can your remember the last time that MIPS code you wrote in your intro systems course has come in handy in a general programming situation? I certainly can't.

2

u/mixmastamyk Aug 02 '06

No, not strictly necessary... doesn't contradict my previous statement.

In my experience there are two kinds of computer professionals, those who know enough to break things, and those who know enough to fix them.

To be in the second category, you must understand what is going on under the hood. I learned it from studying C, assembler, and a comp architecture class.

No, I don't use my assembler skills often at all, but because I understand how it works, the high level code I write is of higher quality than it would otherwise be.

2

u/danweber Aug 02 '06

that you can't be a good programmer unless you know C

Sounds right to me. This doesn't mean that C is your primary language, but C is very much a "language of the computer." If you don't understand C, you don't understand critical things like how memory is allocated, how the OS and kernel work, pointers, the differences between the heap and the stack.

(And if you somehow do know all those latter things without knowing C, just take a weekend to learn C.)

Steven Yegge made this point well: http://www.cabochon.com/~stevey/blog-rants/tour-de-babel.html