title: Exposing Rich Domain Objects as a service
body: <p>I’ve been trying to wrap my head around how to expose my domain objects to the client.  Whether I’m using a rich client or I’m using the web, I want to use the MVP and repository patterns.</p>
  
  <p>What I’m trying to wrap my head around is how I expose my repository and model, which will be on the server.  Is it even possible to expose complex business objects that have state via a web service, or will I have to use a proprietary technology that is not language/platform agnostic, like .Net remoting, EJB, COM+, DCOM, etc?</p>
  
  <p>Some other constraints are that I don’t want to have to keep loading the complex domain object from the database or passing it all over the wire every time I want to do an operation.  Some complex logic might be that certain areas of the screen might be disabled or invisible based on the users permissions in combination with the state of the object.  Validation and error message information will also need to be displayed to the user.  I want to be able to logically call a lot of my domain object operations as if it were running on the same machine.</p>
  
  <p>With the web, you have free rein.  You don’t have to expose your objects across service boundaries, so you can make them a rich as you would like.  I’m trying to create an N-teir architecture that is rich and works when the client calling the model is on a different machine.</p>