Archive for the ‘smalltalk’ Category

Work on Pharo Smalltalk …

Tuesday, June 8th, 2010

There is a job add for a Smalltalk Developer to work on Pharo here and more here

Below is a rough translation by a friend, for those who don’t French.

INRIA is a Research Institute specializing in science and information technology (ICST) around communication.
It employs 3600 people in research centres spreads across seven regions.
The research centre in Lille (North of France) employs 260 people, spread across a dozen research and research support teams
The RMOD research team specializes in the development of dynamic object languages.

The chosen engineer will work on development and scientific experiments in one of the research teams.
He/she will work on the following: new infrastructure around a new compiler, improving network support, interfacing with C, improving the performance of virtual machines, improving object-runtime, improving code, improving the IDE.

The chosen engineer will participate in development and experimentation in a research team, leading to:
• software development: design, coding, testing, documentation
• participating in writing tutorials
• mailing-list animations (?!);
• integration of bugs (bug fixes?)

Skills and profile
• training in information technology and knowledge of software development and related bug tools (version management, compilation, documentation, testing, debugging,…);
• programming languages: Smalltalk, C;
• good knowledge of a dynamic language and in reflective (?) programming
• fluent technical and scientific English
• good writing skills;
• good-to-have skills: network, system, reflexive kernels

For more information, apply online through http://www.inria.fr/travailler/opportunites/ingenieurs/specialistes.fr.html
For more information on the role, contact stephane.ducasse@inria.fr
For information of an administrative nature, contact magali.lesaffre@inria.fr

Redline Smalltalk: Status …

Friday, April 2nd, 2010

 duke

I have been working on Redline Smalltalk (a Smalltalk for the Java Virtual Machine) for more than 4 months now and it really should be ready for people to try but it isn’t, and this post is to let you know where it is at.

When I started developing Redline Smalltalk I was creating a compiler from scratch and by hand and it was going to be really good. After several failed attempts I came to a realization that the approach I had taken was not going to work, essentially writing a bottom up parser by hand, rather than a top down recursive decent.  I even gave it a few redos and clean slate goes before coming to this conclusion. About the same time I got an offer of some code to help and waited for this to eventuate but I got ants-in-my-pants and wanted stuff happening so I wrote a translator to help Redline on its way. The translator is just about finished, with tests of edge cases the only thing that remains.

My plan now is to translate the Pharo Smalltalk source code into Java source code to form a base Smalltalk runtime, compiled to bytecode using the Java Compiler. This runtime which contains the Pharo Smalltalk Compiler will be modified to output Java Virtual Machine bytecodes rather than Smalltalk Virtual Machine bytecodes.  From here I will be able to keep the Runtime in step with the Pharo sources as well as advances in the Java Compiler and continue forward to make Redline something great.

This is not all talk and below is an example of a method from the Compiler class from the Pharo  sources before and after translation into Java by my translator:

translated-smalltalk-java

Redline is still moving along and I appreciate all the interest and support and I will continue to keep at it until people can write Seaside Web Apps and deploy then with ease on the Java Virtual Machine, and more. Stay tuned for an announcement of the availability of the Redline Smalltalk Runtime.

A Fan Letter to Redline Smalltalk …

Saturday, January 30th, 2010

crowd

I was inspired by this post by Kent Beck to write a fan letter to Redline Smalltalk, written in the voice of a deliriously satisfied user. This is an excellent way of articulating a vision.

Dear Redline Smalltalk,

I have been using Redline Smalltalk at work and in personal projects for a while now and I just had to let you know what a joy it is to use and how productive I am with it.

My work situation means I have to work on the Java Virtual Machine and I have been looking at alternatives to Java so I could be as productive as possible and stay away from those little Java annoyances and hurdles that slow me down. Having a background in Smalltalk I jumped at the chance to put your Redline Smalltalk through its paces and I have to say I couldn’t tell the difference between your Smalltalk and the others, in fact I think yours was a little faster.

At home I like to use IntelliJ and your plug-in support in the IDE is brilliant, the mix of old style Smalltalk-80 browser, refactoring and file based support is smooth and complete and just what I needed, especially the source level debugging and profiling which I could not live without.  At work we use Eclipse and I can’t tell the difference between the plug-ins so now I’m getting a few other developers to try it, and I think I made some converts.

