[ SRE_ARENA ]
Roadmap
System Design
SREdle
⚡ 1420 ELO
OP
☰
←
BACK TO ROADMAP
CLASSES, OBJECTS & OOP
Object-Oriented Python for SRE
System Architecture Visualization
Class
Blueprint (Server)
__init__
Constructor
Methods
def reboot(self)
Object 1
web-01
Object 2
db-01
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.
Classes and Objects
The __init__ Function
The self Parameter
Inheritance
DOWNLOADING CONCEPT: CLASSES AND OBJECTS...
↳
A Class is a blueprint.
↳
An Object is an instance of the class.
↳
If you write scripts that interact with AWS, the
boto3
library heavily utilizes OOP (e.g., returning an
Instance
object).
python
class Server: pass web = Server()
▲ LIVE INCIDENT
A script throws an error when calling a class method.
sre@arena:~/python-oop
sre@arena
:
~
$
python3 server_manager.py
▶ EXECUTE COMMAND