Previous | Table of Contents | Next |
Blocks are pieces of Smalltalk code that are portable between methods and classes. A block is compiled in a method within a class, just as with all the other code, but it is not executed when it is encountered. Instead, execution is deferred until the block is sent the message value. For this reason, blocks can be passed as arguments between classes and are an extremely powerful and useful mechanism. The following are some examples of blocks:
The ANSI standard committee has been meeting on the topic of a standard for Smalltalk for some years now, and drafts have come out. Smalltalk programmers have always enjoyed a simple syntax that is portable among all vendors versions of Smalltalk. However much they have in common, though, the class libraries have some differences that can make the moving of the GUI or the external interface code difficult. These differences are being worked on in the committee and might never be completely resolved. It is a tall order to try to make the entire class library compatible, as most other libraries (especially C++ libraries) differ significantly from one vendor to another.
Perhaps the greatest draw for developers is the nicely integrated development environment that Smalltalk offers. From any text pane in the environment, you can type in Smalltalk code, execute it, display the result as a string, or open an interactive inspector of the resulting object.
Smalltalk development environments include many more powerful tools than any other environment the authors have encountered. You cannot only edit the code in the code editor, but you also can do so in the debugger during execution of a program. You can inspect the values of the objects, see the types of classes, change the values, or execute code that modifies the values of an object. You can browse the code class by class and look at the inheritance of a class. You can also find all the senders of a certain method (everywhere that the method is mentioned in source code), all implementors of a certain method (so that the polymorphism of a message can be understood), references to variables, and so on. Another powerful feature is to browse the messages sent in a method (the functions that are referenced in the method) and then see all the other senders or implementors of a message. In this way, you have instant access to plenty of examples of how a method is used, including the code that you are adding to the system, which appears in all the browsers in the system.
With all this code-control power and the banishment of the source code file as the unit of coding, a new way to manage the Smalltalk source code is desirable. Several products have been created; the most popular one is ENVY, which appears in all the IBM Smalltalk and Java professional development products. This development tool allows the management of Smalltalk source code at the finest level of granularity (the method) to be grouped into classes and applications, assigned to users, and organized into subsystems. Standard file-based version-control systems pale in comparison to ENVYs sophistication and ease of use.
Regardless of the technology or language, a specific need might emerge for a development tool. In Smalltalk, this need is easily met through customization of the existing development tools, extensions to those tools, and entirely new tools that share the same interface to the stored source code and compiler. This means that the development tools can be customized to adapt to any process and can be improved by the developers to increase their satisfaction and productivity. One drawback to this is that some developers spend more time monkeying around with the development tools than creating their application code. Some people recommend that a person like this be assigned as the toolsmith to a development effort and be responsible for developing tools to improve the productivity of the whole group. One true test of the addiction of a Smalltalk developer to the language is to query the number of class browsers a developer has written to replace the standard class browser.
Smalltalk offers one of the richest sets of libraries available in any development system. This includes classes and frameworks for GUIs (including many custom and extensible widgets), collections, streams, magnitude, file, database, communications, Web, and distributed applications. These class libraries and frameworks have evolved for many years and they enable an experienced Smalltalk developer to create powerful applications in a fraction of the time that it might take in another language.
Most of the Smalltalk development environments sold today also include a visual programming environment. This environment allows novice Smalltalkers to begin their Smalltalk experience by wiring together parts visually, and it similarly saves the experienced programmer hours of work on building the GUI. Some of these visual programming parts include capabilities to access external databases, communicate with other computers, and create complex Web applications. The visual programming environment can also be extended to include new features, or it can be used to divide work among various groups of developers.
One unique thing about Smalltalk is that you are customizing an already running, debugged, stable, and mature application. All Smalltalk development environments include the necessary components to run as a standalone application. In fact, you add your application logical and user interface, then strip out the development tools, and voiláyou have your running application. This differs from most other programming languages in that time is spent either redoing the basic shell of the application each time a new project is started, or a previous project is gutted for code with which to begin development.
Previous | Table of Contents | Next |