You are viewing a single thread.
View all comments View context
2 points

Factory pattern can return a mock type for testing or a production type, as needed, which makes it possible to unit test the code that uses the produced object.

This quick guide explains it well. Then it improves on it by explaining dependency injection.

https://github.com/google/guice/wiki/Motivation

permalink
report
parent
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 9.4K

    Monthly active users

  • 861

    Posts

  • 33K

    Comments