Learn how to design-Information System of cargo distribution station

Source: Internet
Author: User

Subject:A cargo distribution station Information System

Description:There is a cargo distribution station, which is responsible for collecting statistics on the goods delivered by the customer according to certain rules, and then distributing the goods according to the corresponding transportation method.

The goods have the following attributes:

Price, weight, volume, delivery destination, recipient, sender, estimated sending time, estimated arrival time

Goods classification rules can be classified by goods volume and weight. This rule varies according to customer requirements. The current categories of goods include: 3 Type, respectively 1 (The price is higher 1000 USD) , Type 2 (Except for the Type 1 The weight in the remaining goods is greater 10 kg ), Type 3(Except for the Type 1 , 2 The remaining goods ). However, this classification rule will change frequently (for example, a new type may be added in the next month: Type 4 -- Except for the Type 1 , 2 The remaining cargo volume is greater 1 CubeMeters , Then the corresponding type 3 It will become a non-type 1 , 2 , 4 The remaining goods ).

Now we need to develop a cargo statistics system. After the operator enters the cargo information, the system will handle different types of goods:

For1The cargo will write the relevant information of the cargo to the localOracleDatabase.

For2The cargo will write the relevant information of the cargo to the localSQL ServerDatabase

For3The cargo will be sent to a remoteWeb ServiceInterface.

(Because the classification will change, the processing of goods will also change when these categories change)

Design the core processing module of the system (UI, Persistence and external interfaces can be simplified), write the outline of the design scheme.

My design scheme:

Goods classification rules will change, and we need to deal with goods according to these classification rules. What should I do? Use the open/closed principle to isolate changes! Each classification rule has certain judgment conditions and corresponding processing under this classification. When classifying goods, all existing rules must be applied and handled with the rules of the current goods. The core business process of the cargo statistics system is as follows:


Based on these analyses, you can easily obtain the following class diagrams:


Each class is an independent Class Library. Add a pair on the client Iclassificatorfactory And Irsung . In the ApplicationProgramAdd Classificatorfactory And Ruler1, ruler2 ,... And then dynamically load the corresponding Assembly to create Classificator , Ruler1, rule2 ,... And add it Classificator Of Filters Collection.

Classificator. classify (product P)CoreCodeAs follows:

Foreach (iruler R in filters)

{

If (R. Validate (p ))

{// PBelongRClassification Rules

R. classify (p );//PressRProcessing of classification rules

Break ;//Classification-based uniqueness

}

}

If the classification rules change due to our business needs and there are more and more detailed categories, you only need to add the correspondingRuler (s ),Add the Assembly and class names to the configuration file, and load allRuler.

2007-12-24

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.