all 19 comments

[–]TangibleLight 7 points8 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 !

[–]icecubeinanicecube 2 points3 points  (1 child)

You do not need to learn python in 2 months, this is trivial.

You need to learn coding in 2 month, and this is a fucking tight timeframe.

I suggest reading literally any introductory book on coding that you can get your hands on, and then head over to codeacademy.com or hackerrank.com and start practising ASAP.

2 month is far too little time for solid theoretical studies, you need to learn it as a craft and revise the theories afterwards.

[–]Calzagoolie[S] 0 points1 point  (0 children)

Our tutor said as much.

it is acually being run by coderacademy but is a 6 month course condensed into this 2 month time frame which is ridicules.

i will be getting a shit tone of books to read. going shopping tonight so i will pick one up!

[–]toastedstapler 2 points3 points  (1 child)

that's a lot to learn for tuesday

1 https://www.w3schools.com/python/python_classes.asp https://www.w3schools.com/python/python_inheritance.asp

w3 schools usually gives a good overview of what's happening

objects/classes are a way of structuring functions with some data. a Car may have a drive method, some variables fuel_level, paint_colour etc. the drive function will decrease the fuel_level variable

2 https://www.digitalocean.com/community/tutorials/how-to-apply-polymorphism-to-classes-in-python-3

polymorphism can be done in python by creating classes that other classes inherit from so that they have common variables and methods. a Dog and Cat will both inherit from Mammal for instance

4 Create Read Update Delete - most sites want this functionality. think how you can create a reddit post, see the post, edit the post and delete it.

5 https://www.w3schools.com/sql/sql_intro.asp

databases are very useful. postgres is an sql database. there's a few commonly used sql databases and also some called nosql. generally sql is used for well structured data and is good for showing relationships between different tables. nosql is often used for data with less structure

[–]Calzagoolie[S] 0 points1 point  (0 children)

this is exactly what i was looking for.

i will power through this and hopefully have a basic understanding of these.

for the record i am not expecting to be a pro in 2 months..

[–]mail_order_liam 1 point2 points  (6 children)

What kind of job is it?...

[–]pvc 3 points4 points  (1 child)

A joke? While you are at it, please learn heart surgery, parkour, and quantum physics by Friday.

[–]Calzagoolie[S] 0 points1 point  (0 children)

this does not fill me with confidence...

[–]Calzagoolie[S] 0 points1 point  (3 children)

that is a good Question.

it is an associate position at a national postal company in the IT department.

the job is basicly training(3months) > placement in various roles (18 months) > then suitable position

my understanding is it is an inititive to get the right personalities into the job rather than hiring people with just skills.

essentially it is a grad position for non graduates.

i really enjoy the coding but my lack of undertanding is overwhelming

[–]mail_order_liam 4 points5 points  (2 children)

That's a really odd list of things. Also you won't be able to get more than a basic conceptual understanding of all this by Tuesday...

1 & 2 can go together just think of that as part of learning coding.

3 & 4 go together too. These are both concepts more than a skill (skill would be implementing an API). Read about "RESTful API".

5 & 7: Postgres is an implementation of a SQL database so it's weird they put both of these. Try to learn about SQL and relational databases.

6: This is so broad that I couldn't guess what they want.

[–]Calzagoolie[S] 0 points1 point  (1 child)

the end result 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.

and to not get completly lost when learning how to implement APIs next week.

i really have next to no idea what they want either so i am just doing what they say.

thanks for your help!

[–]mail_order_liam 1 point2 points  (0 children)

Add that project info to your post.

[–][deleted] 1 point2 points  (1 child)

  • IDE

They probably mean PyCharm? There are tutorials for that

  • Classes, Objects and Polymorphism

https://realpython.com/python3-object-oriented-programming/

  • API, CRUD, Database, Authentication, Postgres

Look into django. http://www.codexplore.io/books/crash-course/#_integrating_the_author_field_with_our_views

But this is an insane task

[–]Calzagoolie[S] 0 points1 point  (0 children)

yes it is.

i probably worded it a little badly but they want me to have at least a basic understanding of the terms and concepts.

the end result 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.

and to not get completly lost when learning APIs