Table of Contents
We are now going to write an application that creates a picture based on random data provided by people. The picture will be composed of adjacent 90 degrees arcs with different radii and colors. Here is an example of the final result:
The arcs' radii will be based on data provided by users of the application. A single user input for one arc is called a
contribution and is composed of:
The application will be able to collect contributions directly submitted by users (e.g. via a web site) and/or by other applications (e.g. via a HTTP request). All contributions will be saved in a JSON text file.
The arcs' colors will be defined by a random generator.
The final picture will be created in the Scalable Vector Graphics (SVG) format and stored in a file.
|This application clearly doesn't belong to the category 'life saving applications'. Despite this fact we will nevertheless write reliable code. User input data can be invalid or malicious, and resources like files can fail at runtime. Therefore, invalid data protection and resource error handling will play a very important role in the following chapters. The objective is to see how to write professional, reliable applications.|
To develop this application you will do the following:
|The full project with source code is included in the Obix download. It is located in subdirectory |
To create the 'random arcs' application proceed as follows:
Open a system console (a text terminal in Linux, or a command line window in Windows).
Go to the root directory of your Obix installation.
Create a new project named
random_arcs by entering the following command:
on Linux type: ./obix.sh create_project project_id:random_arcs kind:java on Windows type: obix create_project project_id:random_arcs kind:java
Obix creates a directory named
pr_random_arcs in subdirectory
projects of your Obix installation (e.g.
If you need more information please look at the
README.TXT file in the project's root directory or refer to the previous Chapter 4, How to develop a standard PC application?.