There are actually several versions of this course. This one uses Python. As such, we needed to install pymongo, the driver that enables our Python programs to communicate to MongoDB. In the course video, they download it manually and run
easy_install as root…gah! Again, if you ignore that advice, it’s really quite simple to do
The course also creates a web application and for that they use Bottle, a nice little web framework that I was unfamiliar with (originally a fork of Flask, I guess). Again, it installs easily
Even though both pymongo and Bottle work fine in Python 3, the course uses Python 2 for some reason. I found this particularly odd because I think of MongoDB as a new thing. I mean, their whole business is based around convincing people to eschew decades of database research and try this new way instead. If anyone was going to embrace Python 3, I would have thought it would be the MongoDB folks. Anyway, I started out converting everything to Python 3, but eventually I gave up and installed Python 2.7.6 and used that for the rest of the course.
The sample Python code left a lot to be desired, even given that it was Python 2. In addition to using the print statement instead of the print function and %s instead of string format, it was loaded with bare except statements. That was never good form, even in Python 2. And they incremented variables with “i = i + 1,” explaining that Python lacks i++ (yes, but it has i += 1, so we needn’t repeat the name). Also, they use classic classes everywhere!
There were also issues with the inline quizzes. This appeared to be because they were doing string matching when they should have been evaluating. For example, I got this wrong
Write the to code to initialize a list with the items "hammer", "nail"
and "wall" and assign the list to the variable named "things".
because I wrote
things = ['hammer', 'nail', 'wall']
and they only accepted
things = ["hammer", "nail", "wall"]
These, of course, are equivalent in Python.
Despite all of these issues, I think Python is a good choice for this course. I wish they had used an up-to-date Python and I wish they had used more idiomatic Python, but in the end it didn’t really affect the course too much. How to use MongoDB from Python was effectively communicated. Indeed, I’m sure you can extrapolate everything to any similar language. I tried several of the examples and exercises in Perl and things worked nearly the same way. I’m confident I could easily do things in Ruby as well.