I write Engineering Topic weekly...?

Blog of web engineer at Tokyo. [Japanese version] http://taichiw.hatenablog.com/

Any System's behavior can be described by only "Input" & "Output"

Even it's any size or any type, system's behavior can be described by only "Input" and "Output'.
f:id:taichiw:20190118235359p:plain

Subroutines in program (function, method, ...)

The behavior can be described by requested parameter and returned value.

public String greet (String name){
    return "Hello " + name + "!";
}

Each services in microservice architecture

It can be explained by API's request and response.
f:id:taichiw:20190119000332p:plain

Whole system's behavior on microservice architecture

With perspective that whole system is one of huge black box, we can explain that by the published API's request and response.
f:id:taichiw:20190119000823p:plain
f:id:taichiw:20190119000848p:plain

Web page

Possible to explain by URL (and posted contents) as request and returned HTML and some contents as response.
f:id:taichiw:20190119001413p:plain

But... does some system update the data, doesn't it?

Yes, we need say "the status is updated" for describing the behavior if we think this "System" is consists from one service and database.
f:id:taichiw:20190119002052p:plain

But with another perspective, if we think only the service is system... then we can say, the request to Database is also just one of output from the service.
f:id:taichiw:20190119002118p:plain

In that way, we can say this system just has two kind of output.

We can adapt same idea to subroutine on program.

class Person {
  String name;
  public setName(String name) {
    this.name = name;
  }
}

We can understand this code like this...
f:id:taichiw:20190119002532p:plain

but this is also possible.
f:id:taichiw:20190119002715p:plain

The case get data from database

f:id:taichiw:20190119002824p:plain
In this case, we can say just this service has two kind of input.