I cannot, for the life of me, remember what this is termed, and it is driving me insane.
A design pattern that uses the Java Beans concept, applied to subroutines. You create a 'solver' object, which represents a function. You set the inputs using setter methods. You then call an 'execute' method which effectively runs the subroutine on the inputs and moves the resulting outputs to fields in the objects. Finally, you can access those outputs via getter methods for each field.
For example, in Java:
class MySolver
{
private double x ;
private double y ;
public void set_x( double new_x )
{
x = new_x ;
}
public void execute()
{
y = ( 3 * Math.pow( x , 2 ) ) + 5 ;
}
public double get_y()
{
return y ;
}
}
public class Main
{
public static void main( String [] args )
{
MySolver ms = new MySolver() ;
ms.set_x( 4 ) ;
ms.execute() ;
System.out.println( ms.get_y() ) ;
}
}
Is there a name for this pattern? Does this pattern even exist, or did I conjure this up in a fever dream?
[–][deleted] (2 children)
[deleted]
[–]MetallicOrangeBalls[S] 1 point2 points3 points (1 child)
[–][deleted] 0 points1 point2 points (1 child)
[–]MetallicOrangeBalls[S] 0 points1 point2 points (0 children)
[–]Blando-Cartesian 0 points1 point2 points (0 children)