lundi 27 février 2017

A generalized java input output design pattern

I was wondering whether it is possible to generalize the input and output part of a Java program via specific design pattern? I am looking for a way to use a pattern to add different types of implementation in the future. For example, let's say I have a method which computes something based on the input, and it works through Console. How can I generalize the input-output side of this application in a way that other implementation of input/output like GUI or web service can be added easily?

public int compute(int input){
   return input+2;
}

Aucun commentaire:

Enregistrer un commentaire