O'Reilly logo

Beyond Legacy Code by David Scott Bernstein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Quality Code Is Encapsulated

Quality code is encapsulated—it hides its implementation details from the rest of the world. One of the most valuable benefits of using an object-oriented language over a procedural language is its ability to truly encapsulate entities. By encapsulation, I don’t just mean making state and behavior private. Specifically, I want to hide interface (what I’m trying to accomplish) from implementation (how I accomplish it).

There are many things that can be encapsulated, and the process of writing a good program is the process of hiding as much as possible while still getting the job done. For our purposes, let’s redefine encapsulation to mean hiding what something does from how it does it. The more you can hide how you ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required