Business Services
  Specialist Services

Sock: Introduction


Sock is a language independent tool which provides a method of reusing code orthogonal to any mechanisms provided by the target programming language.

Using Sock is like having a coding assistant who knows the way you write code, or is able to show you how someone else does it. When you write a program which needs a command line option or menu switch you are probably used to lifting a piece of code from a similar program, either by memory or by actual copy and paste. If you are lucky you have some reusable classes which do some of the work, but you still have to do something quite repetitive.

With Sock you write a definition of the required option: its name, type, description, and so on. Separately you write a mapping from that description to actual code - a coding pattern.

This is not the same as using a code generator (a 4 or 5 GL), because where you want to write code which has no general pattern you just go ahead and do it. If you need a slight variation on an existing pattern you can do that too.

How Does It Work?

The current implementation of Sock requires you to write a specification consisting of XML tags wrapped around, and embedded in, bits of conventional code. The XML tags tell where the code is to go and what patterns to use. The patterns are written in a combination of XSLT and Sock elements.

Later versions of Sock will hide much of this syntax from you. For this version Sock works alongside your text or programmers editor and a web browser. The web browser displays a formatted version of the specification including icons which can be dragged to Sock to make it open the editor at the corresponding place in the XML specification.

The other outputs from Sock are files formatted as either text, XML or HTML. These are the files you would have written yourself were you not using Sock.

So, Sock actually comes in two parts: an application with an open architecture based on XML which provides an environment to define and execute one or more 'kits' of coding patterns. Then, the kits themselves: you can either write your own or (in the future) obtain them from third parties.

The download contains more documentation about Sock itself and the supplied kits. Some of the latter are overviewed on the Examples page.


Copyright © 2002-2008 Melvaig Technologies Limited