Sending Smalltalk Objects Through Socket Connections

myst

In the image above:

  • on the left is a MySmalltalk desktop application
  • in the center is MySmalltalk in a Chrome browser
  • on the right is MySmalltalk in a Safari browser

The three different instances are communicating through real-time socket connections.

In the example above, I am sending Smalltalk block objects through the socket connections – the blocks are then evaluated when they are received.

The block that I sent for the test was:

[100 timesRepeat: [:x | (x * x) prn]. TicTacToeWindow open]

The block was sent from the desktop application and was executed in both browser windows almost immediately,

This is now available online at the main site: http://mysmalltalk.com.

1) open a workspace (right click on desktop for context menu).

2) X := Socket blockTest

3) X send: [‘Hello world’ prn]

You need to open separate browser windows, not tabs, for testing.

Sockets can now support channels (Socket.io namespaces) and I will be adding “rooms” in the next few days.

The socket communication system works across all instances of MySmalltalk – mobile, browser, and desktop applications.

There will be some user created online games available over the coming weeks.


Loading User Libraries

myst

Image above shows loading CalmoPuzzle

The MySmalltalk site now is capable of hosting user-owned libraries.

Over the next several days, I will be adding application management features as well to allow user-owned deployable applications from the site.

User libraries are owned by a single user but can be downloaded and shared in any web browser or desktop version of MySmalltalk.


User Library Browser

myst

Image above shows a simple user library browser.

On the server, I have added the ability to store “public user libraries”.

A public user library is owned by a single user but can be accessed by anyone on the site.

This will be mainly used for sharing class libraries (tools, games, etc) and documentation.

Also, I have added various additional Smalltalk methods to the Array, OrderedCollection, and Server classes. In particular, the “select:” and “collect:” methods for collections are very useful in transforming server data into building tables for browsing.

Yesterday, I managed to get Socket.io working with channels and rooms. So, by next week we may be able to set up some online games and chat windows.

Finally, I have added a bit more functionality to the HTML5 “Canvas” widget for graphics.

Since everything is an object (this is Smalltalk after all), it should be very easy to combine graphics, instant messaging with objects, and the various UI widgets into some interesting user experiences.


Styling and Context Menus

mysmalltalk

Above is an image showing two instances of MySmalltalk running side-by-side.

On the left is MySmalltalk running as a Chrome desktop application which was loaded from the local file system. On the right is MySmalltalk running in a Safari browser and was loaded from the MySmalltalk.com site. Both are running the exact same Smalltalk code.

In the past few days, there have been several updates:

  • the server now supports user login and registration
  • the server now support images owned by users
  • widgets can now be styled (desktop background above as an example)
  • widgets can now have context menus

The latest desktop version can be downloaded here:

https://s3.amazonaws.com/mysmalltalk/desktop/myst-latest.zip

This is the roadmap for the next couple of weeks:

  1. support for multiple images owned/shared by users
  2. real-time messaging (sending objects) using Socket.io
  3. mobile widgets and applications
  4. HTML editor

I will enable registration on the server later this week.


User Accounts

I have been working the past couple of days on adding user accounts to the server.

This will allow users to store custom images and applications under their own accounts.

Should be available online early next week.


New Widgets

myst

These are some new Qooxdoo widgets that are now available in MySmalltalk.

The “Canvas” widget encapsulates HTML5 canvas capabilities for drawing graphics.

https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API

The “Table” widget displays tabular information with selectable rows and columns.

http://mysmalltalk.com/


The Potential for Smalltalk on the Web

I remember when Smalltalk was popular.

My introduction to Smalltalk was in 1987 when I purchased Smalltalk/V from Digitalk.

By 1989, I had won a contract to build a graphical flight planning system running on an HP/9000 Unix machine with Parcplace VisualWorks and “The Analyst” package from Xerox (XSIS).

In the early 1990’s, Smalltalk was very popular with high-tech companies.

Of course, there was the high productivity and ease of prototyping.

But also a very important reason was the cross-platform capability. Companies often had many different kinds of computers:

  • HP/9000 Unix
  • IBM Unix
  • Sun Solaris Unix
  • Silicon Graphics Unix
  • Apple MacIntosh
  • Microsoft Windows (several versions)
  • And Smalltalk ran on all of them with no changes (almost) to the image.

Then the Smalltalk “dark ages” started around 1995/96.

There are lots of reasons, of course, but one of the main causes that I saw was that companies exchanged their expensive Unix machines for increasingly capable (and much cheaper) Windows NT machines and/or Apple Macintosh after Steve Jobs converted it to Unix.

The new cross-platform wonder-kid was Java which was free. And Smalltalk pretty much went into free-fall after that with a few bright spots like Dolphin, Squeak and Pharo.

So, what about today.

