Category Archives: Newbie

Why Tutorials Suck

Published / by chris / Leave a Comment

When was the last tutorial you’ve taken? It could have been my Free Email Course about Django REST Framework, or it could have been the “Official Django Tutorial” that will have you go through a simple Django Application.

What did you think about these tutorials? Which one helped you to learn the best? Why did it help you learn?

I’m not saying my course is the best, ever. Far from it. However, it was an experiment to see if tutorials can be better, or not.

This is an opinion piece about my feelings about tutorials and how it might be possible to make them better.

Tutorials Don’t Help you Learn

Tutorials don’t really help you learn how to use the technology that you want to learn. Every tutorials is an overview to show how the technology works, how easy it is to get up to speed, and gets you excited to read the documentation so you can learn more.

You will get a broad overview of the technology in question, and after you’re finished with the tutorial, you might try to create an app of your own. But, how well do you do? Does it work out? After creating the Polls App, how confident were you to create your own app?

“Type This Here then run it and see what happens”

Look at the Official Django Tutorial. Here is a small snippet of it:


Let’s write the first view. Open the file polls/views.py and put the following Python code in it:

polls/views.py

from django.http import HttpResponse


def index(request):
    return HttpResponse("Hello, world. You're at the polls index.")

This is a typical example of, “Hey! Go to this page and type this here.”

Afterwards, it doesn’t tell you to run the application. The tutorial makes sure the application will run correctly before it tells you to run it. This is completely backwards.

There is A LOT you can learn by running the application at this point. You will get an error!! But, later, you’ll understand why you’re getting that error.

As an example, my email course had a few errors in it that you won’t know or understand until later in the course. I did this very blatantly. For the reader, it would be really hard to put 2 and 2 together and your understanding wouldn’t be as strong if you didn’t see the outcome of the errors. Then, also, you learned how to fix the issue!

It that makes sense, read on. I’ll show you how to make your tutorials better.

Fix your Tutorials, Here’s how

If you want to create a tutorial, here’s some things you can do to make it better for people to learn from.

Introduce them to common errors

While you are doing the, “Write this code here…” lessons, have your readers run the code so that they can see common issues. If the Official Django Tutorial told you to try to run the code after your created your first view, you would learn that in order for your app to work, you need a URL pattern to access it.

Imagine if the tutorial forgot to tell you to import a builtin Django function. Then, you ran the app. You’d learn exactly what error you get and you’ll be able to learn how to fix it.

Learning what common errors look like, you’d learn exactly what needs to be fixed in your app to fix the error.


FIX: Force your readers to see common errors. Over the course of the material, your readers will understand exactly how to fix them.


Let them figure some things out on their own

Don’t tell your readers everything. Let them do some work to figure things out on their own. That way, they will learn how to search for information and how to use the information to modify an existing application. That skill is indispensible.

One great way to do this, is to by creating Homework. Homework is a great way to have your readers learn the material better by getting out of their comfort zone and learn new material on their own.

This brings me to the third lesson.


FIX: Give your reader some homework to do. The ability to find information and know how to use that information to modify an existing app does wonders for teaching somebody how to use the technology you are teaching


Be available for feedback

If you give your reader homework, you HAVE to be there for questions and answers. Email works really well.

If you’re not there for feedback, you are leaving your readers behind. I tell everybody who takes my email course that they can email me their questions and I read and answer every email I receive.


FIX: Be available for feedback. If your readers have questions they deserve to ask you to clear up anything you are teaching them.


Give the application away so they can compare their code

It’s very possible that your reader is going to make some errors in their code and it’s going to be really annoying not knowing what happened that caused these errors.

Most of the time it’s a simple typo that can break the entire application. Try finding that typo in thousands of lines of code! In a simple tutorial with less than a few hundred lines of code, a typo is unacceptable.


FIX: Send your readers the exact code that you used for that lesson. This will allow them to check their code with yours. A simple diff my_app your_app will show you where your typos are.


