Codementor Events

How I learned Django

Published Oct 22, 2020
How I learned Django

About me

Hi, I'm Murtaza, a third-year CS student at Yale. I have been programming for over 7 years, and I love it. I like solving hard problems, but also building things that people can use, so programming, and in particular web, is super exciting to me.

Why I wanted to learn Django

For a coursework component of my A-Level in CS, I had to undertake a software development project, with a real client and client requirements and documented meetings and a written testing plan and all that jazz. I decided to build a platform for my teacher to be able to read his students' code in one place, to replace his old system of having them email him .py files.

I chose to use Django as my first web framework, because I had some experience in PHP-MySQL from CS50 2016, but wanted to use something more modern. I chose Django over popular Javascript frameworks because of my familiarity and comfort with Python.

How I approached learning Django

I followed sentdex's (now outdated - updated version posted in 2019) Django tutorial series and deviated from his project at points where I could see how to build my own project. For example, the blog structure was useful, but the specific models he used were adapted. After the tutorial, I continued refining the systems I had built, following Django guides and documentation and scouring (and asking) StackOverflow when I was stuck.

Eventually I landed a short internship at a company that happened to use Django for their product, and I learned how to use class based views from them.

Challenges I faced

Implementing class based views was tough, because it was a paradigm I was not used to at all. While I was familiar with OOP, the way classes are used in Django is slightly opaque. At several points I realized I would never know which methods are called in which order unless I looked at the source code of the framework, which was my first real experience inspecting professional code. It requires a different mindset than programming--I find it a lot easier to translate human logic into code than the reverse. But I worked my way through it, and came away with a better understanding of Django.

Working with Javascript for a real website for the first time was interesting, especially because my site had a few heavy front-end components. Particularly, building the code submission interface was fun but daunting. Tracking down certain edge cases and thoroughly testing the site as an adversarial user was again an unfamiliar task to me.

Key takeaways

Learning how to effectively read documentation for a large framework/library was great. I became better at finding the information I needed, while also being able to dive deeper into the architecture when needed (e.g. for class based view method call flow). I also had my first experience deploying a website, and became closely acquainted (maybe even friends) with bash.

Tips and advice

My main advice would be to have fun! There's no better way to learn something than to try, and fail spectacularly. There were moments where I had to rewrite a bunch of spaghetti, but they were learning experiences that stuck with me and made me a better programmer.

Find a good tutorial in a format you like (honestly, writing/presentation style is the most important thing for me) and follow along until you feel confident enough to start going off the beaten path. Documentation is your friend--Django's docs are great, and StackOverflow (and many good Discord servers; I highly recommend joining one) are there for specific questions. Use these resources!

Final thoughts and next steps

This was probably the most memorable software development experience I had, because it was my first. I fondly remember my first rollercoaster, first day in each country I've lived in, and certainly my first video game; of course, my first web project is up there on the list too.

Discover and read more posts from Murtaza Javaid
get started
post commentsBe the first to share your opinion
Show more replies