Chapter 1 Introduction
- What is Config4*?
- Why Might You Want to Use Config4*?
- The Collection of Config4* Manuals
- Structure of this Manual
- Obtaining and Installing Config4*
1.1 What is Config4*?
Config4* (pronounced “config for star”) is the generic name for a family of libraries that provides a powerful, easy-to-use parser for configuration files. Initially, this family has just two members: Config4Cpp (for C++) and Config4J (for Java). I hope that, over time, the family will grow to support other languages, including C and C#.
Many popular scripting languages—such as Lua, Perl, Python, Ruby and Tcl—are implemented in C. Thus, Config4C (for C) will be useful for C programmers, while also paving the way for scripting languages to parse Config4* configuration files. Likewise, one language supported on Microsoft’s .NET platform can use functionality implemented in another .NET-supported language. Because of this, a port of Config4* to, say, C# would enable all .NET-based applications to use Config4*.
Hence the name of this overall project is Config4*. The “*” in the name denotes a wildcard that can expand to include many different languages.
1.2 Why Might You Want to Use Config4*?
There are already many configuration technologies in widespread use. For example, Microsoft Windows provides a centralized registry; Java provides properties files; and it is common in scripting languages to store configuration information in the syntax of the scripting language. When people need a platform- and programming language-agnostic configuration format, increasingly they choose XML. This raises the question: what has Config4* got to offer that isn’t already provided by an existing configuration mechanism? The answer is: a lot.
1.2.1 Benefits for Users
Config4* offers several benefits for end users.
First, the syntax used in Config4* configuration files is much more user-friendly than, say, Java properties files or XML files.
Second, Config4* makes it easy for users to find and correct mistakes in configuration files. For example, Config4* provides a schema validator that can produce easy-to-understand error messages if configuration variables have misspelt names or bad values.
Third, users can choose the granularity they want for grouping configuration information.
- A user can have one configuration file for an application, split an application’s configuration over several files, or have one file that contains configuration information for multiple (possibly related) applications.
- Config4* can adapt configuration information based on the environment in which an application is running. This means an administrator does not have to maintain multiple copies of an application’s configuration file, where each copy has mostly common information but also a few details specific to a particular user, hostname or operating system. Instead, it is possible to maintain a single configuration file that contains the common information plus the details specific to each user, computer or operating system.
Fourth, Config4* can parse configuration information from an arbitrary source. Most commonly, a user will store configuration information in a file, but Config4* can obtain configuration information from, say, a web server or a database. This provides the option of centralizing configuration information if you are deploying an application on several computers that do not have access to a shared file system.
1.2.2 Benefits for Developers
Config4* offers several benefits for developers.
First, the Config4* programming API is not easy to use; it is trivial to use.
Second, Config4* provides a utility that makes it possible to compile a configuration file into an application’s executable. This is useful for embedded systems, or where you want to embed default configuration values into an application so the use of an external configuration file becomes optional.
Third, Config4* provides a viable alternative to XML as a data file format. The Config4* library is an order of magnitude smaller than popular XML parser libraries, it parses input files speedily and the resulting in-memory representation is more compact than a DOM tree. In addition, Config4* provides user-friendly error messages, easy-to-use schema validation of input, and a programmer-friendly API.
Finally, one of the goals of the Config4* project is to provide highly portable implementations for many popular programming languages. This is important because many projects start out by using just a single programming language on one operating system but, over time, end up using several languages and/or operating systems. For example, a client-server system might initially be implemented in C++. Then you decide to re-implement the client part in Java so it can provide a cross-platform graphical user interface (GUI). Then you use a scripting language to write some report-generating utilities for the system. In such an environment, being able to process one set of configuration files from multiple languages is a great help.
1.3 The Collection of Config4* Manuals
Config4* documentation is provided as a collection of manuals.
- Config4* Getting Started Guide.
- This is the manual you are currently reading. It provides an introduction to Config4* for both users and developers of Config4*-based applications.
- Config4* Practical Usage Guide.
- This manual provides useful advice and suggestions for developers on practical ways to use Config4* in a wide variety of projects.
- Config4* Maintenance Guide.
- This manual provides useful background information for people who want to maintain the source code of Config4* implementations or implement Config4* in another programming language.
- Config4* C++ API Guide.
- This manual provides a tutorial and reference for C++ programmers.
- Config4* Java API Guide.
- This manual provides a tutorial and reference for Java programmers.
1.4 Structure of this Manual
This manual is structured as follows.
Part I provides an overview of Config4*’s capabilities for both users and developers.
Part II discusses Config4*’s supporting infrastructure, including its security mechanism and command-line utilities.
Part III provides provides comprehensive details on the syntax used in Config4* files and also the syntax used in its schema language.
Part IV provides tips on how to use Config4* in your projects.
1.5 Obtaining and Installing Config4*
You can download Config4Cpp and Config4J from the Config4* website. The downloads are in the form of a ZIP file. The downloads contain C++ or Java source code plus manuals (in PDF and LATEX form).
You should read the top-level README.txt file in a distribution for instructions on how to compile the Config4* source code.