frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

When did people favor composition over inheritance?

https://www.sicpers.info/2025/11/when-did-people-favor-composition-over-inheritance/
35•ingve•1w ago

Comments

gishh•1h ago
> This contrasts inheritance as a “white box” form of reuse, because the inheriting class has full visibility over the implementation details of the inherited class; with composition as a “black box” form of reuse, because the composing object only has access to the interface of the constituent object.

So, we just need devs to stop trying to be overly clever? I can get behind that, “clever” devs are just awful to work with.

Jtsummers•1h ago
Looks like this one was reupped from a week or so ago, there was another submission with three comments too:

https://news.ycombinator.com/item?id=45845505

skywhopper•1h ago
I’ll be honest. I don’t really understand the point of this article. Maybe that’s just a preference thing. The philosophy behind these abstractions is the least interesting part of the question for me. What problems do these various methods of polymorphism solve and create? What solutions do they enable or prevent? That’s the only part that matters. But citing some discussion about the philosophy behind the theory from 40 years ago is not particularly enlightening. Not because it’s not relevant. But because we have 40 years more experience now and dozens of new languages that have different takes on this topic. What has been learned and what has been discovered?
taeric•59m ago
It really helps me to think of it all as extensive metaphors. Math included. The point is to tell an active story using symbols as metaphorical representations of something. With a lot of assumed language implied (through teachings) by choices of naming things. (As a fun example, don't focus on the name Algebraic if you aren't going to lean in on grade school algebra for things.)

That said, I think this is also a good way to approach framing things. Agreed that the idea of "prefer composition" is often a thought termination trick. Instead, try them both! The entire point of preferring one technique over the other is that it is felt to give more workable solutions. If you don't even know what the worked solution would look like with the other technique, you should consider trying it. Not with a precommitment that you will make it work; but to see what it illuminates on the ideas.

moomin•54m ago
Arguably the answer is “When Barbara Liskov invented CLU”. It literally didn’t support inheritance, just implementation of interface and here we have her explaining 15 odd years later why she was right the first time.

I used to do a talk about Liskov that included the joke “CLU didn’t support object inheritance. The reason for this is that Barbara Liskov was smarter than Bjarne Stroustrup.”

zelphirkalt•50m ago
I mean, it's not that hard to understand, why composition is to be preferred, when you could easily just use composition instead of inheritance. It's just that people, who don't want to think have been cargo-culting inheritance ever since they first heard about it, as they don't think much further than the first reuse of a method through inheritance.
Scubabear68•47m ago
There is a reason C++ devs and only C++ devs have nightmares of diamond inheritance.

Oh the damage that language has done to a generation, but at least it is largely passed us now.

wk_end•4m ago
I mean, duh. The spicier take is that Barbara Liskov is smarter than Alan Kay.
ggm•39m ago
There are days I hate the mapping of plain English terms of art over actual in-language effects.

Considering sets, if something is, in set terms a specific subset with a defining membership or characteristic of a definable superset, representing that at compile time effects a hard constraint which honours the set Venn diagram.

If that set/subset constraint doesn't exist then you have to ask yourself if applying a compile time constraint is appropriate.

kazinator•28m ago
I went out of my way to implement inheritance and then make it multiple. Of course I'm going to use it.

Inheritance is just a more deeply integrated form of composition which puts the inherited parts on equal footing with the new parts.

That reduces certain indirections and frictions, which is sometimes useful when making things out of other things.

nrhrjrjrjtntbt•15m ago
You can get Liskov from interfaces too. I rarely (like once in a career) need inheritance.
a-dub•5m ago
i think inheritance got a bad name due to abuse of multiple inheritance and overly fragile base classes in c++ (and maybe java) codebases of the 90s and early 00s.

it's mentally satisfying to create a beautiful class hierarchy that perfectly compresses the logic with no repetition, but i think long term readability, maintainability and extensibility are much better when inheritance is avoided in favor of flat interfaces. (also easier to turn into rpcs as all the overcomplicated object rpc things of the 90s were put to bed).

Our investigation into the suspicious pressure on Archive.today

https://adguard-dns.io/en/blog/archive-today-adguard-dns-block-demand.html
1217•immibis•13h ago•344 comments

libwifi: an 802.11 frame parsing and generation library written in C

https://libwifi.so/
27•vitalnodo•2h ago•3 comments

Transgenerational Epigenetic Inheritance: the story of learned avoidance

https://elifesciences.org/articles/109427
106•nabla9•5h ago•63 comments