Make bad tutorials better

So, if you’re going through a tutorial how can you use the above fixes to make it better while you’re going through it?

  1. Find groups of readers who took the tutorial so you can ask them for help and, if they are willing, their working examples of the project.
  2. Come up with some cool ideas that you want to implement and search the Googles for information about how to implement these ideas. Don’t wait for someone else to tell you what you should be implementing.
  3. Don’t be afraid to run the application midway through the tutorial. You can learn a lot by just reading error messages and attempt to fix them before you move on with the rest of the tutorial. Doing things by yourself is more important for your learning than simply copying code.

Excited to take your next tutorial? Sign up below for a free Django REST Framework tutorial!

You’re a newbie and you’re making a HUGE mistake

Published / by chris / Leave a Comment

Awesome! You made it! You’re here because you don’t want to do the same mistakes that every other newbie makes.

The first step to becoming a real developer and not just a newbie, is by understanding the mistake that you’re going to make and then prevent it from happening! And, almost every newbie commits this mistake until they actually decide to humble themselves with the process of learning.

Don’t try to learn Django until AFTER you finish this blog post. Why? Because you WILL not commit the mortal sin of Django newb.

Here are some Real Newbie Mistakes

“Hey! This is my first Django app. I added some tables to my database but I don’t know how to query the database in Django!”

Or…

“Hey! This is my first Django app. How do I deploy my app to production environment with ‘runserver’?”

Or…

“Hey! This is my first Django app. I made some models but it’s not creating the tables in my database!!”

Do any of these look familiar? These are real life newbie mistakes that you could prevent by doing ONE SIMPLE THING.

What is that one simple thing? Why does this matter?

You might enjoy playing around with Django but if you’re willing to play around with Django without understanding how it works, you’re in for a very excrutiatingly steep hill to climb.

Why you don’t have to make the same Mistakes

It’s not your fault. You followed the quickstart guide. You opened up your project and snooped around. You updated the index page and maybe the base template and you got your view setup how you like it.

You’re just scratching the service! You barely know anything yet. What is the best way to go from complete newbie to competent Django developer?

Do the Damn Tutorial!

You need to do the Tutorial! Please, just do the damn tutorial!

So, here’s your challenge.

  1. Click the tutorial link above
  2. Finish the tutorial and work through it. (ACTUALLY WORK THROUGH IT!)
  3. Come back to this page and comment about your favorite part of the tutorial in the comment box.

That’s it! Do the tutorial. Let me know what you like about it. It’s simple and it is the quickest way to get up to speed with all things Django.

I Finished the Django Tutorial…Now What?

Published / by chris / Leave a Comment

As a Computer Science major, we never learned formal web development until you get a job somewhere where you’re tasked to build websites. But, the very act of building websites right out of college, did wonders for actually learning Django. There is too much to know about website building and Django in particular to “know” everything. Therefore, you really need to start out small and work your way up. Sometimes the best way to learn, is not to read and do tutorials, but to actually open a command prompt and:

$ django-admin startproject my_awesome_experimental_project

Then, you take what you learned in the tutorials and your try to build something that somebody you know would think is “SUPER COOL!!”. The problem is, you’re not sure where to start. Everybody enjoys tutorials because when you’re going through a tutorial, you’re making things happen. You don’t have to constantly worry, “am I doing this correct?”. Eventually, a project is finished and you can marvel at how awesome it is. Then, after a few minutes playing around with your creation, you think to yourself, “now what?”.

Here are few things to answer that question:

1. Add some functionality to the app that you just created.

Take the app that you created from this tutorial and come up with a piece of functionality that seems logical to add to that particular project. For example, if you want to work on learning the Django Templating System, you can attempt to add some HTML, CSS, Javascript. Come up with one thing and do it! If you need help come back here or go to the DOCs and figure out how you would implement something.

