Vladimir Khorikov

enterprisecraftsmanship.com · Personal blog · on HN since 2015

Vladimir Khorikov writes about software design, unit testing, domain-driven design, and .NET development.

What HN saysHN commenters recommend his posts on when to mock and on testing without mocks, and favor his classical approach to unit testing.
29HN people shared it
7linked it in comments
78stories submitted
1.1Kstory points
2 years agolast shared
2015people per year2026

Most-shared posts

  1. 1
  2. 2
    When to Mock
    3 people · 60 points · first shared 2020 · 79 comments on HN
  3. 3
  4. 4
    How I tried to get into game development and failed
    2 people · 298 points · first shared 2017 · 168 comments on HN
  5. 5
    C# and F# approaches to illegal states
    2 people · 99 points · first shared 2015 · 92 comments on HN
  6. 6
    Law of Demeter and immutability
    2 people · 50 points · first shared 2016 · 36 comments on HN
  7. 7
    OOP, FP, and object-relational impedance mismatch
    2 people · 6 points · first shared 2016 · discussion on HN
  8. 8
  9. 9
    Test-induced design damage or why TDD is so painful
    2 people · 6 points · first shared 2015 · 1 comments on HN
  10. 10
    What is functional programming?
    2 people · 4 points · first shared 2016 · discussion on HN
  11. 11
    Temporal Coupling and Immutability
    2 people · 3 points · first shared 2017 · discussion on HN
  12. 12
    You are naming your tests wrong
    2 people · 3 points · first shared 2019 · discussion on HN
  13. 13
    DRY vs. Damp in Unit Tests
    2 people · 2 points · first shared 2020 · discussion on HN
  14. 14
    TDD best practices
    2 people · 2 points · first shared 2015 · discussion on HN
  15. 15

What HN people wrote when they linked it

amw-zero · 2021-08-09
Here’s another review / critique of this book, but with a full implementation based on the author’s grievances: https://enterprisecraftsmanship.com/posts/growing-object-oriented-soft… The main point of it is to avoid testing via mocks and to also avoid interfaces that are only there for testing purposes. The end design is extremely simple, and because it has command / query separation, the actual logic is trivially testable. Give it a read. I love Growing Object oriented software guided by tests as well, these are all just different approaches with different mindsets.
arwhatever · 2021-01-30
Might I recommend this overview? https://enterprisecraftsmanship.com/posts/when-to-mock/ I more understand the Martin Fowler article quite well, but only after struggling with it and revisiting it (sporadically) over several years, and I really think this by Mr, Khorikov gives a much clearer, more straightforward overview.
spawarotti · 2020-09-24
Came here to say exactly that. The author is advocating for mockist style of unit testing, which is quite terrible for many, many reasons. What you are describing is classic unit testing, and this is the way to go. Good article and book about it: - https://enterprisecraftsmanship.com/posts/unit-testing-dependencies - Unit Testing Principles, Practices, and Patterns
kraftman · 2018-08-15
I found this set of articles great for using less mocks and creating less brittle tests: https://enterprisecraftsmanship.com/2015/07/06/how-to-do-painless-tdd/
NicoJuicy · 2022-02-14
I see a lot of complaints from you. But I should mention that nhibernate is not even in the dotnet foundation and not supported for .net core ( I visited their site and it mentions dotnet framework). I see this though: https://enterprisecraftsmanship.com/posts/nhibernate-now-supports-net-… So the issue is mostly nhibernate?
stemmlerjs · 2019-04-18
> How many places in your code create new users, and how many places in your code need to validate users? If the answer is “many,” you have serious design problems that should not be solved by introducing more classes but by restricting how many different areas of code do the same job. Consider an application where you can edit and add users. Consider that you can also add users to groups and remove users from groups. Consider that you might also be able to add policies to users. These are a few different areas in code where you might need to create an instance of a User. This is exactly what we're doing; we're limiting the amount of places where valid users can get created. The User domain object and it's invariants are validated right here at the model. If there was an invariant saying that users can't have more than 5 policies on them, a user.addPolicy(policy) method would exist right on the user model/aggregate root, and the aggregate root would be responsible for determining if any invariants will be unsatisfied after the operation. > Also, the private constructors do absolutely nothing. The static factory methods in this blog post could be written the exact same way as a constructor, and they would work exactly the same. The only reason the author uses a static factory method is because that's what he was taught to do in Java. The reason why I use a static factory method is because it allows you to protect the aggregate invariants (domain logic that deems the…

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close