Solved

Application Logic Design

Posted on 2011-03-07
1
320 Views
Last Modified: 2012-06-21
Hi experts,
I need some suggestion helping me to have a good logic design.
My problem is this:
there is a web service (WCF) that exposes my business logic.
On the web service there is a method, for istance: public User CreateUser(User user);
When a consumer invokes this method I need to performe some step in order to create this user. For example:

1) create a new entry on the db (there is a data access layer that implements UnitOfWork and repository pattern);
2) Create some dns entry
3) Create a folder structure
and so on..

I need to make sure all these steps are successfully completed and in case of error I need to rollback.
My question is this:
What the best method (maybe using some design pattern) to help me to:

1) Send back the response to the caller only if all the steps are completed without errors;
2) Make the code flexible, testable and maintable (for example if a future step is needed I don't want to modify the web service bu just the business logic layer)
3) Is it better to pass back to the consumer an object that containes an error status ( zero if no error or some error code in case of error plus the response object like for istance responseObject.ErrorCode; responseObject.UserResult) or some object able to expose all the steps with their status (responseObject.DBSave = true, responseObject.DnsCreation = true and so on)?

Hope my question is clear and thanks in advance
0
Comment
Question by:xtremereality
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 6

Accepted Solution

by:
t-max earned 500 total points
ID: 35056608
Here you have a good resource for design patterns and sample codes:
http://www.dofactory.com/Patterns/Patterns.aspx

Regarding your question, I think you can use a factory for creation (if you create more things other than just a user) and a facade might give you the flexibility to create more underlying subsystems, while keeping the same external interface.

Perhaps other patterns might suit you, but you should consider if it's worth to implement them or not, according to what you expect from your app in the future.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Six Sigma Control Plans

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question