
A Critique of “Clean Architecture” by Robert C. Martin - tckr
https://coderbyheart.com/clean-architecture/
======
verletx64
> Write high-level abstractions for everything that is not your core business
> domain, and don't let secondary component concepts leak into your business
> domain.

This kind of seems really obvious.

~~~
qznc
I have yet to see a web service where the database interactions do not leak
into the business code.

~~~
Omnius
Can you elaborate what you mean by this. What would an example of the bad
practice look like verse if it had been done correctly?

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!

~~~
qznc
I would not label it bad practice. Honestly, I'm not sure if there is a simple
rule to decide what is good or bad. Using an ORM is not necessarily mixing in
DB interactions.

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.

[0]
[https://docs.djangoproject.com/en/2.0/intro/tutorial04/](https://docs.djangoproject.com/en/2.0/intro/tutorial04/)

~~~
acdha
The second argument should also include correctness: if I increment two
variables on that object (e.g. votes and last_vote_time) it needs to be a
single atomic operation to not create a hard to debug race condition.

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.

------
Lapsa
for the most part - I'm grateful for what I've learned from Uncle Bob. brb
checking diversity drama

------
dfee
Was this a critique of the author or a critique of the book? It read as more
the former than the latter.

~~~
tckr
OP here.

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?

~~~
emsy
I think you need to organize your thoughts before writing an article. The
separation of creation from the creator is an interesting topic, but shouldn't
be mixed up with a book review in my opinion. I'm also interested what
unacceptable behaviour Bob showed, since I only know of his controversial
opinions on software engineering.

~~~
tckr
Organize so I can split them up in two different posts? One about the book and
one about the behavior?

~~~
emsy
It depends on what you want to tell. You can discuss how you agree/disagree
with someone as polarizing as Uncle Bob in the context of the book, which, if
I can go by his previous books, contains a lot of his personality. Or you
write an objective critique of the book. Or maybe something entirely
different.

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.

~~~
tckr
Thanks for that input!

