Hacker News new | ask | show | jobs
by _kotv 4879 days ago
I like first class functions. I get hung up on the trash example in this essay though. To show the commonality of verbs in a person's general understanding Yegge says 'get the garbage bag from under the sink'. WTF (Who the fuck) 'gets' the garbage? I do. 'I' is implied. I get the garbage from under the sink. Or perhaps 'Steve' gets the garbage from under the sink. These are nouns (or pronouns, whatever).

If anything, verbs do nothing without a noun to do them, and nouns need verbs to do anything. So perhaps we should just acknowledge the value of traits, objects, and functions and move on. Forgive me (but correct me first) if I have missed something massive here... I'm trying to drink as much as Steve is alleged to while writing this comment.

4 comments

It is true that there is some being, or noun, that is implicitly taking out the garbage in his example. I think the important thing to note is that we can happily describe the process of taking out the garbage without mentioning who does it.

If we step back and look at it in terms of programming the principle here is that an Object Oriented insistence on defining and instantiating a doer for every action is unnecessary clutter.

When a programming paradigm makes people insist that 'everything is an object' or more alternatively 'static methods are terrible' we have strayed from simply finding ways to directly describe what we want a computer to do. We are instead forced into being object oriented.

The example nursery rhymes are a fantastic example of what this culture leads to. That is my daily life and it can be a horror.

I don't think that Steve Yegge would claim that objects are bad, but it is a very effective parody of modern Java programming (perhaps C++ and others but I don't do any of that).

I feel his essay is an excellent rebuttal to the complaint that a piece of code is 'not very object oriented' in some corners of the programming world objects have become and end in themselves. Steve is humorously pointing out that there are alternatives.

This was a very nice clarification; thank you. I think your point to look at this 'in terms of the programming principle' identifies the truth that Yegge is getting at, the functions should be first class, without the clutter of the English metaphor.
Right, OO vs functional is not either/or. It's an ever-present duality (data and algorithms) in any language. The problem is that discussions about achieving the optimum balance for a job are too subtle and non-sensational. Bloggers and commenters prefer polemics, so instead you mostly see die-hards who enjoy combative flamewars for an acclaimed tribal superiority.

Thankfully, a while back I saw an enlightening wiki page on c2.com.[1] Recognizing the yin-yang relationship where one cannot exist without the other gives a much better understanding of both.

The venerable master Qc Na was walking with his student, Anton. Hoping to prompt the master into a discussion, Anton said "Master, I have heard that objects are a very good thing - is this true?" Qc Na looked pityingly at his student and replied, "Foolish pupil - objects are merely a poor man's closures."

Chastised, Anton took his leave from his master and returned to his cell, intent on studying closures. He carefully read the entire "Lambda: The Ultimate..." series of papers and its cousins, and implemented a small Scheme interpreter with a closure-based object system. He learned much, and looked forward to informing his master of his progress.

On his next walk with Qc Na, Anton attempted to impress his master by saying "Master, I have diligently studied the matter, and now understand that objects are truly a poor man's closures." Qc Na responded by hitting Anton with his stick, saying "When will you learn? Closures are a poor man's object." At that moment, Anton became enlightened.

1. http://c2.com/cgi/wiki?ClosuresAndObjectsAreEquivalent

> If anything, verbs do nothing without a noun to do them, and nouns need verbs to do anything.

This is only true in natural language. Formal math languages are generally verb-oriented, hence functional languages are verb biased.

> So perhaps we should just acknowledge the value of traits, objects, and functions and move on.

The only thing we (OOP vs. FP fanboys) generally argue about is whether the noun should come first or the verb, which has significant implications in how dispatch is done. It really does determine whether your designs are more naturalistic (noun first) or mathematical (verb first).

> If anything, verbs do nothing without a noun to do them, and nouns need verbs to do anything.

O Canada! It's raining.