Differences

This shows you the differences between two versions of the page.

Link to this comparison view

it:ad:patterns:service_pattern [2019/03/24 12:02] (current)
Line 1: Line 1:
 +# IT:​AD:​Patterns:​Service Pattern #
  
 +
 +
 +<callout type="​Navigation"​ class="​small">​
 +* [[../​|(UP)]]
 +{{indexmenu>​.#​2|nsort tsort}}
 +
 +
 +</​callout>​
 +
 +
 +<panel title="​Summary">​
 +
 +In an app, it's surprising how *little* actually needs state. ​ I know that sounds weird at first...
 +
 +Consider how many `static` methods, helper methods we have in most apps. 
 +
 +Stuff like: `DbHelper`, `AppSettingsHelper`,​ `ConfigHelper`,​ `EnvironmentHelper`. These should all be stateless.
 +
 +It turns out that a stateless class of methods all focused on the same functionality has another word for it: a `Service`.
 +
 +Once that is understood, instead of a whole bunch of ad-hoc `static` (and unfortunately some times non-`static`) helper classes, an app quickly gains an organised set of `Services`.
 +
 +
 +</​panel>​
 +
 +
 +##### XActLib #####
 +And funnily enough, that' much of what [[Projects/​XActLib/​|XActLib]] focuses on providing (in a modular, maintainable way of course).