Now, the refactored code looks like a wrapper around work.hasPendingTasks(); and question is that, when it happens that we have a simple single lines like, it is okay to wrap them up? I mean, we could used the work.hasPendingTasks(); directly. What do you think or encourage? Thanks
Learn something new every day.
- I am a senior software engineer working in industry, teaching and writing on software design, SOLID principles, DDD and TDD.
Location
Buenos Aires
Education
Computer Science Degree at Universidad de Buenos Aires
they are accidentally coupled, now. But the caller to 'canWeMoveOn' does not know,
If you change your implementation or add new business rules or add a cache the caller should not be aware
I have and I am learning a lot from these series. @mcsee a question please (your opinion)
say we have the code:
All we want is the result of
work.hasPendingTasks()
and in this post, you suggested that it is better not to explicitly return a boolean.So you refactored it to:
Now, the refactored code looks like a wrapper around
work.hasPendingTasks();
and question is that, when it happens that we have a simple single lines like, it is okay to wrap them up? I mean, we could used thework.hasPendingTasks();
directly. What do you think or encourage? ThankscanWeMoveOn the 'what'
hasPendingTaks the 'how'
they are accidentally coupled, now. But the caller to 'canWeMoveOn' does not know,
If you change your implementation or add new business rules or add a cache the caller should not be aware
I used this example here
Code Smell 123 - Mixed 'What' and 'How'
Maxi Contieri ・ Mar 22 ・ 2 min read