Article Preview
Buy Now
FEATURE
Writing a Preferences Class
Issue: 2.3 (December/January 2003)
Author: Charles Yeomans
Author Bio: Charles Yeomans is a compulsive refactorer.
Article Description: No description available.
Article Length (in bytes): 43,800
Starting Page Number: 13
Article Number: 2309
Resource File(s):
2309.zip Updated: 2013-03-11 19:07:57
Related Link(s): None
Excerpt of article text...
Almost all applications need a way to save preference settings. The goal of this article is to write a reusable preferences class. We're going to write it using practices from test-driven development and design by contract to see if we can get a solid design and reliable code quickly.
Initial Specification
Let's begin by setting out and describing what our Preferences class should do. The main task is to be able to store and retrieve preference settings using string keys -- for example:
App.Prefs.value("BrowserWindowTop") = 25
SomeEditField.TextFont = App.Prefs.Value("Default Font").
...End of Excerpt. Please purchase the magazine to read the full article.