Special

Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview


Buy Now

Issue 3.1

COLUMN

Keeping Data Private

Issue: 3.1 (September/October 2004)
Author: Charles Yeomans
Author Bio: Charles Yeomans is a software developer in Lexington, Kentucky.
Article Description: No description available.
Article Length (in bytes): 4,984
Starting Page Number: 33
Article Number: 3115
Related Link(s): None

Excerpt of article text...

"Data should be private" is an oft-cited dictum of object-oriented design. However, it's sometimes unclear just what people mean by this, and it becomes entangled with and confused by the capabilities of particular languages. So let's take this opportunity to get it straight.

One rather literal interpretation of this saying is that properties must never be exposed, but should be hidden behind accessor and mutator methods. In fact, this is properly a question of (class) interface design. In C++ and Java, the syntax for getting and setting the value of a data member of an object is different from function syntax. So suppose you have a C++ class whose member Foo is declared as public. Then you can write code like c.Foo = 6. But if you later want to make this member private and add get/set functions, you may be breaking a lot of code, because you cannot use this assignment syntax with a function in C++ or Java.

...End of Excerpt. Please purchase the magazine to read the full article.