Object Oriented Programming Flashcards

1
Q

Object-Oriented Programming (OOP):

A

An approach to designing and building software applications that have flexibility, maintainability, and are designed around the interactions of ‘virtual objects’ rather than data.

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

Class:

A

A class is a portion of code that contains everything there is to be known about how to represent an object in the computer, what interactions it supports and how it can be manipulated. Good examples of classes are Customer, Contact, Purchase Order, Car, File-Manager and so on.

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

Object:

A

An instance of a class that is created at run-time. You can have a person class, then create or instantiate several instances. Bob, Mary, Jane etc. Each instance is unique for the lifetime of the application.

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

Property:

A

Code used to support the ‘getting’ and ‘setting’ of some data held within a class. A property or accessor method is used to control how that data can be changed. Properties might include Name, Age, Date of Birth, Account Number, Student ID etc.

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

Method:

A

Code used to define the functionality or actions within a class. Methods are the behavior of the class. Method such as ConfirmBooking and CalculateOverTime are good examples of multi-step processes being modeled within a class.

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

Method signature:

A

The syntax of a method that describes whether parameters are required or not. A parameter is the data passed into a method to be acted upon. A method may take in a number value and multiply by it by a known tax rate, then return the new value.

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

Overloading:

A

Methods can have the same name but a different number of incoming parameters. For example, consider these two method signatures:

· Public ConfirmBooking(int bookingId)

· Public ConfirmBooking(int bookingid, bool paymentmade)

The ConfirmBooking method in this example is said to have ‘two overloads’.

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

Contract:

A

A contract is the set of valid interactions a class will support through its properties and methods. This is also known as the ‘class interface’.

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

Abstraction:

A

The process of defining classes by only modeling those factors from the real world that are absolutely needed within the computer. For example, a person in the real world has a First Name, Last Name, Email Address and Favorite food. If your application is an email tracker, then you do not need to represent Favorite Food.

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

Encapsulation:

A

A way to restrict access to or ‘hide’ data and implementation details within a class. Preventing unauthorized use and concealing complexity. Data and methods can be visible to all (using public keyword) or not visible outside of the class itself (using private keyword).

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

Inheritance:

A

Defines the relationship between classes. Classes can sub-class another to extend their behaviors and properties. Known as child or derived classes. They by default inherit all of the members of the parent or base class. For example, a base class might be Vehicle, with child classes such as Car, MotorBike, Truck etc.

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

Polymorphism:

A

A term used to describe how one object can be treated like another. For example, consider a base class called Shape that has a draw method. Now add a Square class, A Circle Class and a CustomShape class. A method that accepts a Shape object as an argument can accept any of these shapes.

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

Inheritance-Based Polymorphism:

A

A variation on Polymorphism where the method is defined in a base class and behaves differently for each child class.

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

Interface-Based Polymorphism:

A

A variation on Polymorphism where the method is defined as an additional interface and behaves differently in each class that implements the interface.

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

Class

A

Definition, blueprint, template used to describe what a particular object would like and what behaviors it possess.

Formal way to classify a group of objects that share common features.

Like a cookie cutter, a description of what a single cookie or instance would look like.

Classes are simply used to logically organize and arrange your code for better maintainability.

A way to describe how items in the real world can be modeled in the computer.

Can describe attribute, action, behaviors and etc.

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

Object

A

Instance of a class, it is descrete or autonomous. Embodies all of the characteristics of the class. Unique occurrence of the class within our model.

Objects or instances are the actual cookies themselves.

Actual occurrences of a class within your program, ones that you can interact with.