Functional vs. OOP

::: {.Section1} Something I’ve been finding myself doing:

[class Foo{]{style="font-family:\"Courier New\""}

[  int someState;]{style="font-family:\"Courier New\""}

[ ]{style="font-family:\"Courier New\""}

[  static int Bar(int state)]{style="font-family:\"Courier New\""}

[  {]{style="font-family:\"Courier New\""}

[    return state * state;]{style="font-family:\"Courier New\""}

[  }]{style="font-family:\"Courier New\""}

[ ]{style="font-family:\"Courier New\""}

[  public int Bar()]{style="font-family:\"Courier New\""}

[  {]{style="font-family:\"Courier New\""}

[    return Foo.Bar(someState);]{style="font-family:\"Courier New\""}

[  }]{style="font-family:\"Courier New\""}

[}]{style="font-family:\"Courier New\""}

[ ]{style="font-family:\"Courier New\""}

Essentially, developing my code in a functional manner (easier for unit-testing) and then refactoring a simpler public interface. Waddya’ think? :::