Back to basics: Encapsulation

Stuff about programming

Some day, you might have heard about “design patterns”, “good practices”, “programming principles”. If you have taken a look at all of them, you sometimes find very long articles, black text on white background, no design, few text formatting, not very friendly.

But actually you should take care of reading these articles, most of the time they come from devs that just care about words and important things to say, and they’re right, even if they criticize or praise for this or that.

Patterns, concepts, principles

You may already have read our serie of articles about SOLID principles  (if not, you should!), and with our “Back to basics” long serie of articles, we hope to share good things about programming, either common or marginal, for either newcomers or experienced devs.

Most of the time it will talk about oriented object programming, so a few knowledge about classes and objects is useful to follow these articles in the nicest way.

Design patterns, concepts and principles are important because they help you know how code is built, how applications are structured, and a nice way of thought about using our creativity to conceptualize applications before they even take form in a few lines of code.

Encapsulation: a simple principle

The concept of encapsulation is quite simple, theoretically: just protect internal logic in your classes.