If you want to learn more about Django ORM, intensify the underlying model system. Add the ability to upload pictures do the polls. Maybe for each poll response, you could have an image instead of text. Maybe you could create a blog and you can use the already existing Polls app to link a Poll to a blog post.

If you want to learn more about Django Views, you can add a new View. Create a profile page for yourself and add a link to that page on all the Polls that you create. (I don’t know, just a suggestion)

2. Start a project from scratch.

Remember that command above? Run it and start a new project. Would you like to create a chat room that ONLY you and your friends would be able to use? Create it! Maybe you want to create a better Facebook or your own Reddit-like app… Create those apps too!

Take an idea, then meticulously break it down into tinier and tinier components.

Check it out:

Some things that you might need

  1. Chatroom interface
  2. Users
  3. Authentication System
  4. Individual messages per user

Then, you can break this down into smaller components:

  1. Chat window
  2. Chat message input textbox
  3. User model with 1 to Many Model Relationship with Chat Message
  4. A login form
  5. Session to keep user logged in
  6. Etc…

Each of those can be broken down even further, for example:

A login form needs:

  1. Email Field
  2. Password Field
  3. Submit Button
  4. A couple views / urls
  5. Validation for correct logins
  6. Password reset forms
  7. etc…

The point of all this isn’t to bombard you with a lot more “things”, but to break each task down small enough so that they will only take you (hopefully) a few minutes each. Also, these tasks can be small enough that you can compartmentalize each task to help you find what you’re looking for in the Django Docs, or on Google or on Reddit, etc. (e.g. #4 above, “Views and URLs”. If you forgot the syntax of your URLs, you can search for “Django URL syntax” and find a very specific link somewhere in Google. Easy peazy…

3. Start a project with another person.

Do you know people who are interested in learning Django with you? You can very well come up with a project that you can do together. Then, you can follow Step 2 above to break your project down to the simplest parts necessary to finish your project. Make sure to give both you and your friend different tasks. If either of you are stuck, you can help each other out and “pair program” to solve the problem together.

The other thing you can do, is that most major cities will have “Hackathons”. They are events where people will code all day long for a couple days, sometimes more sometimes less and just code a cool and useful app as quickly as possible. It’s also a really great way to get to know other programmers.

Try each of my suggestions above because the more you DO, the better you BECOME. I hope that at least gets you in the right direction. If you need anything else, let me know. Programming can be difficult, but it’s a TON of fun.

How to Use a Virtual Environment to run you Django app

Published / by chris / Leave a Comment

The best way to use Python especially Django is by creating what is called a “Virtual Environment”. This is a separate instance of Python that you can install all the tools that you need to run your Django app without having to messing up your current Python instance.

It will also help to freeze the packages you install which is great for deploying to different environments and such. But, the steps are pretty much the same everything you create a new Virtual Environment. These steps are assuming you use a Unix based operating system. If you are using Windows, these steps will be a little different.

Step 1: Install ‘virtualenv’

First things first. You need to install virtualenv. You can do this with the ‘pip’ command.

$ pip install virtualenv

Step 2: Create your virtual environment

The next step to creating a virtual environment is to actually create it. This step will install an instance of Python and also install Pip for you so you can install the packages that you want.

$ virtualenv venv

You can call the virtual environment anything you like. I like to call it ‘venv’

Step 3: Activate the virtual environment

This step will change your Python path so that you will use the virtual environment version of Python and Pip. You’ll notice that when you enter this command, you might see ‘(venv)’ next to your commandline. That’s how you know that you’re running the virtual environment

$ source venv/bin/activate

Step 4: Install your packages

You can then install your packages at this point. You’ll be happy to know that you’re packages will be installed inside of your virtual environment. So, when you try to ‘import django’, the Python interpreter will be able to find it.

Step 5: Deactivate your virtual environment

When you are done working on your Django app, and you want to exit from your virtual environment, simply call:

$ deactivate

You’ll be back to your default Python path.