Hacker Newsnew | past | comments | ask | show | jobs | submit | grahamlee's commentslogin

As the submitter, I want to point out that I submitted this post with the original title. The one that makes it clear a16z are behind the social media astroturfing. The mods changed the title.


That’s fine, you did nothing wrong. I explained the title change here: https://news.ycombinator.com/item?id=46307121.

Edit: The community has spoken and I've come up with a way to include a16z in the title whilst keeping it under 80 chars.


OK thanks for clarifying your reasoning!


These modern times that literally began in 1769. Oxford English Dictionary, “literally (adv.), sense I.1.c,” June 2025, https://doi.org/10.1093/OED/9189024563.


Article author here. Your idea "gluing together things that don't know necessarily know about each other" is basically what the GoF book means: composition is "this object has a reference to that object and uses its public API". They don't mean "this object ontologically contains an instance of that object" in the sense that a car "has" an engine, which is a narrower definition of composition that people frequently use.

It's that broader version of composition—particularly in its extreme realization, delegation—that underlies a lot of the behavioral patterns in the book. For example, the State and Strategy patterns boil down to "this object relies on another object to fill in the behavior here, and there are ways to choose what that other object is", which is something it's easy to arrange with subclassing and the only point of the pattern is to avoid subclassing.


Author here. I wrote “ But even a modestly more recent language like Java has visibility attributes that let a class control what its subtypes can view or change, meaning that any modification in a subclass can be designed before we even know that a subtype is needed.” which covers your situation: if you need to ensure that subtypes use the supertype’s behaviour in limited ways, use the visibility modifiers and `final` modifier to impose those limits.


The fact that Java had to add a whole extra set of keywords to control this indicates that this is a site of complexity. Since it isn't needed for composition, it's a site of unnecessary complexity.


What you lose by using composition is that the composing object is no longer a subtype of the constituent object, so you can't use it as a "decoration" of the original object in a program that expects an instance of the original.


It can be, if the composing object re-implements the constituent object's interface. This way, code reuse and polymorphism are orthogonal features, which I think is better. If you want both, you can do both, but inheritance pushes you toward using both even when you only need one.


David Chisnall is now at MS Research and does cool things with CHERI making a computing platform that's memory-safe by default.


That makes 4 and 9 the only two uninteresting numbers, which is interesting, so they’re out too!

Douglas Adams said the same about 42. It’s the answer because it’s completely banal.


Dijkstra also advocated for proving the correctness of imperative code using the composition of a set of simple rules, and most programmers ignore that aspect of his work too.


Any specific paper or article of his you would recommend?



_A Discipline of Programming_


The presented story has to make sense to the audience, and showing two characters interacting with an isolinear chip, data crystal or whatever hints at "she just gave him a futuristic floppy disc with the plans for Chekhov's Gun" more than claiming to have sent a sharing link via IM.


My handy real-world analogy for XOR is the light over a staircase in a home. There's a switch at the bottom, and another switch at the top, and both control the same light. Initially, they're both in the off position. You set the bottom switch, and the light turns on. You climb the stairs, set the top switch, and the light turns off although both switches are now in the "on" position. As long as one switch is in the "on" position and one switch in the "off" position, the light is on; otherwise, it's off.


Huh, maybe my electrician wired it up wrong in my office then. I’ve got two switches in the room but come to think of it they perform more like an AND gate than an XOR. In the living room there are two switches and those are definitely like an XOR.


The XOR light switch is a trick. And, even if you know it is possible, it is hard to figure it out without someone telling you. My uncle and cousin were doing their own electrical work and couldn’t figure it out.

I had seen the trick as a young kid and remembered it 30 years later: install the one of the switches backwards.

One switch takes in power and puts it on one of two wires running to the second switch. The second switch connects one of the two wires to the power wire going to the bulb.

If you don’t know the trick, you get an AND switch.


Another company has a store called Super Mario, and the courts are reasonable enough to realize that they don't compete: https://ticotimes.net/2025/01/30/david-vs-goliath-costa-rica...


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: