Creating Packages, Classes and testing (Smalltalk)
To learn how to use the developer environment tools for Cincom Visualworks 9.0, I'll be going through each of the Cincom Smalltalk Product Tutorials and keeping notes along the way.
I'm currently on the third tutorial, which shows us how to create packages, create c/asses and test your Smalltalk code. Here are my notes for the video tutorial.
Notes
- Before we create a new class, we want to first create a package to keep it in. You can do this by clicking on the 'package' button in the toolbar and entering the name of your new package (PascalCase).
- To create a new class, we click on the package we want our class to belong to, right click on the classes pane for that packafe, and then we pick the 'New Class' option.
- Once we have clicked on the 'New Class' option, a little menu will pop-up showing the Package the class belongs to, the Namespace (Smalltalk), the name of the class (which you enter), it's superclass if it has one (Object by default), instance variables (which you add as a space seperated list) and whether or not you want to create methods for the class (Accessors, initializer and/or Subclass responsibilities).
- Once you create a class for the first time, there will be a warning next to the comment tab above the class code window, to indicate that the class hasn't yet been commented to explain what it is, does, and how to use it.
Example Class
Smalltalk defineClass: #Person
superclass: #{Core.Object}
indexedType: #none
private: false
instanceVariableNames: 'name address'
classInstanceVariableNames: ''
imports: ''
category: ''