- About Scala
- In the Enterprise
- Scala Community
- Language Research
- In the Press
- The Scala Team
- Scala's Prehistory
- Contact Us
- Learning Scala
- Tour of Scala
- Scala API
- Setup & Getting Started
- Programming Guides
- Other Guides
- Code Examples
- Scala Developers
Scala is Child's Play
Created by bagwell on 2011-08-22. Updated: 2011-08-25, 12:10
About 18 months ago we discovered Lalit Pant, the creator of Kojo, working as a volunteer Math teacher in the Himalayan mountain region of India at Himjyoti, a school for under priviledged girls. He's still there, and is thoroughly enjoying teaching and working on Kojo. In this interview he tells us about how Kojo came to be developed, the challenges that he has faced, and his experiences with how kids have interacted with Kojo and Scala.
From a professional developers point of view, Kojo also offers a robust, enjoyable environment for learning, presenting and hacking in Scala too. Lalit has created something that is really appealing to 'kids' of all ages!
Some people may not have come across Kojo. How would you describe it?
Kojo is a Scala based learning environment where kids learn computer programming as well as practicing logical and creative thinking. They get to play with Math, Science, Art, and Music in an interactive hands-on way.
One way to understand it is to see Kojo in action during a lesson I gave at DCV College in California, to Dave Briccetti's summer class. Playing with it yourself is even better. It's easy to download and install.
Why did you develop Kojo?
While teaching Math to the kids at Himjyoti school, I found that the standard approach to teaching Math was dry, very abstract and not much fun for the kids. Key elements were missing. Interactivity, feedback and the ability for each one to learn at their own pace. I was in a unique position to do something about it, being a Math teacher who also loved computer programming. I decided to create an environment where learning could be fun, self paced and feedback oriented. Kojo was born.
How did you come to choose Scala for Kojo?
It was an easy decision!
For me, programming is fun. I started with C, then moved to C++, and then Java. Along the way I also worked with Prolog, Ruby, and Python. My main language between 1995 and 2007 was Java, but when generics came along, I started to see the writing on the wall for my time with Java. Generics just did not seem to fit in naturally with the rest of Java. There were a lot of edge cases, and generic code was cumbersome. A line that created a HashMap and stored it in a variable could easily be 120 columns wide!.
I was frustrated with Java and was looking for an alternative. Then I found Scala. With Scala, things seemed nice and clean and elegant. Generics worked! And best of all, I saw a lot of scope to expand my knowledge of programming be it traditional OO, functional or modern computer science. Scala seemed like the future and the place I wanted to be.
By the time I started working on Kojo I had been using Scala for more than a year. One of my early Scala projects was Jiva, a Genetic Algorithms toolkit. So the decision to use Scala for Kojo's development was easy. Next I had to pick a language for kids to use inside Kojo. Here too Scala seemed to be a good fit. It's a language with a low entry floor for beginners and a high ceiling for them to grow. In practice kids have found it easy to just start programming in Scala and use just the features they need. There's a lot of room for the bright students to go as far as they like.
Finally, making Scala the user-level language within Kojo also meant that I too would have a great Scala REPL to work with during my development activities!
How has it worked out? Has Scala been OK for the students?
Pretty well. Over the past year and a half multiple batches of girls at Himjyoti School have been learning Math with me on Kojo, each group for about 3-4 months. We first focus on the core Turtle commands, skipping any formal language training. The girls get to think of Kojo as an environment where they can control a turtle. They become familiar with a few basic commands, and then they just code. They create art, they solve puzzles, they do some geometry based sketches, they compose music. At the end of the day, they have used the computer as a tool to play with ideas, and practice logical and creative thinking. They learn about the programming language naturally.
The most recent group of girls that have been with me for over six months now have progressed well beyond the turtles-only point. They wanted to start writing Kojo stories. These are the tutorial or teaching worksheets that students follow while using Kojo. They too are written in Scala. I was very curious to see how things would go. We had to slow down and really think more about the structure of the Scala programs that we were creating, but a few simple concepts went a long way.
I re-enforced the notion that a program is a sequence of instructions, where each instruction is either a command, an expression, or a keyword instruction. We had discussions about each of these ideas. Then we took a simple story, and dissected it according to our framework for understanding programs. Kojo stories are presented in a 'browser' window so I needed to introduce them to HTML and the five or six basic tags that they would be using within their stories. They quickly picked up how to use Kojo code completion and code templates to make writing story code really easy. Then I set them off to write their own simple stories.
They got it!
Some picked things up quicker than others. But very soon, all of them were writing their own stories. They were trying out ideas, making mistakes and correcting them. Within a few weeks some of them were almost as good as I was! Some sample stories written by the kids are available here.
The girls are tremendously enthusiastic about Kojo. When the summer vacation arrived they pestered me to make them Kojo CDs to take back to their villages, so that they could install and continue to use it at their village school.
How did you come to be teaching in India? What did you do before that?
I spent the first six years of my career as a software engineer in India, most of them at TCS. I then worked in the US for around 11 years. The first few were with a startup in Pittsburgh, doing AI work in the area of agent technology. While there, I got to write a Prolog interpreter in Java, and to integrate it with Jess – to create the (forward-backward chaining) core of the agents that we were developing. Then I moved to Dallas, where I worked for many years at Sterling Commerce. The time there was intense – I shipped a couple of products as the sole developer, and was tech-lead for several more. I spent a year at Valtech, doing really interesting work using agile methodologies.
But I was getting steadily dissatisfied with where my life was going. I had lots of great experience and there was stuff inside me that I just wanted to get out. You know what it is like, day-to-day life was just too hectic. Things needed to change.
My wife and I started seriously planning to move back to India. We would be close to our families and the cost of living was such that we could survive nicely without needing a regular salary. There I would have time to do more exciting things.
A little while after arriving in India I started teaching at Himjyoti school. It was a super experience; working with the under-privileged, but very bright girls was tremendously satisfying and rewarding. I found I really enjoyed teaching!
How did the idea of Kojo evolve?
Right from the beginning, I had a strong feeling that learning (turtle) programming would help kids to do Math by encouraging the right kind of thinking. Math and programming both require similar modes of thought. In Math, you start with an axiom, and proceed towards proving something using a few well known rules or laws; in the turtle world, you start with an initially clear screen, and proceed towards a final picture by using a few well known commands. In both cases the activities involve the construction of a logical sequence of steps to get from one state to another.
Later, I discovered that I was in great company with this idea! Donald Knuth, in the preface of his book – The Art of Computer Programming, Vol 1, also brings up the same analogy – that constructing proofs from axioms is very similar to constructing programs from instructions.
The early version of Kojo was designed to supported Math by allowing kids to write programs about Math. For example, they could create a command to draw regular polygons. Or they might write a function to calculate all the prime factors of a given number. They could also interactively play with Math inside Kojo's Mathworld which is based on the wonderful GeoGebra, an open source Maths teaching project.
Over time, other features were added to Kojo to provide an even more stimulating environment.
- The Staging module for 2D graphics, animations, and games.
- Support for music – both computer generated and pre-recorded (mp3).
- Support for interactive presentations via the Storyteller module.
Storyteller led to an increased excitement for Math. It enables the kids to write stories about Math using the fun features provided by Turtleworld, Staging, and Mathworld to animate the ideas that they were describing. It also allowed Kids to access stories written by professionals who now had the tools to provide stimulating explanations of concepts that encourage kids to practice Math topics.
As a Java developer, what was it like to learn Scala?
Coming from a Java development background, a lot of the environment and the OO concepts were very familiar. So getting started was easy. The fact that Scala was much more OO than Java, in terms of purity (everything is an object) and additional features (traits, implicits, type-constructor-polymorphism, etc), was a pleasure to work with. Best of all, type inference within Scala meant that Scala code was much more concise and elegant looking than equivalent Java code.
Soon I started delving into the functional features of Scala, the way these co-exist with the OO features. This was and continues to be a mind expanding experience.
What do you have to say to Java or any other Programmers who are considering using Scala?
Make the Jump! You'll never regret it; and even if you continue to use Java in your day job, learning Scala will make you a better Java programmer.
Getting started is easy. You'll need a few days to get used to the new syntax, class, method, and val/var definitions and so on. Within a week you'll be as productive with Scala as you were with Java. Another week or two, and you'll be using the Scala collections, and reaping some of the benefits of functional programming (using things called higher order functions). Your productivity will have gone up substantially and from here on, you can take your time and dig into the deeper aspects of Scala when you need them.
Using pre-written libraries in Scala is super easy. Things get complex when you want to start writing your own libraries and DSL's (or start reading the code of existing ones). That's when you come across hairy stuff involving implicits, higher kinded types, and typeclass patterns, etc. But you can get to this level at your own pace.
The one area in Scala where the complexity peeks through, even for beginners, is the compiler error messages. But it's far less of a hindrance than you might expect. At the simplest level, you can choose to just ignore the text of the message. As long as your programming environment tells you which line the error is on, you'll generally be able to tell what's wrong just by looking at your code (and the kids that I teach do just that). You can also start to analyse and comprehend the text of these messages which will lead you into a deeper understanding of the language.
Kojo is a great environment for getting started with Scala. It's one download and you don't need to worry about getting the Scala distribution, and a plug-in for you IDE etc. You get Kojo, install it, and you're up and running with Scala along with syntax highlighting and code completion, and engaging graphics to play and try out. And now there's a nice interactive Scala tutorial there too.
What were the main challenges that you faced while creating Kojo?
The big initial challenge was that my development and runtime environments were in flux. I was using nightly builds of Netbeans 6.8, the Netbeans Scala plugin (written by Caoyuan Deng), and Scala 2.8. I would do an update, and things would just blow up. It could take a day or two to chase things down and get stuff running again. Now, of course, all of the component parts have stabilized, and things are much easier.
Kojo is great for developers who would like to make a difference. For example,Peter Lewering from Sweden contributed the Staging module for 2D graphics that was inspired by Processing. Peter showed up and took some work I'd started to a whole new level in a couple of months.
Adding capabilities to Kojo to support the different student levels is an on-going challenge. The kids can write programs for some of this. For example, for Maths they might create a command to draw regular polygons or write a function to calculate all the prime factors of a given number.
I and other programmers add capability, too. Kids can also play interactively with Math inside Mathworld which comes thanks to the integration of GeoGebra, a wonderful maths exploration environment in Kojo.
Lots to do. I'm focusing on writing more Math stories for kids from grade 5 upwards. These will be curriculum oriented, explaining essential concepts through text and animations and providing practice exercises, with answer animations available at the click of a button. Any and all help to create course material is very welcome!
We're also starting a learning center here in Dehradun, where more kids will be learning Math and computer programming with Kojo.
Enhancements for Kojo are in the pipeline:
- Sprite collision detection.
- Making Kojo run on the web (as an applet or web-start application). One great use of this feature will be to allow kids to look at Math stories right on the web, without needing to download Kojo first.
- Better code completion.
- Live documentation (to accompany code completion).
- More documentation in the form of stories, wiki pages etc.
Contributers are very welcome. Share your ideas with us by starting a forum thread http://wiki.kogics.net/forum:start or email me, pant.lalit at gmail.com. We need more developers who can think like an eleven year old!