Dynamic Interactive Webdevelopment

2009-12-23 21:00:32

Ever heard the expression 'you cant talk yourself out of this one?', well can I screencast my way out of it? I've compiled a little 12 minute screencast where I demonstrate some interactive webdevelopment while showing off Emacs.


Preface


Below you'll see a small video, which I have made for the purpose of demonstrating the look and feel of webdevelopment in Clojure. From feedback I received from my last post I gathered that many people haven't had a chance to try out Compojure yet. To accomodate those of you who haven't yet tried out either Compojure or the IDEverything Emacs this is a chance to take a look at how the internals of the machinery works.

Long story short: I'll copy some data from a website, push it into MySql and display it on a website - all very simple, but it does show off a little bit of Compojure and ClojureQL.

The Video

(double click for full-screen - if you're not seeing it, try hitting F5 or using Firefox)

Compojure/Emacs Intro from Lau Jensen on Vimeo.

 

Conclusion

REPL languages are great and Clojure is no exception. Earlier this year I handled a project, where the rows weren't in the 2 digit range, but rather there were hundres of thousands of lines. Within minutes of just playing around in the REPL had I done enough calculations on the data to inform the customer that there were many faulty rows that were non-compliant with their own standards - They were using SAP and with the help of consultants they had a second iteration ready within a couple of days. Second iteration was also faulty, so we agreed that I would clean up the data for them, taking SAP out of the equation. It literally took minutes to complete and start using the data all thanks to the handy REPL which let me test/try/fry/burn/filter etc very quickly.

Leaving the content behind, how does Screencasts work for you guys? Is this something to build on, or is regular blogging still the way to go?


Phil
2009-12-23 23:31:14
Any chance we could get a downloadable version for those of us who don't like having that nasty crashy adobe plugin installed?
Lau
2009-12-23 23:51:45
Hey Phil,

Download is enabled now.

/Lau
Milton Silva
2009-12-24 00:46:21
That was very good! You should definitely do more Screencasts. 
Perhaps one that explains how to be more productive using an emacs/slime environment? 
e.g. Around 6:40 you used something that was very handy. I have used emacs, but I never saw something like that.
Brenton Ashworth
2009-12-24 01:35:55
Excellent work!

I agree with Milton. More screencasts about being productive with emacs/slime. I reluctantly started using emacs six months ago because there was no good support for Clojure in the big IDEs. Now I love it and when I see someone who really knows what their doing I am always impressed. That keyboard macro was amazing.

This was a great example of how easy it is to get started with Compojure.
Shawn Hoover
2009-12-24 05:00:25
Lau, nice job on the screencast. You packed a lot into 12 minutes.
vishal
2009-12-24 08:04:14
Thanks! Great demo! I wonder if a real world blog can be developed and hosted using compojure
Lau
2009-12-24 08:08:12
@Milton: Thanks a lot. I'll try to put some emphasis on the productivity side of things in future screencasts. 

@Brenton: Thanks! :) 
Regarding the keyboard macro my lack of skill within video-editing prevent me from adding a text-overlay showing the keys I was hitting, so just to be clear
C-x (   *begin recording keyboard macro*
*mangle 1 line of data, leave cursor at first character on second row*
C-x )   *stop recording*
C-u 0 C-x e   *run macro until end of file*
--
C-u 0 means until end of file, could have been C-u 5, if I just wanted 5 lines.

@Shawn: Thanks!
Lau
2009-12-24 08:10:54
@vishal: Of course it can - Time is a little scarce as always, but I am actually considering giving Wordpress a run for its money. More on that later perhaps.
Neill Alexander
2009-12-24 10:31:50
Great demo. I've just started learning Clojure. Seeing something like this just fuels my excitement. It also makes me think I need to bite the bullet and finally learn how to use Emacs.
Lau
2009-12-24 10:37:53
Hey Neill - I'm quite confident that between Emacs and Clojure, its very very easy to learn Emacs. Daily use for a few days, perhaps with a little cheat-sheet lying next to the keyboard, you'll be up and running in no time.
Sergey Pariev
2009-12-24 12:15:54
Hello,
what a great screencast! There is definitely a need for emacs/slime/clojure screencasts, as it takes some skills to efficiently work in such an environment. 
BTW, how do you manage to keep defroutes in repl in sync with definition in upper buffer ? Some emacs magic or just doing eval-buffer/eval-sexp each time you change something ?
Lau
2009-12-24 13:25:18
Hi Sergey -Thanks!

 Whatever I write in in the top buffer is evaluated using C-M-x, which makes it immediately accessible in the Repl. So yes, its just slime-eval-defun.
