Hacker News new | ask | show | jobs
by drc500free 1551 days ago
17 years ago, a colleague convinced the team to rewrite a Java server application using Aspect Oriented Programming. It was a new and magical technology that would allow us to separate the meaningful business logic from annoying logging and bookkeeping - at the slight cost of losing track of standard OO control flow and scoping.

The 12 months of hell that followed cannot be described in a simple hn comment. The dangers of any technology that confuses code reviewers about scope is one of a small handful of lessons that have stuck in my brain, almost a decade after I left engineering behind.

2 comments

The problem is probably in the word “rewrite”. That you used AOP was probably incidental.
The problem was definitely doing a refactor to make engineers marginally happier with no customer need in mind.
Thousands of developers every day are using React with hooks. I sincerely hope that they are also not facing "months of hell".
Judging by some of their actual expressed feelings about using hooks, there is definitely a subset of React devs who are definitely experiencing months or more of hell. The React team is, admirably, actively working on a next version of docs to help address this. The fact that the docs project is hooks-first is both a testament to how radically React itself has changed over recent years, but also at least a smell that hooks themselves may be inherently a pain point.

Speaking for myself, I’ve only used them a few times, but I’ve found footguns in even very simple usage. Not months of hell, but definitely propositionalToleranceForHell < actualHell. And sure maybe that’s lack of experience with hooks specifically, but they have nearly-totally-whitespace-and-punctuation-diff equivalents which are nowhere near as complex to actually use effectively.

Hook are worse than lifecycle methods, they are difficult to understand, and they are not elegant. When you run into trouble, it is your mental model to blame. You are told to learn to think in hooks, which is to say, to do things in an unintuitive way. That is a heavy price to pay for composability.