Interfaces, Contracts and Protocols Flashcards

1
Q

What is an interface?

A

An interface is a description of the actions that an object can do.

A set of behaviours.

A contract between the object & things that are using/implementing that object.

Imagine a vehicle. It can turn left/right & drive forwards/backwards. You don’t care how, just that is does.

In Object Oriented Programming, an Interface is a description of all functions that an object must have in order to be an ”X”

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

Why should should interface be used?

A

To organising functionality into relevant and focused behaviours.

It can function as a contract within development teams
- Helps abstracting & generalising your code - for other users/programmers

It makes your code scalable & flexible when coding towards interfaces and not implementation.

To minimise the cost of change & maintenance.

Useful when testing.

  • (read first 6 lines if u can’t remember what pros there are about abstraction -
    (https: //stackify.com/oop-concept-abstraction/))
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an interface not?

A

A class that contains constructors - rather it is implemented by classes.

Able to be instantiated

Able to contain anything else than method signatures
and constants, static, final fields

Able to be extended by a class - it is implemented by other classes/interfaces

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

Is and interface extended or implemented by a class?

A

It is implemented.

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

Mention some main protocols use in the File Transfer pattern.

A

HTTP/HTTPS, FTP, SFTP/SCP

all based on client/server architecture.

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

What is HTTP?

A

Typer Text Transfer Protocol - application layer protocol.

HTTP can fetch resources like HTML, CSS, JSON, XML etc via the request/response pattern.

HTTP is connection-less, mediaindependent & stateless.

HTTPS is the common use for web servers since it adds SSH security.

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

What is FTP?

A

File Transfer Protocol.

It is and old protocol & should not be used since it uses “clear text” password (unencrypted).

FTP is stateful meaning that it will maintain state information like a user’s current directory.

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

What is SFTP?

A

Secure File Transfer Protocol.

replaces FTP & adds an extra layer of security (through SSH) to FTP.

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