Rick Moynihan
2009-12-24 17:05:14
Great screencast Lau!

I definitely agree with others that more screencasts would be a good thing; but then so would more of your blog posts!  :-)

One comment on workflow...  In this screencast you split work between both the REPL and the buffer; yet it looks like the finished code wouldn't run, as you didn't save the code for database connection setup into your file.

The impermenance of the slime REPL has led me to type most code into the buffer and then evaluate it into the running REPL...  I then leave the REPL  primarily for testing my assumptions, and formulating snippets of code, which I then save into my buffer.

I find this form of development is far more productive; though occaisionally it can lead to bugs as the evaluated live code differs from that defined in the buffer (as is the case here).  I find this is usually easily resolved but it can lead to problems.

I'm pretty sure this is how you and others use SLIME, but it wasn't explicitly mentioned in the screencast, so I thought I'd bring it up for those unfamiliar with this form of development.

Great work, and like everyone else I'm hungry for more!
Lau
2009-12-24 17:12:23
Hey Rick,

First off, thanks a lot for your encouragement, it means a lot !

Secondly I agree with your workflow, thats how I work as well. Also when I'm getting ready to push changes, I always flush the REPL and reload everything, otherwise the sweet speed of the REPL can quickly turn into something nasty.

Thanks for stopping by.
Meikel
2009-12-25 12:17:47
How long did it take to create the screencast? I found this very time-consuming, but maybe the problem is on my side?

Sidenote: I'm using Firefox and I don't see the video. :P
Lau
2009-12-25 13:32:27
Hi Meikel,

The preparations took a while, figuring out which topic to hit, how much to include, a few trial runs etc.
Then the actual recording took about 12.5 minutes. Then I fixed the length of the audio-file, which took about 5 minutes, then fused the audio and video which took about 5 - 10 minutes as well, so all in all I foresee about 30 - 60 minutes on the following screencasts if they are so simple that I can 'play it by ear', for more complex topics, perhaps some real editing is called for - time will tell.

/Lau
Tom Porter
2009-12-26 01:31:34
Can you do a write up on your setup: .emacs and classpath, versions of clojure and compojure, etc.?

That would help a lot.

Great screen cast!
Lau
2009-12-26 12:40:13
Hey Tom - Sure I'll put a little Install Guide/Config tutorial together.

/Lau
Jan Palencar
2009-12-27 11:40:50
Thanks. Very nice, elementary, brief and selfexplanatory.
Sampo
2009-12-29 16:05:42
I read quite a lot of blogs and I think they have their place but I think certain things are just a lot easier to demonstrate(and easier to understand) in screencasts than with lengthy explanations. So, thank you for this.

You and other emacs screencast makers might be interested in this (it automatically logs and describes keys/commands used in a separate buffer):

http://www.emacswiki.org/emacs/CommandLogMode
Lau
2009-12-29 16:07:26
Hey Sampo,

Thanks for the feedback and also the CLM - Its news to me but I'll definitely try it out!
pratik patel
2010-01-06 07:47:26
Lau, thanks for the great screencast. if you get a chance, i'd like to see some of the keystrokes you used while operating in emacs (navigating within the clojure code, executing within the REPL, etc). perhaps re-run using CLM or key-mon?
Again, thanks for the screencasts, they are awesome!
Zmitro Lapcionak
2010-01-27 10:19:16
Thank you for the excellent screencast! 

You managed to show all the levels (from DB thru server to UI) in such a simple and quick way.
Keith
2010-07-03 07:31:03
Very nice screen cast!