OOP - Intro Flashcards

1
Q

Object-oriented programming

A

A programming paradigm based on “objects,” which contain state (attributes) and behavior (methods). Synonyms: OOP. Used in a Sentence: “OOP means we will define classes, and use classes to make objects”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Object

A

A collection of structured data along with the operations that can be performed on that data. An object is one instance of a class. Synonym: Instance. Used in a Sentence: “In OOP, we’ll be making a lot of objects,” “We should invoke the add_friend method on the User object,” “Each User object in the User list will have an ID”

Objects are things that represent concepts as data, hold their own distinct state, and carry out behaviors related to the concept they represent.
Objects are the primary building blocks for problem solving in object-oriented programming languages like Python.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Class

A

A template or blueprint used to create objects of a specific data type. Defines what concrete objects will look like. Synonym: Prototype. Used in a sentence “The String class defines all of the attributes and methods that String objects have.”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Instance

A

One particular object of a certain data type/class. Follows the format defined by its class, and has specific, individual state.. Synonym: Object. Used in a sentence “That specific User instance has an ID of 25,” “We should instantiate a new User instance here, then save it to the database,” “The method add_friend takes in one instance of User as a parameter”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

State

A

A generic term for the data that an object “knows” at one point in time. Usually, state can change over time. Used in a sentence “When a User object sends a message, the program checks the state of online_status”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Attribute

A

A named property of a class. Attributes are used to keep track of state. Synonym: Property, field, “attr”. Used in a sentence “The User class defines the attribute online_status,” “The online_status attribute is a boolean,” “We check the online_status property before we send a message”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Behavior

A

A generic term for what an object can “do.” Used in a sentence: “The User class should have the behavior of adding a friend to the friend list”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Method

A

A function that is defined inside of a class. Methods are usually used to describe behavior. Synonym: Function Used in a sentence “We need to call the add_friend method on User,” “User’s send_message method checks the state of online_status at the beginning”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly