---
title: "Refactoring private methods is like...?"
url: "https://osherove.com/blog/2008/1/12/refactoring-private-methods-is-like.md"
canonical: "https://osherove.com/blog/2008/1/12/refactoring-private-methods-is-like.html"
published: "2008-01-12T07:40:10"
updated: "2008-01-12T07:40:10"
tags: ["Art Of Unit Testing"]
author: "Roy Osherove"
description: "I'm still struggling away with my book, and was wondering what you thought about this analogy. I am referring to the problem of testing private\\public method, and in that regard I refer to the ease of changeability of…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# Refactoring private methods is like...?

By Roy Osherove January 12, 2008 In [Art Of Unit Testing](https://osherove.com/blog/category/art-of-unit-testing)

**Historical article** · Originally published January 12, 2008; technical details may be outdated.

I'm still struggling away with [my book,](http://artofunittesting.com/) and was wondering what you thought about this analogy.

I am referring to the problem of testing private\\public method, and in that regard I refer to the ease of changeability of private vs. public methods and the contracts they assume of the interacting party (reader\\developer\\code)

Refactoring methods is like refactoring a book chapter.

In a way, changing a **private** method is like changing a few sentences in a book chapter. The full chapter still may read exactly the same, but the way it is being delivered may change.

Changing a **public** method is like changing the chapter’s title I the book. You really want to make sure that you’re not hurting the overall feel and content of the reader.

It feels OK to me, perhaps a bit contrived, but what do you think? what is refactoring private\\public methods analogous to?

## More in Art Of Unit Testing

[All posts in Art Of Unit Testing](https://osherove.com/blog/category/art-of-unit-testing)

- Jan 20, 2008

    ### [TDD Anti Patterns](https://osherove.com/blog/2008/1/20/tdd-anti-patterns.html)

- Jan 17, 2008

    ### [The evolution of Unit Testing Syntax and Semantics](https://osherove.com/blog/2008/1/17/the-evolution-of-unit-testing-syntax-and-semantics.html)

- Dec 18, 2007

    ### [Basic Guidelines for using RowTest and data driven tests](https://osherove.com/blog/2007/12/18/basic-guidelines-for-using-rowtest-and-data-driven-tests.html)

- Dec 18, 2007

    ### [\[RowTest\] for NUnit, File System Interfaces for unit testing](https://osherove.com/blog/2007/12/18/rowtest-for-nunit-file-system-interfaces-for-unit-testing.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
