Skip to Main Content
Simple Object-Oriented Design
book

Simple Object-Oriented Design

by Mauricio Aniche
May 2024
Intermediate to advanced content levelIntermediate to advanced
192 pages
4h 26m
English
Manning Publications
Content preview from Simple Object-Oriented Design

3 Keeping objects consistent

This chapter covers

  • Keeping classes consistent
  • Modeling aggregates that hold complex object relationships
  • Implementing validation mechanisms that ensure consistency at all times

A well-designed class encapsulates its data and provides operations to access or manipulate it. These operations ensure that the object remains in a valid state without inconsistencies. Better yet, they do so in a way that the clients of the class don’t even need to know about it.

One of the greatest advantages of object-oriented programming is the ability to ensure that objects are always in a consistent state. Compare it with, say, procedural programming languages like C. In C, you can define data structures (known as structs). However, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Object Design Style Guide

Object Design Style Guide

Matthias Noback
Design It!

Design It!

Michael Keeling

Publisher Resources

ISBN: 9781633437999Publisher SupportOtherPublisher WebsitePurchase Link