A Critique of “Clean Architecture” by Robert C. Martin
coderbyheart.com
coderbyheart.com
This kind of seems really obvious.
If i understand you basically any time a developer uses an orm he would be mixing the DB interactions with business logic but i want to be sure what you mean.
Thanks!
Here is an example from the Django documentation [0]:
selected_choice.votes += 1
selected_choice.save()
The offender in my eyes is the save() method call. The first line is business logic, but the second line has nothing to do with business logic. It might be slightly better to hide the database interaction in the object itself, create a special method, and change the two lines into: selected_choice.increaseVotes(1)
As a counter argument, I dislike code which hides database accesses, because that easily leads to code which does way to many of them and thus is unnecessarily slow.It seems better to explicitly say when to save things rather than hope that every custom method does that and you have a method for every combination of updates.
The Django ORM also has another case to consider: bulk updates, where separating logic from serialization makes a huge performance win easy and safe.
I was really disappointed by his posts in the last year, since he is a very important author and figure in my career.
Therefor I could not let this slide.
The question that still bothers me is: should I read material from people I think are showing unacceptable behavior?
Here, I think the post makes clear why they talk about the author like this: some will have heard of Bob Martin for his political opinions, and could well wonder whether the book features them along with technical opinions. This would be a legitimate review topic no matter the political views.
Hacker News has a strong "focus on the tech, not the politics" contingent, so I'd think they'd be especially open to a book review that evaluates whether a technical book did what they were asking for.
When I read a post entitled "A critique of...", I expect an objective analysis of the information provided by the book, not jabs at the author. I hope this is helpful.