I completed the Johns Hopkins Introduction to Rails, and I’m working through the Intro to Active Record course. So far, all the caveats about MOOCs and automatic grading aside, the projects and test cases are meaningful.
I am reading Elegant Ruby (2015), it’s a special treat. One of the things that impressed me about the ruby community was testing, I remember 8th Light demoing tdd at chipy a long time ago, someone with about 2-3 months of experience with python (coming from ruby) was live coding a bowling kata, and on another projector the mentor was doing the same program in ruby. At the time I don’t know if I had worked in smalltalk.
I can say that coming from smalltalk, ruby looked refreshing. Having dug a bit more into it, I think that things like blocks and symbols make a huge difference. If I say that the two languages I most enjoyed were common lisp and smalltalk, and that I’ve enjoyed C, and worked in Python and C++, it explains a bit of my slant. For me the magic of smalltalk (Pharo and Squeak) was in its discoverability. Pharo is open source writ large, you can click on anything. You can ask the system at runtime to open a class browser to the code that defines the message you received. This level of integration between the programmer and the running programs is unparalleled. For lisp, obviously slime + emacs is the killer app. macroexpand-1 and macroexpand tied to keybindings, M-. jumping live to any functions definition (even in the core language) led me to the feeling that merely static languages better have a lot to offer.
So back to rails. Coming from common lisp + macros, the ideas bundled in Bundler (gem management), rails generate “X” for scaffolding, migrations as code, and other power features really attact me. As a person who is really interested in SQL as a core technology, the idea of giving over control to an ORM still creeps me out. The other ideas that are limited are the way that migrations and models are separate from each other (in django, the model and the table more clearly represent each other), but the routes seem more straightforward than the regex based django routes. In the same vein, I can definitely see how the django routes regular expressions dispatch will be more able to pass very general patterns to the controller.
So rails is great, and feels like magic. Django’s manage.py is very similar to the rails script. I’m on the fence for the two projects I have to do, which are a money management site where I have a database, I need a front end, so building the models from existing data without running the migrations is necessary. The second will probably be a rewrite of Threadline’s website, since web2py, which was perfect for what I needed at the time, might be limiting my ability to test and modify. I’m not proud of all the choices I made when I built it, and I feel I know a little more now. The best plan would be to effect incremental changes. The biggest issue is that the site is currently running in sqlite, I’d like to move it to postgresql. Moving live data, and getting anything other than a series of 500 errors on my wifes business, is something not done without test coverage.