One developer at work, Steve, keeps banging on about how Ruby On Rails is this and how Ruby On Rails is that, how we need rspec, gem, rake, and how awesome it is to script things and try stuff out with irb. You should have seen his jaw drop when I showed him how I can do all that in Redline and how quickly I could create, test and deploy my Seaside Web App and then push changes to different environments with a simple commit, even while they were running. You really did think of everything to make things complete and integrated with Smalltalk everywhere.

I wondered what you could add in the next release and I just can’t think of anything but if I do, Ill be sure to let you know.

Thanks for a wonderful product that has really changed the way I work and made it fun again.

Regards,

John Q. Geek.

Ruby Best Practice Patterns by Kent Beck …

Wednesday, December 23rd, 2009

 bees

I have not written a post for a while as I have been very busy working, developing Redline Smalltalk and looking after my twin boys. Recently I did get some free time and I needed a break from Redline Smalltalk and I picked up a book by Kent Beck from the top of my pile of books to be read. Yes there is a pile and there are about six books in it right now, there is even another Kent Beck book, which should not be a surprise to anyone as Kent is a great mind and his writing is worth your time.

The Kent Beck book I read was “Smalltalk Best Practice Patterns” and while you may think “what the! Isn’t this posts title about Ruby?” what I want to get across is that this book transcends a specific language and is applicable to any Object Oriented language and to anyone wanting to get a good grounding in “Best” practice and patterns of development. Having done Smalltalk, Ruby, Java and C++ I can see how each and every nugget can be applied. So regardless of your language choice you should choose to get this book.

sbpp-book

So what does “Smalltalk Best Practice Patterns” have in it?

SBPP is a quick and easy read and it took me about 16 hours to finish it, but of course I am still thinking about the material in the book and how best to apply it. There are 92 specific items covered and a very good real world example and discussion of why. The real world, every day nature of the book makes it a must have, each section has the following elements:

  • Title
  • Preceding Patterns
  • Problem
  • Forces
  • Solution
  • Discussion
  • Following Patterns

The appendix having a reference to each point making it great to have near by.  The book contains the following sections and topics:

  • Introduction
  • Patterns
  • Behavior
    Methods
    Message
  • State
    Instance Variables
    Temporary Variables
  • Collections
    Classes
    Collection Protocol
    Collection Idioms
  • Classes
  • Formatting
  • Development Example
  • Appendix A:  Quick Reference

Being a big fan of immutable Objects I especially enjoyed the section on “Getting Method”. If you only adopt one thing from this book I hope it is about private getting methods, sometimes called “getters” or “accessors”. It is hard to stress how much better a large amount of software would be if it adopted this practice. This is how Kent puts it:

“Here’s the real secret of writing good Getting Methods - make them private at first. I cannot stress this enough.” and goes on to say “There are cases where you will publish the existence of Getting Methods for use in the outside world. You should make a conscious decision to do this after considering all the alternatives. It is preferable to give an object more responsibility, rather than have it act like a data structure.”

One comment from a reader, Kyle Brown is “The patterns in this book are absolutely fundamental to good Smalltalk programming. No one who calls himself a Smalltalk programmer should be without the knowledge in this book” and I would go so far as to say that no one who calls themselves an Object Oriented developer should be without the knowledge in this book.

SmalltalkJVM: From dream to …

Sunday, August 23rd, 2009

 stduke*

My Smalltalk for the Java Virtual Machine is progressing and while I’m not in the home stretch yet I can see the turn that leads to that stretch ! When I reach that turn I’ll open up the github account for people to download the project.

So what is this Smalltalk for the JVM going to do:

  1. Provide a Smalltalk-80 implementation that compiles to bytecode
  2. Provide a command line interactive environment like IRB or Lisp REPL
  3. Provide debug support (breakpoints etc)
  4. Provide generators for converting Smalltalk-80 to other languages, like Ruby, Python and Javascript, and to target other VM’s like LLVM and Parrot.
  5. Provide build tools and libraries to get things done (like rspec, rake, roodi, stunit etc).
  6. Provide a port/implementation of Seaside !
  7. Provide tools for bundling your code for deployment to J2EE containers.

If you would like to know more then please drop me a line or follow smalltalkjvm on twitter.

*This image which I’m calling Saint Duke (ST Duke) was done by Tim Cuthbertson, who is not only a talented developer, but a juggler and a 3D artist.

