목차

-캡슐화

-다형성

-State 패턴

-String 상수화


캡슐화를 통한 리펙토링에 대한 내용을 Microsoft에서는

What: Lets you turn a field into a property, and update all usages of that field to use the newly created property.

When: You want to move a field into a property, and update all references to that field.

Why: You want to give other classes access to a field, but don't want those classes to have direct access. By wrapping the field in a property, you could write code to verify the value being assigned, for example.

흔히 말하는 캡슐화의 장점

  1. 유지 보수성의 용이
  2. 재활용성
  3. 은닉성
  4. 무결성 보장