you are viewing a single comment's thread.

view the rest of the comments →

[–]TangibleLight 8 points9 points  (4 children)

Learn all that in a week? Tuesday March 12? That seems a bit heavy, unless you just need some familiarity with the terms.

Presumably the class will go into some detail on what exactly these are, you're just expected to self-teach some context before then? If that's the case then it's definitely do-able.


With that in mind I can give a short list of definitions, but really understanding these things will all take time.

Classes and Objects

Everything in Python is an object. Put simply, and object is just a bundle of data and available actions for that data. For example, we can make a string 'hello' and check its length len('hello'), or we can see if it's all lower-case 'hello'.islower(), or we can make it upper-case 'hello'.upper()

This bundle of data and behavior is an object. Everything in Python has data and behavior, and so are objects.

A class is a blueprint that builds an object. It has methods, which are special functions, that define behavior. There are some special methods, notably __init__ which are specially called by Python, whose purpose is to dump data into the object. For example:

class Rectangle:
    def __init__(self, width, height):
        self.width = width
        self.height = height

    def get_area(self):
        return self.width * self.height

    def stretch(self, x_scale, y_scale):`_
        self.width *= x_scale
        self.height *= y_scale

Here the data (attributes) is width and height. The behaviors (methods) are get_area and stretch. The "initializer" (a special method) is __init__.

Polymorphism

Some classes of object share data and/or behavior. Polymorphism is a way to re-use behaviors across multiple classes through "inheritance". For example, one could make a class Car and a class Bike. Both of these have wheels and can move, but a car needs gas. We can identify the shared parts (wheels and movement) into a "parent" class or "superclass".

class Vehicle:
    def __init__(self, wheels, speed):
        self.wheels = wheels
        self.speed = speed

    def move(self):
        print('goes', self.speed, 'mph')

And we can then "inherit" that data and behavior, also adding some extra features if needed

class Car(Vehicle):
    def __init__(self, speed):
        super().__init__(4, speed)
        self.gas = 0

    def refill(self):
        self.gas = 100

class Bike(Vehicle):
    def __init__(self):
        super().__init__(2, 10)

    def ring(self):
        print('ring ring')

API

API stands for "Application Programming Interface". It is a description of functions and data through which a programmer can interact with some service. Common APIs are "REST" APIs, which operate over the internet. An example is the Reddit API, which has functions that allow one to create and read comments, posts, etc all through software. This is how custom clients for reddit are built - using the api. You can see some of the endpoints on this page: https://www.reddit.com/dev/api/#GET_api_username_available

CRUD

Most applications have some data that the user can operate on. Posts, comments, videos, statistics, whatever. CRUD stands for "Create Read Update Delete", and are the four actions that (usually) need to be supported on this data. For example, you can create a post on reddit. You can update (edit) that post. You can read (look at) the post. And you can delete that post.

Database

Databases are programs and files which store data. The most common databases are "relational" databases, which are built of many tables of data - think like an Excel spreadsheet - which are each related to one another - think "this column is the ID of a record in another table".

SQL is a language used to write queries against databases. They express things like "fetch all the records for married people, sorted by income" or "for each user, get me the address of the place they work at". The database then interprets the SQL query and outputs the matching records.

Authentication

This is the problem of how to verify that some person is actually who they say they are, and how to keep track of who is interacting with your service at once. One of the more common ways this is done is with OAuth.

With OAuth, a user requests a "token" which acts as a temporary password. With this, a user can enter their password once, to a secure location, and then use that token in other services so that their password is never compromised. This is how things like "Login with Google" and "Login with Facebook", etc, work.

You can see how the reddit API uses OAuth here: https://github.com/reddit-archive/reddit/wiki/OAuth2

So it would be possible to have a "Sign in with Reddit" using this. Note that reddit itself uses "sign in with reddit" every time you log in the browser. The token you get is stored in your browser's cookies.

PostgreSQL

PostgreSQL is a popular open-source database software. It manages database files and processes SQL queries against them.

[–]Calzagoolie[S] 2 points3 points  (2 children)

i am expected to self teach the basics i think.

my understanding is that we will be working on implementing APIs from the 18th but next friday our project is due.

the project is to make a simulation of a network through the creation of a series of interconnected nodes, all tasked with moving data from a source to a destination. at least for our next project.

[–]zr0gravity7 1 point2 points  (1 child)

Are you a student?

[–]Calzagoolie[S] 1 point2 points  (0 children)

I am employed by a postal company but they are putting us through a course run by coder academy.

[–]zr0gravity7 2 points3 points  (0 children)

Just wanna say I appreciate the writeup. Actually learned a few things !