TDD: Where to start ?

Saturday, August 8th, 2009

birds-eye *

When I do Test Driven Development and I have the choice of doing it how I like then I start from the Top-Down. I choose Top-Down because it keeps me focused on the goal and what the Business/User wants. With Top-Down I go down fewer rabbit holes looking for an elusive bug or wrestling with a tricky implementation.

I start by writing down what it is I am building and what tests must pass before I accept the work as done. For example, I am working on a Smalltalk compiler for the Java Virtual Machine and one of the deliverables is the compiler, so this is how I started the acceptance tests:

The compiler will be done when …

  • Compiling Statements made up of a single Expression
  • Compiling Methods with a Message Pattern followed by Statements

I try to write all the criteria down before starting any implementation. I do this so I can prioritize and see the scope of what I am doing. I then convert these sentences into the syntax of the language I am developing in, sometimes this makes the test method names more uniform but I try not to loose important information:

compilingStatementsWithAnExpression()
compilingMethodsWithMessagePatternAndTemporariesAndStatements()

The next and probably most important step is writing the line of code that will prove or disprove that the criteria has been met. I write this before any implementation. If I can’t form a hypothesis in code before writing implementation code then I’m usually not sure of what I am doing and I should step back and become sure with a spike. I follow the same process of writing the verification or assert statement in English and converting it to the target language.  Here are the verification steps for the above tests, assuming the use of the Java Mockito Testing framework (in my case the compiler is done when it can call the code generator with a valid abstract syntax tree):

verify(generate).receive(statementWith(expression()))
verify(generate).receive(methodWith(messagePattern(), temporaries(), statements()))

I use the features of the language or the testing framework to facilitate code that is descriptive, even if this means a little more work since the test also serves as documentation. In my case I can tick off each test against the Smalltalk grammar shown in the back of the book Smalltalk-80: The Language and its Implementation.

When I have all the tests ready I sometimes comment out all but the one I want to implement first and make a start on implementing it.  Commenting out the others means I won’t get swamped and disheartened by a flood of red-bars (failing tests). As I implement each test I leave it uncommented and move onto the next test. Eventually all the code is uncommented and passing (green-bar).

The test I implement first is driven by the Business as it is typically the feature they want first or the one that shows them or me the most important information to make decisions on moving forward.

When implementing I fake-it-until-i-make it, that is, I hard code the results output from the code under test to ensure the test passes, then I go back an remove the hard coding and implement the real logic. I do this because it provides an opportunity to see more of the requirements to get the test to pass and an opportunity to see the test is correct. There have been a few times when the test was incorrect and passing and therefore the code was not correct and I was none the wiser.  Not happy times.  While using fakes I output a message to let me know a fake is in use, so I remember to remove them all.

The above approach is the one that works best for me and I suggest you try it as I find it yields less code overall.

ADDENDUM:

I received some feedback that suggested I may not be following the failing-test-implement-pass-refactor’ cycle and the approach I use does, as I start with a test that fails because I have not yet faked it. I then implement the fake and the test passes. I then continue to fake more tests to show two important things, 1. The tests work and, 2. The commonality in tests and the potential implementation. At some point in the process I will have no fake code at all and the actual implementation will have been done after a failing test. I have seen the false-positives scenario too many times so I stop and test the test just a little more. YMMV

*  The image used here is by Cannboys and you can see his portfolio here: http://www.istockphoto.com/cannboys

A Quick Trip To Seaside …

Thursday, May 14th, 2009

 seaside-cover

I recently got a copy of the book An Introduction to Seaside so I went for a quick trip to Seaside over the last week and it was refreshing and fun.  Seaside is a Web Application development framework for Smalltalk and the book is a well paced introduction to all you need to know to start writing Web Apps in Smalltalk.

An Introduction to Seaside was not available at Amazon so I ordered it through www.lulu.com, and received it in about 6 working days. The book is reminiscent of the original Smalltalk series of books complete with half tone boxes containing useful code (see image) which brought back lots of memories for me. The flow of the book is well structured and the links and references are very useful, like where to download a copy of Smalltalk for your platform, complete with a working set of Seaside libraries. I chose the Squeak download since most of the examples that detailed what to do in a Smalltalk environment target Squeak.

seaside-snipit

Some of the grammar in the book was a little wrong and I felt that the book could have been translated from another language into English, but none of the instances detracted from the introduction and instruction.

The book takes you through the development of a ToDo application which is a simple task but one that touches on all the things you may wish to do with a Web App these days, like security, persistence and Ajax support. I would have liked to see more information on testing but there are some solid links to the Smalltalk test frameworks.

Seaside itself is fantastic and I enjoyed working with it more than any other framework I have used so far for Web development, even those like Rails and GWT. The use of a ‘continuations’ approach to the web conversation and the real object oriented focus which you come to expect from Smalltalkers makes it a pleasure and *very* productive. If I had time I’d port it to other languages as a community service, since everyone should be able to develop Web Apps with this simplicity and productivity.

Should you want to know more then I encourage you to read A Quick Trip To ObjectLand to quickly understand Smalltalk and An Introduction to Seaside to understand Seaside. Give it a try, you won’t regret it.

A Big Dream For Smalltalk …

Saturday, April 11th, 2009

byte-cover

I have a dream of a new Smalltalk!

I first read about Smalltalk in the 1981 issue of Byte magazine when I was in high school but it was not until 1986 that I got to use it commercially. I loved it instantly and I know you would too if you gave it a go.  You can get a quick overview of Smalltalk from here: http://www.outbacksoftware.com/smalltalk/smalltalk.html and there are plenty of Smalltalks for you to download and try.

My dream is for Smalltalk to make a comeback and be available on the Java Virtual Machine (which incidentally owes a lot to Smalltalk). This is what I would like in that Smalltalk:

  • A file based environment since this is what people are used to.
  • A transcript / console you can run interactively from the command line / shell (like Lisp, Ruby and Python etc).
  • A Web Development framework based heavily on Rails, since this is a leading framework and one that a lot of people are interested in. Sorry Seaside as you are great but sadly not great enough.
  • An ORM framework like ActiveRecord. (EDIT: Apparently this is already available.)
  • IDE support for Eclipse, IntelliJ and TextMate.

I want all this on top of the Java Virtual Machine because this is the only approach that appears likely to make it in the Enterprise where things that don’t run on the JVM are shunned. I have had many people say that a Smalltalk on the JVM would be slow but lets face it, there isn’t anything on the JVM that isn’t slow so this isn’t a good excuse to me.

Why not just use JRuby? I am and I like it but Smalltalk has a simplicity and a pedigree that appeals to me more and I think if you tried it you would like it.

Would you support my dream and show support by following my request page on twitter which I hope to show to those at Sun and Cincom who might be able to make this dream a reality ?

Software Preservation Group …

Friday, June 22nd, 2007

It seems like only today I sent a rant to James Robertson of Cincom asking why Smalltalk isn’t in wider use, especially here in Australia when I came across this site that took me down memory lane. Ah, those were the days.

Software Preservation Group -  C++ - LISP

But no Smalltalk yet. Ah, time to dig out the Smalltalk/V 286 disks !

Why Ruby ?

Saturday, May 26th, 2007

A lot of people I have worked with, admire and respect have turned to using Ruby. I don’t find this a big surprise, after all, we like to get our applications out and used and Ruby is great at helping to do that. There are even some funny spoofs on the Apple advertisments about Ruby vs other approaches.

Why are people moving to Ruby?

As Paul Graham says in ANSI Common Lisp, “Progamming languages teach you not to want what they cannot provide. You think in a language to write programs in it, and it’s hard to want something you can’t describe.” and Ruby provides a lot out of the box and the flexibility to think and do things in different ways.

I asked a Ruby convert why he isn’t using Smalltalk (which he knows very well) and he said because it lacked the invigorated community that is behind Ruby.

I asked a Ruby convert why he isn’t using Java anymore and he said because he had too many hoops to go through before he got started on the code that mattered.

I really like Ruby, although I have to own up to not having written a full application in it. I’m becoming more interested in it as the “smart” people I know are using it and that says a lot to me.

So I’m off to introductory training on Ruby to get to know more. However, this doesn’t mean I have given up on my favorite languages, Lisp and Smalltalk, since these are as expressive if not more so than Ruby; they have just lost their sparkle, for now.

Here is a screen cast of adding a new control structure to Smalltalk as an example of expressive flexibility in a language.