Introducing beginners to the magical world of software development is a journey filled with exhilaration, tears, epiphanies, frustrations, and laughs. Like children learning to ride a bicycle for the first time, beginners have no context from previous life experiences that they can use to make learning easier. Beginners, left to their own devices, are confronted with an ocean of choices in modern-day software development. It's hard to know where to start.
We have a saying - "If you don't tell learners what is important, everything becomes important."
When everything is equally important, learning becomes a mind-numbing exercise in futility. Our job is to give beginners a clear path of discovery to learn the fundamentals, help them develop the ability to think algorithmically, and build a strong vocabulary.
Languages, Libraries, Interpreters, and Frameworks
One of the most challenging concepts for beginners is the difference between Python and Django. It is surprisingly common for beginners to chunk these two terms into separate, distinct languages in their minds.
"I used the following languages for my final project - Python and Django."
We have found that it takes a significant amount of time for a beginner's brain to build the correct cognitive schemas to describe the two tools correctly. Explaining it as you would to a seasoned veteran would leave a beginner more confused - especially when it comes to Python and Django.
Wait. Django is Python, but then it's executed by Python? Python runs Python?
You can imagine the confusion. Now imagine that it is day 114 since writing your first line of code - ever.
Python: The Language
Python is the name of the language itself. There are predefined rules for the syntax of the Python programming language. If you want conditions, you must write your if..elif..else code to conform to those rules. To iterate a collection, you must precisely write the for..in loop as the syntax rules dictate.
Any deviation from the rules will result in non-working code.
When you create a text file on your computer named beginner.py, for example, and start typing in code that conforms to the rules of Python syntax, all you have is a file containing text. Hopefully, that text will result in working code that solves the problem you are working on, yet it doesn't do anything. It is just some instructions, like a recipe in a box.
Useless.
Something needs to run those instructions, just like a cook needs to execute the recipe to make it into something edible.
Python: The Interpreter
Python is also the name of an executable program that gets installed on your computer. It's officially called the Python Interpreter, but developers call it Python. Thus, the confusion for beginners.
It is the job of the Python Interpreter to do the following steps.
- Read through the Python code you wrote in your text file.
- Verify that it complies with all of the syntax rules.
- Break it down into chunks of instructions, called byte code, that your computer will eventually understand and execute.
There is a final step that involves something called the Python Virtual Machine, which this article will not cover for the sake of brevity.
Django
Django is a tool maintained by a core team of Python developers since its public release in 2005. It is a framework in which any Python developer can follow common patterns to make web applications.
Since the first web applications were built in the late 1990s and early 2000s, web developers found that they were writing the same code and following the same patterns repeatedly. Teams of developers began building frameworks to save a tremendous amount of time and do all those repetitive tasks. That freed developers to spend their time working on the specific business logic needed for the application.
The framework provides abstractions (i.e., pre-written code that hides all of the complexity of the task) to the developer, who chooses which ones to use. Here's a quick example. One common task is saving information provided by customers into a database.
Without the help of a framework, this is how you would have to write the Python code.
When you use a framework, that code will be simplified.
It reduces not only the number of lines of code to write but also makes the code easier to read and understand for a new teammate who is trying to understand it for the first time.
The entire framework is written in Python, and your logic is written in Python. However, the project that provides all of the pre-written Python code for you to use and is available for free has to be given a name. The team who wrote it all chose to call it Django.
Python was already taken.
In Conclusion... Confusion
With each passing year, the world of software development increases in two main ways.
- More tools are created to simplify the process of building software, making developers more productive.
- More tools are created to simplify the process of building software, making the job of a beginner harder to know where to start.
There are too many choices and too many terms.
Making sense of those terms is difficult, and your brain desperately wants to simplify and condense things to make sense. That difficulty is why we see beginners believing that Python and Django are both languages and use phrases like, "I wrote my project in Django."
If you are a beginner, I hope this article helped you understand the difference between the two terms.