[TYPO3-mvc] Seperation of services

Nikolas Hagelstein lists at shr.cc
Wed Feb 9 12:33:50 CET 2011


Am 03.02.2011 09:05, schrieb Peter Niederlag:
> I do but I am still not very sure on what really makes up the "domain"
> and what not:
>
> Domain/Service : get Labels / Options for domain models
> Service/ : Mail/Export/SOAP
>
> Dont know if that is "truely correct" but feels ok to me. :->
Hmmm i do as well but it feels a little ugly to me.
I usually roughly consinder a service being a "domain service" if it 
takes domain objects as input and/or returns domain objects or knows 
anything about the domain insides.

Realworld example:

I once had to build a booking portal. There was a remote webservice (not 
soap but pure xml via http) handling a couple of things (room 
availabilty/prices etc).

I set up an infrastructural servive that purly implemented the raw 
webservice functions as specified by the webservice api documentation 
-of course only the relevant ones - plus a set of helper functions 
(formating/authentification etc).

I put this service to Service/XxxWebservice.php (where xxx is the name 
of the remote booking system).

As part of my domain i set up a Domain/Service/Xxx.php which i injected 
the xxxWebservice.php to.
That domain service consisted of functions that implemented the domain 
duties that the booking system had within my appplication.

E.g. take a product Object and time period and retur a price object or 
an availabillty object - (actually the service returned native types 
....but in an perfect world ;) ).

That domain service made use of the "plain webservice" and it's 
knowledge about the domain.

 From a software architectural point of view that kind of seperation is 
probably a good idea in terms of testability etc.

But i am still not sure where to place the files - even if it's only 
cosmetic.

Perhaps Sebastian or Jochen could share their thoughts on it.  :)

BTW: I often tend to ask my self "where to put what" regulary during 
projects. Sometimes if feel like: If i don't know where to put things i 
probably should review the domain modeling...

Cheers,
Nikolas










More information about the TYPO3-project-typo3v4mvc mailing list