Skip to content

Instantly share code, notes, and snippets.

@prodeveloper
Last active July 16, 2017 09:28
Show Gist options
  • Save prodeveloper/0c1d143dc0d7fc1bf8fd46961c0d734c to your computer and use it in GitHub Desktop.
Save prodeveloper/0c1d143dc0d7fc1bf8fd46961c0d734c to your computer and use it in GitHub Desktop.
Semester review and closing

In our class, it has been a success for most of us. It has helped us abstract out the details of how to setup a development environment.

For day to day development, you may wish to consider using another platform such as Vagrant. This tools will be a bit harder to grok than c9. But at least then you will not face the dual problem of understanding both the platform and the language.

Why Django

When we started this semester, it may have not been clear why we chose the framework.

By now, it should be a bit more clear just how easy Django is to use. In addition to general ease of use. Django provides a whole lot of functionality out of the box. The tradeoff is you need to think in a certain way.

This is not necessarily a bad thing, embedded in how Django makes you code is a lot of good practises. Many of which you will come to appreciate when you start maintaining your code.

URLs

The entry point for your application is your urls.py file. In fact up to this point, it's only one we have covered.

Django provides a rich set of tools to define what you want to happen when a user types in a certain piece of code.

We have covered the basics of this, we have literally coded the matches we expect in full.

For most simple apps this should be enough.

However, understanding regex, the expressive language Django uses for urls is a worthy endevour.

Views

Views connect incoming requests to outgoing responses. Basically this is where you do all your value addition.

Your app does something, this is where the something is. For example for a very simple calculator app, this is where you would do the arithmetic manipulation. For a more typical business app, this is where you would call the relevant models and do any manipulation you need to on the data before displaying it.

Models

Models are our data stores. They keep our data in the format specified and help us easily retrieve it later.

We have looked at basic querying techniques in this semester including: all, exclude and filter.

We can do much more by chaining this methods.

Templates

This is how your output will eventually look like. Just like a report form or even a receipt has a certain standard form. So does most output from your application.

It thus makes sense to think about and write this structure out in your templates you can then call them when you need them.

Thinking through your application

The one thing we have insisted through out the semester is computers are not like humans, you can not expect them to intuit what you want them to do.

Anything you want the computer to do you must tell it explicitly.

To aid in this process, it's my suggestion that before you write any code, you first write out the steps you expect the code to execute.

This should help you in terms of getting your thinking clear.

Assignment for the holiday

Start a new project that shows your family members and their position on the homepage.

There should be a possibility of adding new family members if need be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment