Dynamic Web Development with Seaside

4.2.2Defining Some Methods

Now we define some instance methods to initialize the value of the counter to zero , and to increment or decrement the value of the counter.

While it is not strictly necessary, it can be useful to define categories for methods you add. Middle button click on the all as shown in Figure 35, select "create category" and type in a category name. If you select a method category, new methods will appear in that category.

Create a category

WebCounter>>initialize
super initialize.
count := 0
WebCounter>>increase
count := count + 1
WebCounter>>decrease
count := count - 1

At this point it would be a good idea to commit your changes to the database. Click the commit button in the transcript window. You should always commit any changes to your code before logging out of GemStone, just as you would save a text document in an editor before logging off of your computer. If you want to throw away any code created or modified since your last commit, click the abort button instead.

Copyright © 19 March 2024 Stéphane Ducasse, Lukas Renggli, C. David Shaffer, Rick Zaccone
This book is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 license.

This book is published using Seaside, Magritte and the Pier book publishing engine.