Observations on the development process

When using other scripting languages for server scripting, the result has been a file (sometimes large), but generally a single file.

I'm finding I now do things differently and I think better in GST. So here is the process now:-

  • Break the task into pieces which seem like objects (an Object manages its own data. If in doubt I just pick a chunk of work which seems autonomous and start there)
  • Make a class for the task, and then write at least one test method for the class. So in my FooBar class, there'll be a method something like:-
    test [
           | fooBar |
           fooBar := FooBar new.
           fooBar doItsThing ] 

  • Once I've got some classes and I'm ready to join them together, they can all be put in the same file, or often it is convenient to have them in separate files and call them like so:
    gst Class1.st Class2.st -f Mainline.st parameter1 parameter2


  • The benefits of this approach are:-
    1. I'm not scrolling through a single huge file, where it is easy to get lost or edit the wrong opening/closing bracket
    2. Having a class in a file makes it easy to work in tandem with gst-blox and file out a class then use it
    3. Libraries. For instance I have an SMTPHelper class. I can treat this as a Library and add it to any scripting app this way (no more cut and paste the same code into every script).
    4. More modular: in a single file monolithic script, the bigger it is, the harder it is to test individual pieces. In GST, if I've got an issue, I can usually just write some more tests for a class and test in isolation or in tandem. There is choice.

User login