Steve Yegge is an idiot

And to think, I used to have respect for the man. Then he goes and posts this pile of fetid dingo kidneys.

I’m going to explain in detail why ditching private (and, by extension, public) is bad. Obviously this needs to be spelled out, because a lot of programmers- including Steve Yegge – don’t get it.

Consider a software project that is large enough that a) more than one person is working on it, b) code maintenance is ongoing, and c) large enough that no one has the whole program in their head all at once. Person A writes hunk of code (function/module/class/whatever) X. Then person B comes along and writes hunk of code Y that calls hunk of code X. Then person A comes back around and changes hunk of code X, breaking hunk of code Y in the process. Who’s fault is it? Person B can claim that since their code worked with the older version of X, it’s person A’s fault. But person A can claim that module Y should never have depended upon that particular behavior in the first place.

Every time you have one piece of code calling another, there is a contract between the two pieces of code. The contract may not be automatically enforced, may not be spelled out, may not even be articulated, may just arise out of convention, but it’s there all right. The contract is what determines, in the above example, who fixes their code- person A, or person B. Unless that is resolved by invective duels at thirty feet.

Renegotiating the contract is possible, but is often expensive if the called code wants to change it’s behavior or API. This is because all the code that might call the changing code has to be found, inspected, and probably fixed to support the new behavior or API.

This is where the whole private thing comes in. It’s explicitly spelling out what is, or is not, in the contract. A function marked private in Java means that there is no guarantee that the function will have the current behaviors, or current arguments, or even still exist, in future changes to the code. If you call the function from your code, your code will break. It’s a question of when, not if. And when it does break, you will get no sympathy from me.

Note that it is possible to have contracts without (computational) enforcement. It is possible to write working, maintainable code in languages without a compiler-enforced private. But this just means that the contract is expressed in other ways.

In fact, most contracts are not expressible as automatically enforced in most languages, even languages with advanced and powerful contract checkers (aka type systems) like Ocaml and Haskell. There is a subtle difference between accidents of implementations and guaranteed behaviors. Consider, for example, a function that goes out to a database and fetches a list of strings. Now, due to the nature of the data in the database, and how the database decides to execute the query, current the strings are being returned in sorted order- but is this an actual behavior guaranteed to continue to be true, or is it just an accident of this implementation, and in a different circumstance (different data, different query plan), the list of strings might be returned in a different order? I could easily see the answer being yes (how hard is it to drop an order by onto the query?) and equally see the answer being no (the extra sort phase has a significant cost and serves no purpose for most uses of the data, and how hard is it to throw a sort call around the result of the function in those cases that need it to be sorted?).

As a side note, this is the reason I disbelieve that you don’t need comments. Even unit testing doesn’t help here. All unit tests tell you is that suddenly the list of strings is coming back unsorted, and thus someone’s code is broken. It doesn’t tell you whose. The only real solution here is for the developers involved to get together and work out which it will be, and then write the decision down. If you don’t write it down, it didn’t happen (“That’s not what I remember…”). Oh, and if you’re unwilling to up arrow a couple of lines and fix the comment while you’re changing the code, what other dependencies are you not maintaining? Maybe telling other programmers that you broke their code? Or checking and fixing their code for them? But that would require editing a completely different file, and we’ve already established that you’re unwilling to fix something half a dozen lines up in the file you’re already editing.

So not all contracts can be expressed and checked automatically. But why on earth would you not use the features of the language you do have to check the contracts you can check? The answer, I think, is quite clear- Steve Yegge doesn’t believe in contracts. Or at least doesn’t want them to apply to him.

There is an attraction to coding without contracts, to just hauling off and writing or changing code, without caring about the consequences. Short term, it greatly increases (perceived) productivity. Long term, however, that productivity drops off enormously. So, I’m writing code with Steve Yegge. And, to eliminate some code duplication and make some other code easier to read, I create a function. This function really isn’t for public consumption, just something internal. But now that I’ve created it, it’s part of the API. If I change how it behaves or even want to remove it later, I have to carefully check all of Yegge’s code. Because, dammit, if I didn’t want him calling the function I shouldn’t have written it.

