168

Понравилось :) Отсюда.

Sometimes, the test justifies the means

The pupil asked two master programmers:
“I cannot test this code without mocking and violating encapsulation.
What should I do?”

One master programmer answered:
“Mocking is bad, and you should never violate encapsulation.
Rewrite the code so you can test it properly.”

The other master programmer answered:
“Mocking is good and testing trumps encapsulation.”

The pupil, confused, went out for a beer.

At the local watering hole he saw the great grand master
programmer drinking beer and eating buffalo wings.

“Great grand master,” said the pupil, “I thought you did not drink.
And aren’t you a vegetarian?”

The great grand master smiled and replied: “Sometimes your thirst is
best quenched by beer and your hunger by buffalo wings.”

The pupil was no longer confused.

This entry was posted in Uncategorized and tagged . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>