Skip to content

Instantly share code, notes, and snippets.

@iolsh
iolsh / Solid.java
Created January 28, 2022 21:07
SOLID example
import javax.xml.bind.DatatypeConverter;
import java.util.Base64;
//S: Classes have single responsibility.
//O: Open for extension - it is easy to provide new functionality by implementing interfaces and abstract classes and adding new factory method;
// code is closed for modification as no existing method needs to be modified
//L: Implementation's of Encoder are interchangeable, so we conform to Liskov's substitution principle
//I: Instead of providing one interface for encoding and decoding we have provided two smaller ones
//D: We relay on abstraction in PasswordUtility class which is assembled first in builder, so we do not violate "Dependency Inversion Principle"
class Solid {
cat ~/.ssh/config    master 
Host github.com
ProxyCommand nc -X connect -x <proxy_host>:<proxy_port> %h %p
ServerAliveInterval 10
Hostname ssh.github.com
Port 443