<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Services on jason grey</title><link>https://jason-grey.com/tags/services/</link><description>Recent content in Services on jason grey</description><generator>Hugo</generator><language>en</language><lastBuildDate>Wed, 01 Oct 2008 00:00:00 +0000</lastBuildDate><atom:link href="https://jason-grey.com/tags/services/index.xml" rel="self" type="application/rss+xml"/><item><title>What makes a good component/service?</title><link>https://jason-grey.com/posts/2008/what-makes-a-good-component/</link><pubDate>Wed, 01 Oct 2008 00:00:00 +0000</pubDate><guid>https://jason-grey.com/posts/2008/what-makes-a-good-component/</guid><description>&lt;p&gt;A few collected thoughts &amp;amp; notes from around the web regarding what makes a good component/service.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Interface - all implementations share this. Should have few methods, use data objects as return values, take primitives as inputs, throw only custom exceptions, and be very, very well documented.&lt;/li&gt;
&lt;li&gt;Implementations - implement the logic behind the service. May provide extra features such as caching, or such things as optional collaborations.&lt;/li&gt;
&lt;li&gt;Data - data objects this service deals with. Should be immutable, comparable, cloneable as much as is possible. Should be serializable/XML/Persistance annotated in most languages.&lt;/li&gt;
&lt;li&gt;Storage - Data (or data.io) package should define storage API, and an in-memory data store. Allow other services/projects/subprojects to define database backed or other kinds of data stores.&lt;/li&gt;
&lt;li&gt;Cache - Data.Cache packages should define cache API? (or can this be standard per runtime?) Who should be in charge of caching? The service itself, or the user of the service?&lt;/li&gt;
&lt;li&gt;Use dependency injection for all services/data stores it requires. Use constructor-injection as much as possible.&lt;/li&gt;
&lt;li&gt;Throw errors early - in constructor if possible.&lt;/li&gt;
&lt;li&gt;Exceptions - custom exceptions for high level categories of erroneous behavior (try not to do one for every possible condition - classify, and wrap). * Don’t re-throw exceptions from other frameworks - wrap in custom exception.&lt;/li&gt;
&lt;li&gt;Make behavior configurable via dep injection as much as possible. Use filters or strategies.&lt;/li&gt;
&lt;li&gt;Inject 1 configuration object instead of many options. Standardize on configuration API/Framework for each runtime/language.&lt;/li&gt;
&lt;li&gt;Standardize on logging framework/API for each runtime/language, and make sure it’s used (instead of System.out or similar)&lt;/li&gt;
&lt;li&gt;Provide events/messages and/or hooks for important happenings so others can do things pre/post.&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>