Momentum logo
Team 12 Classroom

Intro to Django

Posted on May 2nd, 2022

📅 Today’s topics

  • Review HTTP request-response
  • Learn about MVC web applications
  • Get to know Django!

🎯 Project: Uptact

When you start your first dev job, you will see a lot of code all at once and will have to be able to read it and understand what it does so that you can modify and add to it.

In this project you will do just that: modify existing code to augment its functionality. This is due Friday morning.

Each person should accept the assignment invitation and work in their own repo, but please work on this assignment with your assigned buddies. Buddy groups are welcome to combine and unite forces. The point is: nobody should struggle alone.

For each part of the assignment, talk over with your buddies how you each think you can accomplish the tasks. Be willing to try things your buddy suggests even if you aren’t sure it’s right! You will learn a lot by seeing what happens (and what doesn’t) when you make changes.

Talking it through will help clarify your understanding of how Django works, and having a buddy around will be helpful when you inevitably run into errors.

code_buddies = [
  ('Stephen', 'Jamie', 'Manny'),
  ('Shawna', 'Gerardo'),
  ('Philip', 'Jessica'),
  ('Ambar', 'Hillary', 'Joey'),
]

👉 Django Uptact

🔖 Resources

Database

  • DB Browser for SQLite - an optional but super helpful tool to be able to see your SQLite database directly. You can download it or install it with Homebrew.

Django

HTTP

🦉 Code

Intro to Object-Oriented Python

Posted on Apr 28th, 2022

Today, we’ll take a brief survey of classes and objects in Python to get us ready to take on Django.

Today’s topics

  • Python Classes
    • Instantiating an Object
    • Attributes
    • Instance Methods
    • “Magic” Methods

🔎 Mystery Word Project Retrospective

  • Something I learned by doing this project is…
  • Something I want to understand better or know more about is…
  • In this project, I was happy that I was able to…

🐍 Code Break

Creating classes and objects

🎯 Project

Today you are beginning a Django tutorial, where you will see classes implemented. Please complete at least part one by Monday, 5/2.

🔖 Resources

Object-oriented

Classes in Python

Useful resources for debugging

🦉 Code & Notes

Python Modules and Programs

Posted on Apr 26th, 2022

Breaking down programming problems into their smallest pieces is one of the most critical skills in programming. You’ll need to practice this for the weekend assignment.

🗓️ Today’s topics

  • Modules and import
  • Program shape & design

🤓 How to approach a large project

tl;dr: Plan, be methodical, and talk to colleagues.

Sketch it out before you write code

Developers need to sketch out their ideas. (This is the true purpose of whiteboards for engineering teams, not grilling job candidates on obscure algorithms…) A pencil and paper is a great tool for programming. If that isn’t your style, use a stylus and tablet, a Google Doc, or whatever you like to jot things down. Don’t start in the code editor, in other words.

  • What is the program/product’s purpose or goal? Restate it in your own words to be sure you get it.
  • What is its core purpose? See if you can clear away anything not strictly necessary and get down to the simplest version of what it does.
  • Bullet list out the main things it needs to do to achieve its purpose.
  • Then go back and look at each bullet, and break it down further. What steps might need to happen first?
    • Each step could be something you know how to do OR something you don’t know how to do. Examples:
      • Get the contents of a file
      • Figure out some way to choose a random word
      • Keep track of what letters have been guessed
  • Go back and re-read your list.
    • Are you missing any steps? Is there anything out of order?
    • Could any step be made clearer or more precise with more detail?
    • Is each step really just one step? Do you need to break them down into more than one, or do some steps need to be combined?
  • Revise this list until it looks solid to you.
  • Talk to other people working on this assignment and compare your lists.
  • You will probably have to revisit your plan and revise it as you discover new problems to solve while you work. This is expected and ok. It is all in a day’s work for a software developer.

Once you have a plan you think is somewhat doable, then you can start writing code. Use pseudo-code to help guide you. Work through your steps in the order that makes sense, keeping in mind that you can hard-code values as placeholders where you need to.

🗝 You have to run your program repeatedly to get feedback about what is happening.

🗝 Don’t forget to use your print statements to give you necessary information as your program runs.

🗝 Change one thing at a time and work methodically.

🗝 Take breaks. It’s hard to think when you are tired, frustrated, or stressed.

🗝 Talk to other developers when you are stuck. Talking through the problem will often clarify what you need to do. See Rubber Duck Debugging.

🐍 Code Break

Try working with a module

🎯 Project

This is due on Thursday.

Mystery Word

🔖 Resources

🦉 Code

Python Sequences and Files

Posted on Apr 25th, 2022

We can use the generic term sequence for any object that provides an ordered structure for a number of items, such as a string (a group of characters), a list, or a dictionary (keys and values).

Files are important as inputs for our programs. Today we’ll learn about working with text files.

📅 Today’s Topics

  • More strings
  • Working with files
  • List comprehensions

🐍 Code Break

🎯 Project

We will work on this project in stages both inside and outside of class today. It is due on Tuesday morning.

Word Frequency

You will find this helpful in understanding the starter code.

🔖 Resources

RealPython

Python Docs

🦉 Code & Notes