Extended Features

Version Control System

No later than you develop more than "Hallo World" programs you need version control system. You need it to save and archive your code and follow the code changes. Version Control gives you a guarantee to be able to return to former code state so you can experiment with your code. Version control is implicit base requirements for many extreme programming practices. In XOTclIDE all changes in code are updated in version control immediately so must not carry about saving your source. Version Control System is also a code repository that can be user centralized for many developing clients. Components can be loaded and executed directly from version control repository without the need to save it as files in file system.

Benefits of Version Control

  • database oriented - all information are stored in database

  • central code repository - no files copying

  • suitable for big projects - able to browse in thousands line of code

  • multiuser able

  • flexible as XOTcl - no locks, no commit, it is developed specially for object oriented language as XOTcl.

Base Characteristics

  • based on relational database (currently mysql, postgres, sqlite or odbc)

  • The XOTcl programs are stored and managed corresponding to their structure. (Components, Classes/Objects, Methods).

  • Every change in your system is stored on the fly. You must not ask the system to update the structures.

  • If you add or modify any method, a new row is inserted into the database. The old method version is normally not deleted. You can always return to every state in the past (no comment and uncomment of code pieces).

  • Store not only sources but also additional data as documentation, comments, meta data.

  • It implements so called optimistic locking. Dirty writes are recognized and user is responsible for read new status and repeat the operation. No code can be lost.

Principle

Figure 1. Version System Principle

XOTclIDE Programs are structured in Components (XOTclIDE specific), Classes/Objects and Methods (see the Section called Building an Application in the chapter called Programming with XOTclIDE). All this structure elements are stored and managed separately in database. So you can use many versions of one class without to have to store complete class definition in separately text file (as usual in cvs if one class is one file) with many redundant informations although only one method differ. Normally the programmer do not must carry about version control. He just develop. The version control use so called optimistic locking. If the programmer means the state of component or class is stable and value to be marked he have to "version" this component or class. After it he can return to this state all recognize changes among different versions.

Database Schema of Version System

Figure 2. Version System ER Diagram

There are m:n relationship among Components, Objects/Classes and Methods. It means one method version can belong to m object-versions. This diagram does not include configuration maps. If you know this schema you can formulate queries on repository directly in SQL. It is quite ease to find out the newest methods, statistic about code developing with simple SQL-queries.

The object attribute "deforder" specify the order of loading Objects/Classes into interpreter.

The ComponentRequire entity map the requirements for one component version. The information that a special component version need a special version of another component is not stored.

Version info attributes are indent to store short text information for developer about the version and are not used to identify entities.

Definitions (Editions,Versions)

The Edition is a piece you can work on it. There are Components, Objects and Methods editions. The Editions can be changed. Methods can only have editions.

Versions are frozen editions. It means they can not be modified. One class version have always the same methods. If you want to froze an edition you have to version it. If you want to modify a versioned class you have to open new edition of this class. This new class edition is based on the last class version.

Using Version System, Main Functions

The following functions are available per menu for all (most) structure items (Components, Objects, Methods)

  • Available - Show all items in database. All Components, all object, all method that belong to selected object. You can choose a edition and load it into the system. So you can find and reload the methods you have deleted.

  • Editions - show all editions of currently selected item (Component, Object, Method) you can load your chosen version into system.

  • Changes - start Changes Browser to show changes to another edition in Database.

  • Load Previous - you can return to previous (based on) edition. By methods you can simply discard the latest changes.

  • Version - Froze current selected edition. (cvs tag or labels) You can version only components and classes/objects. (It make no sense by methods). You can always return to this state of class or component.

  • New Edition - If you want develop a versioned edition you have to make new edition for it. The system make a working copy of a version.

  • Version Info - Show a small info dialog. You can specify the version string which can be 30 characters long. The first number will be automatically increased by opening new edition from it. The number is used as version number for Tcl packages.

function belove are available only for components

  • Import - Install the package in repository. Probably loaded per load package by package require into database.

  • Requirements - Show and edit required components for selected component. The requirements are set automatically. You do not need to change it normally.

Changes Browser

You can see the differences to another version. So it is command diff substitution for XOTclIDE. In figure Figure 3 we can see changes among to class versions of class IDECore. In the method list are shown all instance methods with differences. The method rekBuildDefList is selected so in the text area we can see (yellow selection) the exact differences in it.

Figure 3. Changes Browser

Component Loader

You can execute programs directly by loading them from Version Control System. So it is not necessary to deploy your application as set of files. It make the management of many clients systems very easy but on the other hand the loading time can increase. CompLoader.tcl is small independent script that can connect to repository load all components specified by configuration map and execute it.

Usage: CompLoader.tcl [-nodialog] {-ignoreprefs] {-nosynchronize] [-help] [-preferences list]

-ignoreprefs

do not read preferences

-nosynchronize

no IDE self developing mode

-nodialog

no user interaction by connecting db

-preferences string

overwrite preferences (use keyed list)

-help

show all options

Installing Version Control System

XOTclIDE supports following databases as repository

  • mysql

  • postgres

  • odbc

  • MS access driver per tclodbc (Windows only)

  • sqlite

The Tclkit distribution (Starpack) comes directly with sqlite. I recommend to use mysql because it is my primary developing system so it is best tested.

To get version control to run on linux system you must:

  • Install mysql database. I recommend to use RPM packages for your distribution.

  • Install mysqltcl extension to access mysql from tcl. If you want to compile it yourself you need header files for mysql database (for redhat the package mysql-devel). There are also RPM for Linux available on mysqltcl site.

  • Run the installer tool installVC.tcl it can check the database connection, specify connect parameter, install tables and copy components to repository. Than you can start XotclIDE with XotclIDEDB or XotclIDEFromDB. The first connect Database after loading itself per package require. XotclIDEFromDB try to load entire application from DB.