We have names for people who don’t care about consequences, or don’t think long (or even medium) term. We call them “immature”, even “childish”. We also have names for code bases that are hard to change because of uncontrolled dependencies between modules- we call them “brittle”, or even “unmaintainable”. The end result of an utter lack of contracts is the big ball of mud.

There are projects where this isn’t a problem. Small, short projects with limited life spans, and few developers (or just one). But then there projects, lots of projects, which aren’t this way.

I’d also like to take this moment to mention that there is nothing in this whole discussion special about open source. You are free to fork any open source project you want, and remove all the private specifications you want. But the original project maintainers don’t have to accept your changes back into their version. And they probably wont, and maybe there’s a damned good reason for this. If anything, this problem is more pronounced in the commercial, non-open world. An open source project is always free to decline an offering of code, and often does. A commercial project finds it much harder to reject code contributions from

There is an old programmers joke, which goes like this: programming is like sex. One mistake, and you’re supporting it for life. Steve Yegge doesn’t believe in (software) condoms- he doesn’t use them, and thinks you shouldn’t either. At which point, the only conclusion I can draw is don’t use Yegge’s code, and don’t let him use your code.

No related posts.

This entry was posted in Open Source, Programming Language Punditry. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
  • David Clark

    So if you are writing Java code, are you also going to unilaterally disallow reflection (since it can access private stuff)? If not you are still going to have to go through the code to look for reflection based access of your code. You are also going to have to disallow groovy from ever touching your Java code because that can also access private stuff. There’s probably at least 6 other ways of doing this.

    Private is nothing more than an comment which says, “Don’t use me unless you are going to take full responsibility for what happens now and in the future.” And that’s Steve’s point, we’re adults and we can figure that out for ourselves based on our own particular use cases and ability levels.

    • http://www.robertcfischer.com Robert Fischer

      Are you saying that “private” is bad, and everything should just be “public”? If so, how would you figure out what’s subject to change and what isn’t without some kind of marker?

      • Judd

        No, he’s saying that “private” IS the marker. You just have to see it as such and not mis-construe it as some barrier that will reliably prevent third-party code from calling it.

        • http://www.robertcfischer.com Robert Fischer

          Oh, sure. If the security of your system depends on not calling private methods, you’re toast.

      • http://www.jerf.org/ Jeremy Bowers

        Here’s the thing: Of the dozens of languages in current common use, quite a few of them do not spell out private and public and so on. All of them have been used to write large projects and indeed entire sub-ecosystems, which have most assuredly had to solve many software engineering problems just to exist.

        If you don’t know the answer to that question, you’re not in a position to be lecturing anyone on the pros and cons of this technique vs. the techniques you apparently don’t even know about, so how can you possibly explain the pros and cons?

        • http://www.robertcfischer.com Robert Fischer

          Not sure if you’re responding to my comment or Brian’s original post, but here are my thoughts.

          A lot of languages use other kinds of markers (e.g. _foo). They have long-established conventions. And if you want to have a language with such a convention, that’s fine: in that case, you’re in buyer-beware territory if you reach into the code marked by those conventions. And that’s okay, I suppose.

          Simply ripping private out of Java code is a problem, though, because you’re dealing with a language without a convention for communicating that information. And ragging on @Deprecated seems somewhat bizarre.

          As a further comment, in languages like you have described, I have encountered substantial and annoying difficulties in upgrading libraries with surprising changes to the API—or even not even being clear what is or isn’t part of the API. perl (and by that, I mean CPAN) deals with this by having a culture of obsessive documentation. Ruby’s been a source of some frustration for me on this point. This is also true of some Grails plugins, and I’ve had people raise that issue about my own plugins.

      • Patrick

        While I will decline to comment on Yegge, I believe you are muddying the issue by mapping public vs. private onto contracted vs. uncontracted.

        You’re mapping a desired result onto an existing keyword with little regard to the intent of the keyword. There are more reasons to make a method public than to make it contractual. For instance, you may simply have another object in your code that needs to call it. I suppose one could argue that this is an inter-object contract, but you seem to be talking more about API level contracts which is usually where things break down when code breaks between programmers.

        Perhaps we need an annotation that means contracted? But then what does that really mean? It comes down to documentation.

        I know of at least one project that did this. They had a published “public” API that they contracted would not change and then another “private” API which was use-at-your-own-risk. They did this independent of object level visibility. In fact, their documentation generating tool hooked into their annotations and only published the public API to users.

    • Michael

      “So if you are writing Java code, are you also going to unilaterally disallow reflection.”

      y-e-s.

      And there is also the middle ground where you don’t allow _unsafe_ reflection.

  • http://www.robertcfischer.com Robert Fischer

    Note that removing the @Deprecated tags, which Yegge makes fun of, is super crappy. If you want to use a deprecated API, then you should be happy for @Deprecated—those @Deprecated tags exist so that the library STILL WORKS FOR YOUR CODE. If it weren’t for deprecated tags, the API would be broke sooner and you wouldn’t have been able to upgrade to the newer version of the library without going through all your code and fixing the ways the calls work. How about a little gratitude for the work saved by API stability?

    As for “private” methods: if you want to call that open source “private” method so badly, go copy-paste it into your own code somewhere. It’s open source, so nothing is stopping you. Yes, copy-paste has a bad rep, but guess what: when the library goes and changes its implementation or API, you’ll still have a version of the call that works. And they will be changing their implementation or API, because that is why it is private in the first place.

  • http://lovehateubuntu.blogspot.com/ Rob

    I’m making a guess here, but I think that Yegge’s post was meant to be a joke.

    • Marcel Kincaid

      I’m making a guess here, but I think you’re an idiot. Of course Yegge’s post was humorous, but that doesn’t mean that it doesn’t reflect his views. It’s striking that there are people posting in Yegge’s comments section, and you posting here, complaining that this response took him seriously, when nearly every comment on Yegge’s post takes him seriously, stating how much they agree with him, or how they agree with him with reservations. The fact is that Yegge’s posts are not merely humorous, nor are they, as they are often mischaracterized, satirical: rather, his form of humor is mockery. His article makes fun of Java and its private and deprecated annotations. On the surface, his article is idiotic, as it fails to appreciate the value of static typing and other compile-time guards. He may know better, but those who say they agree with him do not.

  • http://billmill.org Bill Mill

    > And to think, I used to have respect for the man. Then he goes and posts this pile of fetid dingo kidneys.

    1. When you’ve respected a writer for a while, then you read something he writes that seems totally wrong, perhaps you should wonder if you missed the point.

    > Consider a software project that is large enough that {blah blah blah reason for why “private” exists}

    2. Do you truly think that Yegge couldn’t write out the case for private in this manner if he wanted to? Do you think you’re introducing new information into this debate?

    > In fact, most contracts are not expressible as automatically enforced in most languages, even languages with advanced and powerful contract checkers (aka type systems) like Ocaml and Haskell.

    3. Have you considered that perhaps Yegge knows this, and thinks it’s a better idea not to have “this method is private” contracts enforced by the compiler? Your tone of arrogance is out of the ordinary.

    (My response’s tone of arrogance is a response, for which I apologize but will not change)

    > Steve Yegge doesn’t believe in (software) condoms- he doesn’t use them, and thinks you shouldn’t either.

    You have mistaken the part for the whole; Yegge’s disbelief in one particular type of “software condom”, as you so delicately put it, does not mean that he believes there should be no contract enforcement by programming languages.

    • http://www.robertcfischer.com Robert Fischer

      There’s a joke in here somewhere about software condoms and taking all the fun out of it…

    • Marcel Kincaid

      “Have you considered that perhaps Yegge knows this, and thinks it’s a better idea not to have “this method is private” contracts enforced by the compiler? ”

      It’s apparent that he does think that, which is what makes him an idiot.

  • http://martin.jambon.free.fr/ Martin Jambon

    I don’t care much about what the author thinks or whether I approve his life choices, but I like the idea of keeping things simple by default.

    The author was specifically targeting Java, which consists in forcing the programmer to declare properties that are superfluous 95% of the time and just clutter up the source code.

    • http://www.robertcfischer.com Robert Fischer

      Yeah, there’s a lot Java needs to do to make code cleaner. Why it doesn’t have a C#-style (or even a Groovy style) properties syntax is beyond me.

    • Marcel Kincaid

      “The author was specifically targeting Java, which consists in forcing the programmer to declare properties that are superfluous 95% of the time and just clutter up the source code.”

      Java forces you to declare private and deprecated attributes? Really? And you think that’s what Yegge was complaining about?

  • Richard Vowles

    @BillMill – Steve compares software to a house – he deserves all the slapping he gets everywhere around the web and more. I suppose when Steve says design by contract is a bad idea you are going to say “hooray” to that as well.

    Try not to drink the koolaid – I generally find Robert gets a bit too antsy in his postings but he is right on the money here. Yegge deserves a good kicking.

    • http://www.robertcfischer.com Robert Fischer

      For the record, this is Brian’s post, not mine. Although we both are basically coming from the same place in this point.

  • http://github.com/raganwald/ Reg Braithwaite

    Speaking as someone who respects your POV as well as Steve’s, I feel that the tone of this particular point doesn’t mesh well with the tone of Steve’s post. Steve’s post is humour. It takes an extremist stance, but most humour has to do that to make you laugh, and then think.

    Does Steve not wear condoms? I dunno, it could be that he doesn’t sleep around. It could be that he uses other techniques to create encapsulation. It could be that he uses private members and simply wants the reader to appreciate the fact that private is not “free” and the benefits should be weighed against the costs for the generations of maintainers to follow.

    :-)

    • Marcel Kincaid

      Yegge’s post is mockery that ridicules something quite reasonable by selectively attacking its misuse — and numerous people in his comments section have said, with little or no qualification, that they agree with him. It’s idiotic through and through and deserves to be called out as such.

  • http://www.robertcfischer.com Robert Fischer

    To everyone who is saying, “Hey, it’s just a joke!” — yes, it is. But it’s a joke which argues for a particular position and satirizes its detractors. Jokes can be arguments, too. I mean, this certainly was a joke and pretty much in the same way, but people (rightly) saw the argument within it.

    • Alex Gordon

      But it’s a joke which argues for a particular position and satirizes its detractors.

      That is pretty much the definition of satire.

      I’m pretty sure Steve Yegge knows why access modifiers exist in Java. All this article proves is that he’s really good at satire.

      • http://www.robertcfischer.com Robert Fischer

        Sure. So it’s not unreasonable to respond to the target of satire, in that it is arguing for a particular position. Brian’s original post may be a bit more harsh than I’d probably go for it—and certainly Brian’s got a stronger take on the compiler’s role in enforcing code contracts—but responding to the implicit argument of the satire seems very reasonable. Even if it is a joke.

        • rusty shackleford

          The problem is that you missed the point inside the satire, making you and the OP very, very funny. But in a sad way.

          • http://www.robertcfischer.com Robert Fischer

            And the point I missed was…?

      • Marcel Kincaid

        Yegge’s article was mockery not satire. Apparently, Alex, you’re too dense to grasp that Yegge’s post reflects his views, rather than being an inversion of them.

  • Aaron Davis

    Did you actually read the article? It reads like an Onion article. The content is completely absurd.

    Everything you say about `private` and `@Deprecated` is correct, but this article is the definition of attacking a Strawman. But then, maybe you know this, and this post is meant as a joke as well.

    • Marcel Kincaid

      Yes, it’s absurd, but it’s what Yegge really believes, and many of his commenters stated that they agree with him — thus, Brian Hurt’s article did not attack a strawman.

  • http://www.jroller.com/mindcrime/ Philip Rhodes

    I took Yegge’s post more as satire directed at Wikileaks, than as satire directed at “private” and “@Deprecated.”

    • Marcel Kincaid

      That’s even dimmer than most of the other comments about it.

  • dan

    Whooooosh!

    Wow.. did you hear that? The sound of Yegge’s article going waaaay over your head!

    I’ll spell it out for you: J. O. K. E.

    Yegge was poking fun at open source, at java and at people like iphone (selling you a house with doors marked “employees only”).

    • Marcel Kincaid

      Only the most stupid people think that “it was a joke” is an answer to the criticism of the piece.

  • Joe

    Wow… I guess you Steve shouldn’t joke… some of his readers lack a sense of humour.

    • Marcel Kincaid

      “Wow… I guess you Steve shouldn’t joke… some of his readers lack a sense of humour.”

      LOL! You seem to be a stupid git, yuk yuk yuk! This is just a joke (mocking you, you silly moron!!), so if you have a sense humor you should just laugh it off! Ha ha ha!

      • Eco

        No, really, dude, you are one total idiot. That post is pure humor.

  • Jeremy

    :) Thank you for writing.

    I don’t like your first example.

    Consider a software project that is large enough that a) more than one person is working on it, b) code maintenance is ongoing, and c) large enough that no one has the whole program in their head all at once.

    Ok I am envisioning this project.
    I am also envisioning it has
    - Project Design Docs
    - Logical Layout
    - Diagrams and Models
    - At least Class level Documentation
    - Revision Control
    - Testing
    - Automated Builds

    Person A writes hunk of code (function/module/class/whatever) X. Then person B comes along and writes hunk of code Y that calls hunk of code X. Then person A comes back around and changes hunk of code X, breaking hunk of code Y in the process.

    Oops!

    Who’s fault is it?

    It depends, but it’s not about blame.
    Person A’s Fault
    - If He changed his public interface. Ya know, the one that was documented and spec’d out.
    - If he ran the test suite, saw failures, and still checked in his code.

    Person B’s Fault
    - If he used undocumented features ( this includes playing with the private vars ).
    - If he made ASSumptions that were not in Person A’s documentation… like the order of the returned data.
    - If he wrote bad tests, or heaven forbid didn’t write any tests.

    Person B can claim that since their code worked with the older version of X, it’s person A’s fault. But person A can claim that module Y should never have depended upon that particular behavior in the first place.

    I never want to work with a team where the blame game is acceptable.

    • Scott

      Arguing that using “private”- a built in language feature- is heavy-handed and instead code should simply be documented and tested to the ninth degree paradoxically implies that coders too whiny to use “private” will document and test code to the ninth degree.

      • http://www.robertcfischer.com Robert Fischer

        Like.

    • Marcel Kincaid

      “I never want to work with a team where the blame game is acceptable.”

      Which is why competent teams have the compiler prevent misuse with static typing, protection annotations, and so on, silly.

  • steven

    i thought the removal of private markers was a joke? your telling me he was serious?!

  • James

    Yes, Steve’s article was written in a jocular fashion.

    But you people berating Robert for not getting the “joke” post are missing the implication of what Steve wrote: That hiding too much implementation in private state or behavior is something he considers harmful.

    And Robert is disagreeing with that.

    Reading comprehension. Hard, I know.

    • http://www.robertcfischer.com Robert Fischer

      Uh, again, it’s not my post. It’s Brian’s.

      I need to start putting the author’s name in H1 tags or something…

  • Donal

    The title of your article does you no favours. Does the guy really deserve to be called an idiot just because he wrote one (obviously tongue-in-cheek) article that you disagree with.

    Considering his entire body of work, do you really think Yegge is an idiot. I don’t, and I don’t think you do either. If you want to troll, try 4chan.

  • http://christianromney.com Christian Romney

    > Who’s fault is it?

    The one who didn’t write good tests.

    > The contract is what determines, in the above example, who fixes their code- person A, or person B.

    I don’t like developing software in your world. On my planet, we believe in collective code ownership. Oh, yeah, and we *talk*.

    > As a side note, this is the reason I disbelieve that you don’t need comments.

    The distinction between
    function fetch_sorted_names() vs.
    function fetch_names() seems pretty clear to me, without comments.

    > Even unit testing doesn’t help here.

    Actually, it does. If the strings are supposed to be sorted I sure hope you have a test that expresses that. Otherwise, you’re right – you’re relying on happy chance.

    > If I change how it behaves or even want to remove it later, I have to carefully check all of Yegge’s code.

    No, the broken tests do that for you.

    > Because, dammit, if I didn’t want him calling the function I shouldn’t have written it.

    Exactly. So, you’re advocating that two functions in the same class shouldn’t reuse internal methods of that class when they both need its exact output? It this anti-refactoring?

    • http://www.robertcfischer.com Robert Fischer

      To everyone who thinks you don’t need comments: how am I to know what this method does and what it returns?

  • http://www.profeval.com Derrick

    With that said… I can’t stand it when people use private when they really should not, just because they were taught they always should! When you’re writing high performance apps, such as games, which need to access x and y coordinates a LOT, you are DEFINITELY better off leaving them public.

    If you have

      private Integer x;
      private Integer y;

    with public getters/setter which do nothing but set the value:

    public Integer getX(){ return x; }
     
    public void setX(Integer x){
       this.x = x;
    }

    You’re doing absolutely nothing but adding a LOT of overhead. In a minute of gameplay, at 60 FPS, you’ve just added 7200 function calls worth of overhead.

    I see people do this same stupid thing in AS3/Flash based games.

    There’s a BIG difference between an API, and a contract, and a simple sprite with an x,y. Generalizing, and saying that everything should be “private” is also just as silly.

    • http://www.robertcfischer.com Robert Fischer

      Have you actually tried those out on the JVM? I bet if you’re doing 7200 calls, the HotSpot compiler has optimized them to within an inch of their life, and so the actual cost is probably minimal.

      That said, Java desperately needs a saner way to deal with properties. It’s just so much ceremony for so little reward. Tuples would also be sweet.

      • http://www.profeval.com Derrick

        Actually, Yes.

        Mapping 65,000 objects from a JDBC call takes 447 milliseconds using getters/setters, and 440 milliseconds without them. Granted, it’s not a lot in the scheme of things, but the overall operation (including the jdbc call) took 978 ms.

        That was just a sample that I had access to tinker with.

        • http://www.robertcfischer.com Robert Fischer

          Yeah, I’d call 7ms, or 0.7% the cost of the call, pretty minimal. I suppose it is a speed-up of 1.6%, which sounds like something.

          What we’re really looking for is tuples. Although I suppose a final class with public fields is basically a Java coder’s tuple. Except, y’know, that’s evil and against corporate coding policy and stuff.

        • http://lovehateubuntu.blogspot.com/ Rob

          How many times did you run it? That 7ms might not actually be statistically significant.

      • rusty shackleford

        Wow, you rely on the compiler to fix your bad programming?

        Now you are getting closer to Yegge’s point but you were the target and are upset about having a mirror shoved in your face.

        A compiler is great for optimizing well-written code, and if you depend on the compiler to save you, you do not belong in this field.

        • http://www.robertcfischer.com Robert Fischer

          No, but I like it when the compiler tells me that I did something stupid, instead of having that stupidity make it out into production. Unit tests can serve a similar purpose, but they’ve got the added burden of 1) taking me time to write; and 2) requiring me to recognize the potential stupidity in order to catch it. Ubiquitous and automatic stupidity-catching is much more useful. (And for the record, I’m very aware that there are other purposes to unit tests, too.)

          Consider this from On the Meaning of “Coding Horror”:

          YOU are the Coding Horror.

          The minute you realize that, you’ve crossed the threshold from being an amateur software developer into the realm of the professionals. Half of being a good, competent software developer is realizing that you’re going to make tons of mistakes. You will be your own worst enemy almost all the time. It’s a lifestyle. You’re living it right now. You, me, all of us. The problems start with us. We’re all coding horrors.

        • Marcel Kincaid

          I’ve been in this field since before you were born and I wouldn’t hire a fool like you, Russ.

    • http://blaisorbladeprog.blogspot.com/ Blaisorblade

      The problem with having a public attribute is that you lose the freedom to change it later. As already explained, those calls are inlined during JIT-compilation. I agree that C# properties are much better though – Java is a son of C++, which is scarily complicated, so simplifying the language has been an (excessive) concern. If you don’t agree about C++, try solving http://www.gotw.ca/gotw/056.htm, especially question no. 3.

      • http://www.robertcfischer.com Robert Fischer

        Setting aside run-time code generation (which conflates compile-time and run-time), the side effects of JIT compilation don’t impact compile-time decisions about how things are organized. It does make life difficult for Java people compiling against my code if I decide it really should be a getter-/setter-driven property later: they then have to change all their foo.x to foo.getX() to get their code to compile.

        So the issue is one of backwards compatibility. However, if the class is a simple enough data container (think “tuple”), is backwards compatibility really that much of a concern?

        To put it slightly more bluntly, what percentage of getX() and setX(x) are ever converted from simple attribute wrappers to a more complicated implementation? If that percentage is small (and it is, in my experience), then there’s just a lot of noise in the code for little benefit, and the syntax should favor the common case.

  • Mike Jennings

    “If I buy you a house and put the title in your name, but I mark some of the doors ‘Employees Only’, then you’re not allowed to open those doors, even though it’s your house. Because it’s really my house, even though I gave it to you to live in.”

    Actually, no. It’s more like, if I build a house and then give it to you, and if I built the house well, you won’t have 220V wires sticking out of the walls. Nor will the ABS pipes that transfer the shit from the toilet be visible from your breakfast table (nor will they be transparent). I am well aware that there is a black, 3″ ABS pipe shuttling turds 3 feet from my breakfast table, I put it there. But I like the ABSTRACTION of “I shit upstairs and the shit goes somewhere”. Yes, I could have a clear pipe visible from my breakfast table – it would show me if there are any blockages, it might even give me a hint if someone in the house has serious medical difficulties or if someone has flushed a kitten down the bog. Further, it would allow me to easily hook up a “Y” from that pipe if need be, cuz everything’s accessible, but someone with a slightly more refined aesthetic sense, like my wife, might object.

    Abstraction is a game of make-believe; I might have some code that takes an InputStream but all I ever pass to it is a FileInputStream, so why fuck around with InputStream? You know that it’s a FileInputStream, so why not call a spade a spade? The reason is this, most programmers don’t have very much discipline. If you change your code to accept a FileInputStream, there will be an almost irresistible temptation to use stuff that only a FileInputStream has. Now you can never use that code on an URLInputStream or a ServletInputStream or any other InputStream; you’ve broken the abstraction, when you didn’t need to.

    Although Steve is probably joking about not understanding the need for access modifiers, that’s my own opinion on the matter.

    • http://christianromney.com Christian Romney

      I have to confess I don’t get you shit/pipe analogy at all, but I think I agree with your point about layered abstractions. In fact, I’d go so far as to say the abstractions don’t always end at the public/private boundary. That’s precisely why I disagree with the author when he says private methods should never be invoked. I think what he might have meant to say was client code should respect the private boundary, but he went a bit astray implying that private means private to the programmer, not private to the class.

      Of course, all of this is very abstract. There’s a lot of public code I’d hate to call (let alone private), after having seen it. But if we assume a well-written, non-trivial piece of library code, I can see (have seen) someone wanting to use a lower-level function from a higher level function for something the author didn’t give me the ability to do. And here, private sucks.

      A good analogy (albeit a program, not a library) is Git’s porcelain vs. plumbing. Porcelain is at a higher level of abstraction, but I can use the plumbing to create more porcelain. The great thing about this analogy: it’s all “public” because they’re all available for the end user.

  • Chau

    Wow. Just, wow.

    First, I didn’t see anywhere in there where Yegge said he was against all such forms of communication. In fact, he pointed out how Python has a convention for indicating this *without adding any syntax for it*. It works *really* well.

    Second, if programming is like sex, then trying to get the compiler to enforce everything is like preaching abstinence: it sounds like it should yield perfect results, but in practice it ends up being far worse than giving people good tools and teaching them to be responsible for what they do.

    The static-typing people love to think the compiler can catch anything. (Including bugs, often! Ha!) In a dynamically typed language, when’s the last time I had an interface change such that it compiled but didn’t work? I write code in dynamic languages every day and I can’t remember the last time this happened to me. When’s the last time I wanted to get around a “private” declaration? I also write in statically-typed languages, and the answer is: a couple times this morning, already.

    I’ve even had (a week or two ago) a library change implementation without changing interface, thus causing statically compiled code to stop working.

    Of all the things that can go wrong when 2 pieces of code meet, things the compiler can catch (having the method names and types line up, and only using methods marked “public”) are responsible for *way less* than 1% of problems. When you grab the new version of that library, you still have to test, and you still have to read the docs — and if you’re doing that, then what good does it do that the compiler tells you something is marked “private”?

    “But why on earth would you not use the features of the language you do have to check the contracts you can check?”

    Because they cost more than 1% of my coding time, and the payback is way less than 1%. It’s the same reason you don’t spend all day writing your own *extra* lint-like tools to find potential errors (and I have written such tools, and found bugs with them): again, they take more time to write than just testing the damn program normally, or getting your coworker to give it a 2-minute code review. Inefficiency.

    It says far more about you than it does about Yegge that the only response to this you can think of involves calling him “childish” and “immature”.

    • http://www.robertcfischer.com Robert Fischer

      Okay, most of your points are good, but the dig on static typing was lame. The elimination of null pointer exceptions alone means that static typing can catch at least some bugs. Details over at 7 Actually Useful Things You Didn’t Know Static Typing Could Do: An Introduction for the Dynamic Language Enthusiast.

      • http://www.robertcfischer.com Robert Fischer

        Notably, I encountered this bug earlier today which is precisely a typing error. Even Java’s lame type system would have caught it.

      • Rusty

        If you think NullPointerException has been eliminated, I have some swamp land and a bridge you will be very interested in.

        Java programmers have a deservedly bad rep for being API monkeys because they NEED the compiler to rewrite their inefficient code and they need it to tell them when they made an error.

        Problem is, properly written code is easier for a runtime environment to optimize.

        Programmers that depend on the compiler to catch bugs need to be banned from the field for all eternity.

        Java encourages code bloat and allows under-qualified people to write code.

        The kingdom of nouns is an ugly ghetto.

        • http://www.robertcfischer.com Robert Fischer

          Wow. You totally epitomize the mistaken viewpoint that I’m trying to correct in that blog post.

          • rusty shackleford

            You are trying to correct the viewpoint that it is alright to have compilers make up for crappy programmers?

            That is quite the Java attitude you got there.

            • http://www.robertcfischer.com Robert Fischer

              Compilers don’t “make up for crappy programmers”. They can, however, perform useful checks for common errors that all programmers make, crappy and otherwise.

              To out-of-hand reject a tool that can catch the errors you will make is just stupid: it’s sheer and utter denial about your fallibility as a programmer.

              To argue that compilers do more harm than good, that they require verbose coding, etc., etc., are all reasonable positions. To argue that you don’t need a compiler because you write perfect code? That’s just nonsense.

  • Michael

    That post was satire.

    • Marcel Kincaid

      “That post was satire.”

      No, it was mockery, which is quite the opposite.

  • rusty shackleford

    Robert,

    You misunderstand simple points and reach for strawmen.

    Typical for amateur Java “programmers” that HAVE to rely on the compiler to save them.

    The Java compiler can not save you from NullPointerException or ClassCastException. It doesn’t relieve you from lessening the number of unit tests you need to write.

    It is a security blanket for crappy programmers who exclaim: “Why did my program crash? It compiled without complaint!”

    • http://www.robertcfischer.com Robert Fischer

      Better type systems can save you from NullPointerException and ClassCastException. One of the things that annoys me about Java is how it’s got a ton of ceremony without actually helping you out too much. That said, your point stands in that there are problems the compiler can’t solve, and I agree that there is a lot of space in computer programming where good programmers have to step in. All the same, I’ll take the help protecting against simple issues if I can find it, since I am my own coding horror.

  • Sebastian

    Marcel,

    Not sure if you read Umberto Eco’s Foucault’s Pendulum ? Eco has received hundreds of letters giving him tips and offering further support to the theories in the book. However, the book is a satire and depending on the viewpoint a mockery of these theories, but a really good one that can easily pass for the real thing – what you would call good written satire. Is Eco an idiot? I hope your answer is not yes ..

  • Pingback: Google Engineer disses Google+ | ZDNet

  • Pingback: Google Engineer disses Google+ | kevs-productreviews.com

  • Categories