Академический Документы
Профессиональный Документы
Культура Документы
What is Architecture anyway? The software architecture of a program or computing system is the structure or structures of the system, which comprise software components, the externally visible properties of those components, and the relationships between them. The term also refers to documentation of a system's software architecture. Reference: Wikipedia What is an architectural style?
Services as an interface to business processes. (That is how we should think about a service when we design it)
2 Tier (VB4-5-6) vs 3-Tier Com+ (Client in Egypt, Service in Mexico) In the architecture you have to know where the boundaries are. Practical Example:
Egypt/ Libyan Border vs. Cairo/ Alex Their system vs Our system (A boundary)
Lessons learned:
Authentication, Authorization Communication overhead
Able to choose Self Governing Self sufficient Fax /Telephone between ministries When the computer is down, I can still get my license (Send it later by the mail)
XML not objects, specially not platform specific objects e.g. datasets We need to agree on 2 things:
The protocol The policy
Just what is required for the service to perform its function (Just enough validation)
IT department Policy like language of the system (Arabic Russian English) Policy like http/XML/SSL ports The requirements for the way the conversation is to be held E.g. WS- standards (Message encryption, which parts are encrypted, what algorithm we will use to encrypt)
To understand the patterns we must take a look at the most common anti-patterns
CustomersList.MoveNext
Who holds the list? Who controls the memory?
Objects should not be left in an inconsistent state between message exchanges. However, this is dangerous but not wrong.
The perfect interface for all services: XmlDocument PerformOperation(XmlDocument input) Why not? Implicit behavior versus explicit behavior. You need to know what you send specifically and be generic about what you receive (Just enough validation.)
To avoid this anti pattern ask 3 questions: 1.What does the service do? 2. What data does it need to do it? 3. What data does the service return?
What if the service schema changes? What happens to the connected systems?
The patterns
Patterns
Document Processor Idempotent Message Reservation
Context
Problem
Forces
Your interface should Encourage document centric thinking Define a clear semantic in the contract Promote loose coupling through encapsulation of the implementation Be easy to consume from any platform (WS-I base profile) Represent a business process as a complete unit of work
-Encourage document centric thinking by defining a schema (XSD) for request and response messages in your project -Generate objects from your schema to simplify development
Benefits
Consumers think about sending and receiving business documents which are naturally more granular The boundary of the system involves conversion from internal structures to external documents The implementation details of the system are encapsulated The service is more consumable from other platforms and can evolve more easily
Liabilities
Performance will suffer with transfers of data from internal to external structures
Should I use the same schema for multiple services or should each service have its own schema? Opinion: Give each service its own schema
Sharing schema makes it difficult to evolve each service independently and introduces unnecessary churn for service consumers
Context
You are developing a web service for your SOA You heard that messages should be idempotent
Problem
Forces
You cannot expect anything more from the sender than what the contract defines for your service You are working with a transactional database system with frequent updates
Sender tags message with a request ID Your contract can specify that this is required Your contract cannot insist that the ID is unique across time The ID tags a unit of work which will be done only once
Receiver must check to see if the unit of work has already been done before doing it Then what?
You will have to cache responses for some period of time how long?
What if the current value is different than the cached value? What if the response was an error? What if the sender sends duplicate IDs for different units of work?
Data changes should be traceable to a UOW ID Your cached responses may need to reflect what the response was at the time when the request was received
Benefits
Your service autonomy is increased by not having to rely on consumer to do the right thing You wont fool yourself into thinking that reliable messaging will solve this problem
Liabilities
Your service will consume potentially large amounts of durable storage caching responses Your service will take a performance hit for cache management
Context
You are building a service oriented application You have a complex business process that you want to expose to your customers with a web service
Problem
Forces
How do you maintain data consistency across a long running process? You cannot share a distributed transaction The business process requires several messages to complete The message exchange process could take anywhere from seconds to hours
Reserve part: 49389 Qty: 200 Reservation ID: 14432 Expires: 2004-09-15 02:43:53Z Confirm reservation: 14432 PO #49839 Reservation: 14432 Receipt: 29389 PO #49839
www.arcast.tv (Webcasts)
www.geekswithblogs.net/Mohamed (Cool tech blog) www.msdn.com/Architecture www.thevstsguy.com (under construction) www.msdn.microsoft.com/practices (P&P)