Like many developers, I earn my living building web applications.

Today, there is now a mish-mash of different technologies on the web, just like desktop workstations 20 years ago.

  • multiple browsers (Chrome, Safari, Firefox, IE)
  • multiple mobile technologies (Android, Ios, Windows phone)
  • multiple desktop systems (Mac, Linux, Windows)

Of course, you can build apps using a cross-platform technology such as HTML5. Which means that you must be proficient in three different client-side languages:

  • HTML
  • CSS
  • JavaScript

And a some server-side technologies as well:

  • PHP/Laravel/CodeIgniter/etc
  • Ruby/Rails/Sinatra/etc
  • Python/Django/etc
  • NodeJs/Express/etc

Nothing like the simplicity of building and deploying Smalltalk applications.

MySmalltalk is my attempt to bring back simplicity for application development in today’s hybrid environment (desktop/mobile/website/server).

A huge development in the past few years has been the explosion of “Smart Phone” use.

There are projected to be 2 billion (2,000,000,000) smartphone users worldwide by next year.

http://www.emarketer.com/Article/2-Billion-Consumers-Worldwide-Smartphones-by-2016/1011694

Amazing!

Steve Jobs said that the iPhone would change everything and he was right.

So where does MySmalltalk fit it.

  • runs on any desktop (Mac, Linux, Windows)
  • runs in any website
  • runs in any mobile device
  • runs in any Node.js server

MySmalltalk is an interpreter, so it can run (and compile new code) even in environments where security prohibits the use of JavaScript “eval” and “new Function(<code>)”.

Chrome desktop applications have these kind of restrictions. Possibly MySmalltak is the only Chrome desktop development environment where code can be compiled completely within the environment – as opposed to writing out files and then compiling them externally.

And Myst apps can be developed on the desktop and deployed to any other desktop, website, or mobile device.

The framework is still very young (I started on March 3, 2015), but it is progressing very quickly and I believe that it will prove to be a very productive new environment.


Developing and Deploying Applications

myst-applications

The image above shows the Myst application launcher.

No language or framework will become popular unless it can produce applications that people want to use and are willing to purchase.

My focus in developing MySmalltalk is to create non-trivial applications as early as possible. This tests the limits of the language and builds the foundation libraries needed to compete with existing frameworks such as Angular.js, Bootstrap, Backbone.js, and so on.

MySmalltalk is built using the Qooxdoo.org framework which is amazingly good.

As I build tools and applications, I add the Smalltalk bindings to Qooxdoo needed to perform certain tasks.

An example would be the StyleManager and HtmlWriter classes which were created yesterday and are being used today to create the Applications window and the Welcome window on the site.

Today, I also added a new tool called ImageManager which helps me with deploying the Myst image to a local server or to the MySmalltalk.com site.

myst-image-manager

Development and deployment with MySmalltalk is incredibly quick.

Just create a new Smalltalk class using the desktop version, test it on the local server, and then deploy to the main server.

All of this is done while remaining totally in the Smalltalk environment,

The class library is very, very limited at the moment. This will improve as I add better refactoring capabilities to the class browser and add various tools such as inspectors.

The download for the desktop version will be updated about once per day. When everything is a bit more stable, I will upload it to the Google Play store as a Chrome application. That should make installation a lot easier.


MySmalltalk Classes for HTML and CSS

HTML and CSS classes

HTML and CSS classes

Two new classes have been added to the MySmalltalk image:

  • HmtlWriter generates structured HTML tags
  • StyleManager dynamically inserts/modifies CSS rules into the web page

Together, these new classes allow me to create documentation pages for the mysmaltalk.com website.

I work with the desktop version of MySmalltalk to create the new content and then I deploy the image to the remote server.

In the classic Smalltalk tradition, MySmalltalk is being used to develop its own tools needed for deployment and maintenance.

MySmalltalk is not just a language – it is a complete development and deployment ecosystem which works across multiple desktop, website, mobile, and server environments.


The Qooxdoo Framework is Fantastic!

Originally, I had intended to base MySmalltalk on the ExtJS framework.

But the marketing experts at Sencha decided to set licensing conditions that make it impossible for developers like me to use their product.

So, I started searching for an alternative framework and discovered Qooxdoo which is fantastic!

MySmalltalk is 100% based on Qooxdoo.

The main modification that I made to the framework was to add a new property called “klass” at the qx.core.Object level. The purpose of “klass” is to hold a reference to a Smalltalk class – so any Qx object can also act as a Smalltalk object if the “klass” property is set.

Also, I made some changes at other parts of the framework to replace all “eval(…)” and “new Function(…)” expressions with alternative functions. This was required to meet the security requirements for Chrome desktop apps.

I will contribute these changes to the Qooxdoo community after some cleanup and documentation.