Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Discussion 1 - Daniel King
Java for Smalltalk Programmers, by Chris Laffra
This article compares the features and uses of the Java and Smalltalk languages. It also makes some comparisons to C++.
How do these languages differ?
One of the largest differences between Java and Smalltalk is typing. Java requires each variable to be declared with a type, while Smalltalk dynamically assigns types. In Smalltalk, a variable that one stored an integer can later be used to store a string, which is impossible with Java.
Smalltalk development is done in an interactive environment. Everything is done by sending messages to the environment. Unlike Smalltalk, Java code must be compiled one class at a time. Changes can not be made to the code while it is running.
Everything is an object in Smalltalk, but Java has some primitive types.
Smalltalk uses blocks to control flow, while java has special keywords to control flow.
Smalltalk has very little syntax, everything is within libraries. Java has much more complex syntax and keywords.
How does that affect people’s programming?
Since Java requires types to be specified, the compiler can perform type checking, whereas Smalltalk will just give a DoesNotUnderstand message when something is wrong. The specified types also help a reader to understand how the variables are used, since naming is not always sufficient. Though, a disadvantage of requiring typing is that it increases the number of keystrokes and time required for development.
The interactive development environment of Smalltalk allows programmers to be very efficient. Changes can be made as the program is running, instead of compiling every time a change is made in Java.
Primitives in Java can cause problems when Collections are needed. The programmer must use a wrapper class in order to store it in the Collection. Whereas in Smalltalk, everything is already an object and can be stored in a Collection without any further action.
Smalltalk was developed for simplicity and fast development, while Java was development to be cross-platform and internet distributed.
Russel Myers' discussion gives some similarities between Smalltalk and Java, and it also gives one or two other differences. Since Smalltalk doesn't support looping, the programmer is somewhat restricted, unlike with Java. Though there must be some substitute to loops in Smalltalk, the ease of loops in Java makes programming more efficient in certain situations. Java has an extensive API, unlike Smalltalk. But, Smalltalk's easy syntax makes up for that limitation. Java and Smalltalk are similar in several ways, so it would be fairly easy to go from one to the other without having to completely re-learn everything. Each language focuses on a different area, and therefore, is better suited for certain projects.
Links to this Page