Building Blocks

Building Software Better

Archive for the ‘Java’ Category

Ruby Naming Convention Failure

Posted by Mark on September 4, 2008

Ruby has a strong recommendation against using CamelCase for method and variable names and to use only underscores instead. There are lots of arguments out there on different naming conventions, and whatever side I pick in isolation is fairly irrelevant since either the whole community or the individual team has to chose the best approach.

Posted in Dylan, Java, Ruby, Smalltalk | 3 Comments »

A Taste of Flex (Part 6)

Posted by Mark on September 2, 2008

This is a multi-part series. The first in the series is here.

Tower of Hanoi — With Rule Disks (and no stack)

The first passes at the Tower of Hanoi algorithm were all done with the algorithm being a recursive call on the stack. This is ‘true’ as an algorithm, but comes off as a bit unnatural for humans. But it also has a problem in that the algorithm can not be ‘suspended’ in mid activity unless the language allows a feature (called a continuation) that can suspend the stack itself. For a multi-threaded language, this inability to suspend may not be a problem because you could create one thread for the algorithm and another thread to listen for whenever a new (interesting) change in state occurs. This is how the RubyShoes version works: the algorithm is in a new thread separate from the GUI thread (otherwise things behave badly). Similarly, the Smalltalk-80 GUI is being drawn in a different thread than the main execution thread. But in many circumstances even this multi-thread version would not work: say you have a client-server version (e.g. Rails) or want to pause/suspend the execution of the 100-tall tower of hanoi. And finally, if you only have a single-threaded language like Flex, things just don’t work at all for intermediate renderings unless you can make the algorithm not be dependent on the call stack.

Posted in Flex, Java, Ruby, RubyShoes, Smalltalk | Leave a Comment »

Why dynamic-typing? (3)

Posted by Mark on August 27, 1997

Java Collection

Joern Janneck wrote:
> Mark Fussell wrote:
> > If you need a specific example, consider the [completely randomly
> > selected] JDK 1.2 Collection code of:
> >     public boolean AbstractCollection::removeAll(Collection c) {
[snip]
> >
> > The static-typing problem in this extremely simple code is that 'c' only
> > needs to respond to 'contains', not be a Collection.  This means I can't
> > just use any containment concept I want to (say, remove all people who
> > are 6' tall)
>
> ... which is something that could be defined as a collection, couldn't
> it? at least in a good design, it should be able to.

I don’t think you really mean that. Of the 13 operations for a Collection:

Posted in Dynamic, Java, Smalltalk | Leave a Comment »

Why dynamic-typing? (2)

Posted by Mark on August 27, 1997

Follow on topic “… actually, you could have both, couldn’t you? …”

Posted in Dynamic, Java, Smalltalk | Tagged: | Leave a Comment »

Why dynamic typing?

Posted by Mark on August 27, 1997

Why use dynamic typing for programming languages like Smalltalk, Ruby, etc. and what are the effects of that dynamic typing on application stability. Back in the mid 90s, the emergence of Java ‘opened’ the topic because Java was clearly more dynamic in typing than C++ [primarily through the ‘interface’ mechanism] but not nearly as dynamic as Smalltalk [which was a very active language in some circles at the time]. Now that Ruby has become mainstream as a kind of rebirth of Smalltalk into an updated world, this topic may be interesting again.

Posted in Dynamic, Java, Ruby, Smalltalk | Tagged: | Leave a Comment »

SmallJava-97, The Language

Posted by Mark on August 27, 1997

This document is comparing Smalltalk and Java through an intermediary language, SmallJava. SmallJava will start as the common elements from both Smalltalk and Java. It will then be used to discuss how new properties brought into SmallJava from Smalltalk or Java impact the language. The first item on the agenda is to specify what the base version of SmallJava will look like in both semantics and syntax.

Posted in Dynamic, Java, Smalltalk | Leave a Comment »