rajat13
8/23/2019 - 3:39 AM

SRP.java

public class ServerConnectionManager {
    public void createConnection(String host, String path, String port) {
        // Code
    }
    public void sendRequest(Object request) {
        // Code
    }
}

// The above class provides two operations: make a connection and send a request. 
// Two responsibilities are mixed up. It can be designed as follows:
public class ServerConnectionManager {
    public void createConnection(String host, String path, String port) {
        // Code
    }
}
public class ServerConnection {
    public void sendRequest(Object request) {
        // Code
    }
}