Every week or two we spread the word of Node.js and the cool and incredible things it can do. We do that by profiling creative, interesting and fun uses of Node.js in various products and projects. We call it “In the Loop.”
This time around, we focus on Jean-Clause Levy’s Chocolate. Chocolate is a simple webapp framework built on Node.js using Coffeescript.
In the 1980s Jean-Claude Levy brought “Tennis Championship” and Broderbund Software’s “Showoff” to Apple and the legendary action-adventure game “Prince of Persia” to Atari. He earned an M.S. in Computer Science at the Florida Institute of Technology in 1988. In 1991, he followed Steve Jobs adventure at NeXT by creating a NeXT Center in Paris. From 1997 to 2000 he helped top French companies use Microsoft technologies as Application Development Consultant. He was Information Technology Manager at Visiolis, the first company that enabled remote online expertise in the French motorcar insurance industry. For the last ten years, Jean-Claude Lev has been an Independent Consultant and Software Author in Paris, France.
That is one full CV. For now, though, we want to talk about Chocolate.js.
What’s the background on Chocolate?
Jean-Claude Levy: I have a long run project called Intentware. My goals are enabling non-programmers to easily program and to create a better experience with office-like apps.
My main concerns were: having only one programming language to deal with servers, clients, database, user interface, workflow; having a programming language with a nice balance between imperative and functional orientation, and; having an immediate computing environment where, like in Excel, there is no time between intention and realization.
In 2011, after an exploration in the Python world, I discovered Coffeescript. It was the language I was looking for. At that time, I also took some time with Node.js and I liked its simplicity.
I then (re)started to build Intentware using Node.js and Coffeescript. I quickly needed an online web development environment, so I created one. I called it Chocolate. Why? Because I don’t drink coffee!
Makes sense! Can you tell us why folks would want to use this framework?
Jean-Claude Levy: Chocolate wants to make programming accessible. This means, anywhere you have a screen connected to Internet you can continue working on your code. And anytime you have an idea, or a question about your code, you can immediately test it.
With Locco and The Lab, Chocolate allows you to edit every source code file online and test live code.
Another basic idea is this: specify, code and document should be one and the same activity. Chocolate goes in that direction with Specolate and Doccolate, which make those activities closer to each other.
Chocolate is free, open source and wants to stays as simple and close to standards as it can be. Chocolate can be used in conjunction other tools and framework like Express, Derby or Meteor.
I hope people will like Chocolate and help me make it clean, simple, and complete.
We love the naming conventions of Chocokup, Specolate and Doccolate. Can you tell us about these features and the other cool features of Chocolate?
Jean-Claude Levy: As you will see, Chocolate integrates great technologies created by really great guys.
I discovered Coffeekup just after Coffeescript. It allows you to write HTML code using a pure Coffeescript syntax. It’s what I was looking for: only one language. So I used it in Chocolate. However, I prefer panel oriented UI than page oriented UI, so I extended a little bit Coffeekup to introduce this panel orientation.
And as I was looking for a new name I decided put some Chocolate in every name! So here came Chocokup. And now my templates are kups of chocolate!
Jeremy Ashkenas showed me Docco, a nice tool he created to produce good-looking documentation from your code. And as I transformed it to be available client side, it became Doccolate. Now, when I want to document my code, I can immediately see if it’s readable and useful.
And then, there is the spec part to complete the SpeCoDoc trilogy. I chose Jasmine.js so that I can have Behavior (or Test) Driven Development integrated in Chocolate. I made it available as simply as I could, client side and server side. With a nice chocolate layer it became Specolate. Of course it’s not complete but I find it really useful to program and not only to test.
Finally, Newnotes is the tool I’m currently working on. The purpose was to have a place to note where I am in my development, test or debugging activities when I have to stop working on it. But it quickly became a project on its own. The most impressive part is currently that it can display a branch in my notes as an Impress.js presentation. I used this with my Webapps development students.
You built this with Coffeescript. How did the whole development process go?
Jean-Claude Levy: I started with Node.js and Coffeescript installed on a Debian 5.0 server virtual machine, plus Notepad++ and Filezilla installed on a windows 7client machine. Online editing was my first goal. I selected CodeMirror and Ace. I started with the first one and then changed my mind and used Ace.
I also decided that my main language would be Coffeescript and that my server would run with the Coffee command. A monitor service would see when source files change and then restart the application.
Then, gradually, Chocolate appeared. It included:
- Online source editing
- Jasmine basic integration
- Git integration
- Docco integration
- Locco protocol development
- Coffeekup integration
- Coffeekup extended (Chocokup)
- Basic client side ‘require’ introduced
- Session and registration introduction
- Source file sync between clients with polling
- Studio creation to integrate all those tools
- Live debug (Bret Victor lecture) introduced
- Immediate Chocokup available
- Interactive Docco introduced (Doccolate)
- Jasmine improvements (Specolate)
- Newnotes development
- Impress.js in Newnotes
Also, I wanted to make it look like chocolate tablets and make it available on Github and npm.
What were the benefits of creating this with Node.js and Coffeescript?
Jean-Claude Levy: It creates a basic, simple, lightweight and immediate environment.
Node.js is modular and the mono-process, mono-thread and asynchronous orientation is relaxing. It made me leave the Microsoft environment with a great relief.
What have your users said about Chocolate?
Jean-Claude Levy: “It’s literally chocolate!” Many find it impressive and would love to use it at work, but most are stuck to heavy tools and environment.
I gave it to my students who learn web app development. They simply use it, and make good progress. I must say that I made them first use the c9.io service which is amazing but had load problems. With Chocolate it was really easy to share a virtual machine with 20 users developing online at the same time. It’s light.
I’m now looking for feedback, ideas and help.
What does the future have in store for Chocolate?
Jean-Claude Levy: Many, many things. Simple and innovative database integration. Automatic user interface. User and security management. I will continue to go in the same direction: making it possible for enthusiasts to program. I’m only at the very beginning.
Sounds like you have a full plate. Do you have any other Node.js projects in the future?
Jean-Claude Levy: Yes, I want we recreate all Office-like tools we use. I’m really not satisfied at all with the one we have. The first step is with Newnotes that could really be a breakthrough.
I’m currently working on my database service…
I want to thank you for your interest and your questions that help me think and speak about Chocolate!
Our pleasure, Jean-Claude. Good luck with Chocolate.js!
For anyone interested, you can fork it on Github and reach out to Jean-Claude there as well. You can also read more about Chocolate and try out a demo at https://chocolatejs.org/ to see Chocolate UI in action.
If you have a cool Node.js project or product you think we should profile, reach out to us at [email protected] and we’d be happy to get you In the Loop.