Joe Parente and Joey Perrott are doing afternoon sessions with the Web Coding Bootcamp. I’m learning a lot and transcribing my notes down below.
Python is an interpreted¹ programming language. It supports multiple programming paradigms, but the instructors mostly focused on the object oriented (OO) style. Everything can be understood as an object. Functions (methods²) and classes define actions and attributes for objects. There are statements (if, for, while, try, etc.) and expressions. Included data types are integers, strings, dictionaries, lists and my favorite tuple³ (mostly because it sounds cute).
There was a lot to be learned about classes. Classes have attributes and methods. Def__init__ defines the construction.
“The __init__ method (init for initialise) is called when the object is instantiated. Instantiation is done by (effectively) calling the class.”
Source: Introduction to OOP with Python
Handling Exceptions is the way Python doesn’t break when expected disconnects occur. Using a try block you can catch an error and have the program do something else.
Python works in and with other frameworks and languages:
- The Web framework for perfectionists with deadlines | Django
- LAMP (software bundle)
- App Engine — Google Cloud Platform
- Amazon Web Services (AWS) – Cloud Computing Services
- Interactive Wireframe Software & Mockup Tool | Axure (They mentioned this and I’m curious to see how we could use that.)
There are two types of databases, relational and non-relational⁴. In our first python project, we’ll be working on a quote database using The Python NDB Datastore API.
First, as a class, we created a model (a well defined data structure) with just attributes. Then, we translated that into a syntactically correct model that used Property Classes such as StringProperty.
- Name variables well (i.e. def Add (firstnumber, secondnumber).
- When programming, think of user experience along the way (in their example, they used “enumerate” to make the selection from the list easier.
- Except as narrow of an error as possible in try blocks.
- Never store a user’s password in a database in plain text.
- Do not expose your data base to the public.
- Always document your code (code comments called doc strings). When you comment on methods: say what it does, and talk about the required arguments and what they look like and what it returns.
- Compiling vs. interpreting is mostly a matter of how the work of “understanding” the program is divided up between different processes, and the line is a bit blurry these days as languages and products try to offer the best of both worlds.
2. Methods are associated with a class or instance, and “standalone functions” are not.
3. The point of a tuple is that the i-th slot means something specific. In other words, it’s a index-based (rather than name based) datastructure.
4. Therefore, in my opinion, the main difference is about how do you store the data and the storage level of the relationships between them.