Hacker News new | ask | show | jobs
by martin_hnuid 3276 days ago
Hmmm. OK. Read through most of this thread. Not sure I agree with some of what is being said about Django. In particular about this "magic" thing.

It took me a while to get comfortable with Django. I tried to learn it on and off for about four years. I finally decided the only way to do it was to focus, commit to it and not jump off into something else until I got it.

That probably took about six months. Much of it felt confusing and, yes, magical. Until I made one more decision: Read The Source Luke.

Seriously. I started to look things up in Django source code. Every single time I came across something I did not understand or that seemed magical I went to source. It was painful at first but it became easier as it turned into a habit.

And then it happened, one day it just clicked. What seemed like a confusing mess months earlier made complete sense. It almost felt like this happened overnight, which wasn't the case.

I now believe the best way to learn Django is to do it exactly this way. Have the source open on another monitor and look-up everything as you go through a tutorial or book. In the process you'll discover much more than what you were looking for originally.

2 comments

I find myself doing this more and more often with python libraries, even with the well-documented ones like Django REST Framework - always keep a source browser open on the virtualenv dir so I can read library source. There's something about the style of python documentation that makes it difficult to really understand how the classes in a library fit together, so this is necessary for larger python frameworks.

(My personal gold standard for programmer reference documentation has been the Qt API docs for very, very long. They've varied in quality over the years but they're always an example of how to do it.)

Reading the source of libraries I'm using has been a real eye-opener for me. Even from very good documentation you can only learn how to use it, not learn how to write something similar yourself.

PyCharm is amazing help for it as well. Control-click on a function or class, and you will jump into its definition in the library source.

I use PyCharm too. Love it.
This so much. Getting past the "it just magically saves to your db with .save()" by reading the source was critical to my improvement with django.