Show HN: Unflip – a puzzle game about XOR patterns of squares

https://unflipgame.com/
53•bogdanoff_2•4d ago•9 comments

AsciiMath

https://asciimath.org/
22•smartmic•3h ago•2 comments

When did people favor composition over inheritance?

https://www.sicpers.info/2025/11/when-did-people-favor-composition-over-inheritance/
36•ingve•1w ago•12 comments

Boa: A standard-conforming embeddable JavaScript engine written in Rust

https://github.com/boa-dev/boa
148•maxloh•1w ago•49 comments

Archimedes – A Python toolkit for hardware engineering

https://pinetreelabs.github.io/archimedes/blog/2025/introduction.html
46•i_don_t_know•4h ago•8 comments

Things that aren't doing the thing

https://strangestloop.io/essays/things-that-arent-doing-the-thing
88•downboots•5h ago•49 comments

JVM exceptions are weird: a decompiler perspective

https://purplesyringa.moe/blog/jvm-exceptions-are-weird-a-decompiler-perspective/
47•birdculture•1w ago•3 comments

Show HN: I made a better DOM morphing algorithm

https://joel.drapper.me/p/morphlex/
50•joeldrapper•1w ago•18 comments

Linux on the Fujitsu Lifebook U729

https://borretti.me/article/linux-on-the-fujitsu-lifebook-u729
160•ibobev•9h ago•117 comments

Weighting an average to minimize variance

https://www.johndcook.com/blog/2025/11/12/minimum-variance/
71•ibobev•8h ago•33 comments

TCP, the workhorse of the internet

https://cefboud.com/posts/tcp-deep-dive-internals/
271•signa11•17h ago•136 comments

AMD continues to chip away at Intel's x86 market share

https://www.tomshardware.com/pc-components/cpus/amd-continues-to-chip-away-at-intels-x86-market-s...
80•speckx•3h ago•35 comments

Nevada Governor's office covered up Boring Co safety violations

https://fortune.com/2025/11/12/elon-musk-boring-company-tunnels-injuries-osha-citations-fines-res...
93•Chinjut•5h ago•5 comments

Feature Extraction with KNN

https://davpinto.github.io/fastknn/articles/knn-extraction.html
6•RicoElectrico•1w ago•0 comments

Trellis AI (YC W24) Is Hiring: Streamline access to life-saving therapies

https://www.ycombinator.com/companies/trellis-ai/jobs/f4GWvH0-forward-deployed-engineer-full-time
1•macklinkachorn•7h ago

Messing with scraper bots

https://herman.bearblog.dev/messing-with-bots/
196•HermanMartinus•16h ago•66 comments

Windhawk Windows classic theme mod for Windows 11

https://windhawk.net/mods/classic-theme-enable
175•znpy•7h ago•105 comments

One Handed Keyboard

https://github.com/htx-studio/One-Handed-Keyboard
162•doppp•14h ago•84 comments

A new Google model is nearly perfect on automated handwriting recognition

https://generativehistory.substack.com/p/has-google-quietly-solved-two-of
494•scrlk•4d ago•281 comments

The computer poetry of J. M. Coetzee's early programming career (2017)

https://sites.utexas.edu/ransomcentermagazine/2017/06/28/the-computer-poetry-of-j-m-coetzees-earl...
33•bluejay2•5h ago•8 comments

The Nature of the Beast: Charles Le Brun's Human-Animal Hybrids (1806)

https://publicdomainreview.org/collection/le-brun-human-animal-hybrids/
41•Petiver•5d ago•7 comments

Strap Rail

https://www.construction-physics.com/p/strap-rail
42•juliangamble•1w ago•3 comments

Unofficial Microsoft Teams client for Linux

https://github.com/IsmaelMartinez/teams-for-linux
265•basemi•1w ago•227 comments

FBI Director Waived Polygraph Security Screening for Three Senior Staff

https://www.propublica.org/article/fbi-kash-patel-dan-bongino-waived-polygraph
155•Jimmc414•6h ago•110 comments

History and use of the Estes AstroCam 110

https://www.dembrudders.com/history-and-use-of-the-estes-astrocam-110.html
52•mmmlinux•1w ago•13 comments

Go's Sweet 16

https://go.dev/blog/16years
282•0xedb•1d ago•214 comments

Caffeinated coffee consumption or abstinence to reduce atrial fibrillation

https://jamanetwork.com/journals/jama/fullarticle/2841253
68•stared•4h ago•37 comments