Cincom
VisualWorks Tutorial

Web Log Stats Table of Contents

As stated before, the purpose of this tutorial is to teach you VisualWorks Smalltalk by analyzing log files generated by a web server. Some statistics that you will gather include web hits and page counts. It is strongly suggested that you progress through these lessons in order. The workshops/exercises build upon one another. Although the title of the lesson describes the overall topic, many additional concepts are included in the lesson as well.

1

Making Your Mouse Behave
VisualWorks was originally developed nearly 30 years ago on a UNIX system that incorporated a 3-button mouse and still uses that today as its default. If you have a 1-button or 2-button mouse on your system, you will need to know how to make your mouse behave as if it had 3 buttons.

2

Displaying Output
When writing and testing Smalltalk code, we will need a way to verify that the system is behaving the way we expect it to. Although there are many different ways of "seeing what we're doing", this section will demonstrate four basic ways of providing feedback in Smalltalk.

3

Accessing an External File
In order to analyze the web server log files, the very first task at hand would be how to locate an external file and read/view it.

4

Reading External Files and Parsing Strings
Reading in a file and putting the whole thing into an editor won't help us much in our cause to count the number of hits to our site. We need to be able to read in a file line-by-line and extract IP addresses.

5

Starting a Collection
Once you have extracted an IP address from the log file, you will need a place to store it. You will also have to determine if a new IP address is already in your list of stored IP addresses. How are you going to do that?

6

Reading a Directory
Now that we can count web hits for a single file, how about doing that for an entire directory of log files.

7

System Browser 101
Everything you have accomplished so far has been done using existing Smalltalk objects and their methods. All the development has been done in a workspace. However, to really take advantage of the Smalltalk development environment, we need to graduate beyond the workspace and learn how to create your own objects and methods. You'll need more than just a workspace to do that.

8

Saving Your Work
You've worked very hard getting your code to work. Don't lose it. Learn how to save and retrieve your work.

9

Popularity Contest
Which pages on your web site were visited most often? The least often? It's time to add some more functionality to our code.

10

Pulling it all together
We've written the code to find our most popular web pages for a given log file, but it's still code within a workspace. Now that we've created our own class, it's time to move that code from the workspace into methods. Once that is done, it will be easy to determine page counts for a whole directory of log files.

11

Refactoring Your Code
You've noticed some redundancy in your code. Can it be more efficient? Can't some parts of it be re-used? We need to tidy things up.

12

Summary
Congratulations. You've written code in Smalltalk that actually performed something useful. By now, you should have a good foundation of the Smalltalk "basics" and should have witnessed how powerful a language it really is.

13

Primer Index
Just in case you missed any of the "side-bar" primers along the way, here's your chance to view them all in one place.
  Home Page
Return to the VisualWorks Tutorial 1 home page.