It must have been clear by the end of the previous chapter, that there are a lot of different ways to approach Superbase NG. The hardest part about getting to know a new product is that there are so many things to learn. It is generally best to have some clear goals, in order to direct the learning and to provide an early project or two. As a starting point, it is strongly recommended that the reader at least browse the first chapter of this book. Also if any real programming is planned it is a good idea to work through Chapter 1 of SIMPOL IDE Quick Start Manual [https://www.simpol.com/documentation/ide-quick-start/2/], which teaches the basics of using the IDE to create projects, edit, compile, and debug programs, to work with external libraries, and to set project settings.
Once that is done, the next steps depend greatly on what the reader wishes to accomplish. These might be any of the following:
A command line program, see the section called “Command Line Programs”
A dialog-style application, see the section called “Dialog-Style Programs”
A GUI-style database program, see the section called “Database GUI Applications”
A web server program, see the section called “Web Server Applications”
A standalone server application, see the section called “Server Applications”
A conversion from Superbase, see the section called “Converting from Superbase”
Each of these is described more thoroughly below. Obviously these are merely starting points, there is nothing that says that they couldn't be combined in various ways, such as a server application that has a GUI for controlling it, or database GUI application that also provides a set of web server applications to allow some users a specific set of functionality via the web to what is otherwise a desktop application. Another might be a desktop application that uses the
httpclientlib.sml library to access useful resources on the Internet and provide their functionality to the desktop program.
Preparing Our Environment
Before we start actually developing any programs, it might be a good idea to start out by preparing our development environment. There isn't much to do, and it isn't absolutely essential, but it will save time and aggravation later, especially if you are using the Windows Vista operating system or a later version. That is because it is very difficult, bordering on impossible to manage projects as a sub-directory below the
Program Files directory. There is a special level of additional protection that prevents applications from writing to that directory, even if you have administrative rights. As such, it is a good idea to get in the habit of locating your projects somewhere else, such as your home directory. In Windows XP and ear- lier that is normally the
C:\Documents and Settings\username\My Documents directory. In Vista, it has been changed to
C:\Users\username and even more importantly, the actual home directory is more usable than it was in XP.
In the SIMPOL IDE select Tools → Options.... In that dialog window, in the edit control for the Working Project Directory, enter a path name or click on the ... next to the field and select the path from the directory selection tool.
The dialog window can be seen here:
Command Line Programs
Getting started with command line programs is probably as easy as it gets in SIMPOL, from a purely programming perspective. There are a number of examples to show the ropes. Command line programs can take up to 10 parameters (currently), and can output their results. They do not have access to typical command line features like stdin, stdout, and stderr, but can still accomplish goals and return results. For an in-depth look at creating a command line program, see Chapter 4, Command Line Programs.
These types of programs are normally not terribly complicated, and are often designed to provide a tool that accomplishes a specific goal. The applications are usually hosted in a dialog window and are generally not connected with a database (though they certainly could be). For the complete story, with a working example, visit Chapter 5, Dialog-Style Programs.
Database GUI Applications
Database programs in SIMPOL tend to start with Superbase NG Personal. Using its table creation tool, or via the import functionality, a new database table or tables can be created. In the same program the Form Designer can be found. Once the database tables are created, the Form Designer is used to create appropriate masks for the screen. These can be saved as forms, as source code, or both. Once the basic components have been created, they can be quickly turned into a small program that provides all the tools for creating, editing, and deleting data from the tables. More can be added to allow the output of data in various formats. For a full example, see Chapter 6, GUI-Style Database Programs.
Web Server Applications
SIMPOL can also be used to create powerful web server applications and has built-in support for CGI (Common Gateway Interface), ISAPI (Internet Server Application Programming Interface), and Fast-CGI, which is a high-performance version of CGI. One of the more powerful features in SIMPOL when devel- oping web server applications is the ability to do source-level debugging of a web server application as a callback from the web server. Generally this is done using the Apache web server running locally on Windows. For the complete story, go to Chapter 9, Web Server Programs.
Server applications are a special type of command line program. They are designed to start up and then wait for clients to connect to them. At that point, they provide some service. Typically they are using TCP/ IP to communicate, though a SIMPOL database server program is also a server program that is waiting for connections from database clients. Any sort of service could be a viable candidate, such as a program that does some very complex calculations based on a specific set of input, or a program that regularly collects information from various web sites, consolidates that, and produces a new set of information based on what it found and makes that available to clients. Another example might be a dedicated encryption/decryption service, for communications security. To have a look at creating a server program, see Chapter 10, Server Programs.
Converting from Superbase
Superbase provided a great set of tools to quickly create applications, similar in style to the database ap- plications described above. Superbase is not directly compatible with SIMPOL, but a significant effort has been made to ease the path of migration from Superbase to SIMPOL. To that end a number of conversion tools are included, some in SIMPOL and some in SBL. For a walk through the process of doing a Super- base to SIMPOL migration, Chapter 11, Converting Legacy Superbase is the best place to start.