Where is the pest place for a business logic ?

Topics: CAB & Smart Client Software Factory
Jan 22, 2007 at 10:23 AM
Hello NG,

I am new to this group and just start a project with SCSF to build an user interface for a ready business logic which also contains the data layer.

Now I'm in doubt where is the best place and how to implement the access to this logic which is implemented and tested in a separate project.
The project contains all necessary data ( complex structure ), operations, and persistence methods.

It will be used by more than one module ( in the future ) and manny 'smart parts'.

Please give me some guidance where to put this project and how to implement the access to it.

Thanks in advance

Uwe Lesta
Jan 22, 2007 at 1:38 PM
Hi-

It sounds like a Service is what you are after. There are multiple example of services in the various reference implementations. A service is basically a Singleton that is DI'ed into your various work items and smart parts and you have access to the service from all your modules (if you want)

Take a look at the following classes in the Bank Branch Example:
ICustomerAccountService / CustomerAccountService


This should give you a good starting point.

Hope that helps,
Steve
Jan 22, 2007 at 2:34 PM
Hello Steve,

Yes, i have seen the services and after your advice i had a closer look to ICustomerAccountService / CustomerAccountService.

So is it a good idea to
- build a 'projectDataService' class in my Module
- add a reference to the busines logik project
- implement a LoadData and StoreData Method in the projectDataService class
- add a using derective to all views
- and work with the data structure directly in all views

?
Jan 22, 2007 at 3:58 PM
"So is it a good idea to
- build a 'projectDataService' class in my Module"

If the service will ONLY be used by this module, yes. If you want other module's to access it, I would add the service to your Services Project (and also Service.Interfaces Project)


"- add a reference to the busines logik project"
Depends on what you do above: Add the reference to wherever you implement the service.

"- implement a LoadData and StoreData Method in the projectDataService class"
Yes.

"- add a using derective to all views"
I would think you would need a reference (and subsequent using statement) to Business Object in the View and Presenter and a reference (and subsequent using statement) to the Service in the Presenters.

"- and work with the data structure directly in all views"
Yes and the Presenters as well. Using the business objects in the View might be considered Tight Coupling by some, but I don't see how to avoid it without breaking things down to a level that is ridiculous.

Good luck