You are previewing Refactoring: Improving the Design of Existing Code.

Refactoring: Improving the Design of Existing Code

Cover of Refactoring: Improving the Design of Existing Code by Don Roberts... Published by Addison-Wesley Professional
O'Reilly logo

Chapter 8. Organizing Data

In this chapter I discuss several refactorings that make working with data easier. For many people Self Encapsulate Field (171) seems unnecessary. It’s long been a matter of good-natured debate about whether an object should access its own data directly or through accessors. Sometimes you do need the accessors, and then you can get them with Self Encapsulate Field (171). I generally use direct access because I find it simple to do this refactoring when I need it.

One of the useful things about object languages is that they allow you to define new types that go beyond what can be done with the simple data types of traditional languages. It takes a while to get used to how to do this, however. Often you start with a simple ...

The best content for your career. Discover unlimited learning on demand for around $1/day.