REBOL Programming/Design Guide/Data drives it

Embrace the concept that data can drive your program.

This is an old idea called "data driven code", and REBOL promotes it to a new level.

Keep an eye out for repeating patterns in your source code.

Often a pattern can be reduced to simply a block that expresses the parts of the pattern that are different.

This saves time, shortens the script, and makes the program easier to maintain.


Data driven programming is a computer programming paradigm which contrasts to Event Driven Programming and Flow Driven Programming. In data driven programming the flow of control and look of the program is altered by changing a data structure inside the program, or by altering a data file that is used by the program. An extreme example of this is REBOL itself which interprets REBOL code. REBOL code is the data.

Leaving that aside, when we create mini dialects that are read by REBOL at run time to produce modified behaviour, we are using the data driven programming paradigm. In this book we have an example where a data structure is used to describe a GUI, which is generated at run time. Rather than have the data structure inside the program, it could just as easily be read from a file. In this case we mix paradigms by using a data driven program to create an event driven program.

The point about this is that we are reducing complexity, and easing maintenance by taking the decisions outside of the program and placing them into easily modified data.

External ReferencesEdit

Last modified on 3 June 2009, at 03:54