by drinkablemilk 10.29.2008. group members chen qiushi cen yunsi wu lezhen lin yanmei zhang chen...
TRANSCRIPT
By DrinkableMilkBy DrinkableMilk10.29.200810.29.2008
Group MembersGroup Members
Chen Qiushi
Cen Yunsi
Wu Lezhen
Lin YanmeiZhang Chen
Zeng Ting
AgendaAgenda
AgendaAgenda
TaskTask▫A Milk Supply ChainA Milk Supply Chain▫Different Different RolesRoles
Manager(=Plant), customer, and Manager(=Plant), customer, and farmerfarmer
▫InteractionsInteractions Between Roles: Between Roles: Ordering, supplying , producing milk…Ordering, supplying , producing milk…
▫SequencesSequences Exist Between Exist Between FunctionsFunctions
Details of Sequences•0. Login in different roles•1. Customer orders some milk to a certain
plant•2. Milk plant calculates the volume of milk•3. Milk plant asks milk farmer to supply milk•4. Milk farmer takes time to deliver his milk
to milk plant•5. Save the processes above
•Done!
AgendaAgenda
Task :A Milk Supply Task :A Milk Supply ChainChain
▫ Different Different RolesRoles Manager(=Plant), Manager(=Plant),
customer, and farmercustomer, and farmer
▫ InteractionsInteractions Between Between Roles:Roles: Ordering, milking , Ordering, milking ,
order processing …order processing …
▫ SequencesSequences Exist Exist Between Between FunctionsFunctions
Customer
Manager
Farmer
Milking
Ordering
Order Processing
Login
• Sequences of function Sequences of function • 0. Login in different
roles• 1. Customer orders
some milk to a certain plant
• 2. Milk plant calculates the volume of milk
• 3. Milk plant asks milk farmer to supply milk
• 4. Milk farmer takes time to milk and deliver his milk to milk plant
• 5. Save the processes above
•Done!Done!
Customer
Login
Plant
Farmer
Finishing
Milking
OrderingOrderToFarmer
OrderToPlant
Report
MilkProcessin
g
Initial
Customer
Login
Plant
Farmer
Finishing
Milking
Ordering
OrderToFarmer
OrderToPlantReport
Milk
Processing
Initial
Process ModelProcess Model• A model with a set of A model with a set of entitiesentities and a set of and a set of
activities activities scheduled according to scheduled according to particular particular sequences sequences and particular and particular constraintsconstraints
Process Model DesignProcess Model Design
•Detailed Process Design▫Functions▫ parameters▫return values…
Function Name
Description Input parameters
Return values
…
MilkCow Get milk from cows
Cow's ID, farmer's money
volume of milk
HealCow Improve cow's health state
cow's ID, heal method
Cow's health state level
…
Process Model DesignProcess Model Design
Function Name
Description Input parameters
Return values …
MilkCow Get milk from cows
Cow's ID, farmer's money
volume of milk
HealCow Improve cow's health state
cow's ID, heal method
Cow's health state level
…
Model Design ToolsModel Design Tools
Flow chart Flow chart
Petri net Petri net
OPNOPN
From www.wikipedia.com
From www.baidu.com
•A network of objects and processes connected by relationships, so called OPN(Object - Process - Network)
OPNOPN
ObjectProcess
Farmer MilkingMilk
Token's key/valueToken's key/value
Farmer_ID Credit ...
1 100 ...
Process:do operationsProcess:do operations
Farmer_ID Credit ...
1 100 ...
Farmer_ID Credit ...
1 90 ...
Farmer_ID Credit Milk_Time ...
1 90 0 ...
Conditions:control the flowConditions:control the flow
Farmer
Credit>85
Milking
Farmer_ID Credit Milk_Time ...
1 90 0 ...
SynchronizationSynchronization
FarmerMilking
Order
Orderto
Farmer
Orderto
Farmer
•OPN is not only a descriptive model language, but also an executable model language.
•Follow this fashion, we specify operations and conditions of the problem.
•Next we will construct our data model.
AgendaAgenda
Data ModelDefinitionCategoriesData model Design
Data ModelData Model A collection of conceptual tools for
description. It describes data, data relationships, data semantics, and consistency constraints.
——From our textbook<DATABASE SYSTEM CONCEPPT>
Based on the
application of different
levels
Data Model Categories
Data Model DesignData Model Design
Data model comes from the process
Data Model DesignData Model Design
Two methods for conceptual design
•Data dictionary
•E-R model
Data Dictionary is a collection of all elements of the process model. It consists of many entries
Data Model Design(1)Data Model Design(1)
•An entry consists of:NameData descriptionData sourceData typeDesign constraintOthers
Name Description Source ···
farmer A person makes money by providing milk···
Login ···
Stock Order milk, send complaints ···
plant or farmer
···
Order The storage is related to orders···
customer
···
•An simple dictionary
•Especially when the size of data set becomes larger.
ER-Model
Data Model Design(2)
Customer
Plant Farmer
MilkOrderPlant_ID
Loc_x
Plant_ID
Loc_x
Loc_yLoc_y
Name
Loc_yPlant_ID
Name
Loc_y
Loc_x
Entity setsRelation setsAttributes
Customer
Plant Farmer
MilkOrder
Plant_ID
Loc_x
Plant_ID
Loc_x
Loc_yLoc_y
Name
Loc_yPlant_ID
Name
Loc_y
Loc_x
E-R model is a kind of conceptual design.
Data Model Design(3)Data Model Design(3)
Data Model Design(3)Data Model Design(3)•Relational Design
Reduce redundancyLosslessnessDependency preservation
•NormalizationFirst Normal FormSecond Normal FormThird Normal FormBoyce-Codd Normal Form
Data Model Design(3)Data Model Design(3)
Our achievement
Procedures After Design…
AgendaAgenda
Testing is the process of executing a program with the intent of finding errors.
—— 《 The Art of Software Testing 》
Glenford J. Myers
Definition Of Testing
Procedure Of Testing
•A test case is a set of test data for the program——data the program must handle correctly to be considered a successful program
(Smallest component element of source code )
•Design of test caseBlack-Box Testing Also data-driven, or input/output-driven testing
White-Box Testing Also logic-driven testing
Test Case
DrinkableMilk.m(*This function gets the value of a certain key in a certain token.@input:token,key@output:value of the key*)
GetTokenValueByKey[token_, key_] :=Block[{valuePosition},valuePosition = Position[token[[5]], key];If[valuePosition == {}, Return[Null],Return[Delete[token[[6, Delete[valuePosition, 0]]],0]]];]
What we’re only
concerned with
Unit Testing Using Munit(1/2)
DrinkableMilk.mttoken = {“”, “”, “”, “”, { “type”, “number” , “time”, “price”, “customer” }, { "A", "1", "3", "10", "B“ }};Test[
GetTokenValueByKey[token, "number"] ‘"1“‘
TestID->"DrinkableMilk-20081026-Q0Z1O9"]
Key
Value
Value
Judgement:(if in Java language:)AssertTrue(GetTokenValueByKey[toke
n, "number"] ==1”)
Unit Testing Using Munit(1/2)
46
Object Precondition Process Postcondition Objec
t
* “OrderAmount”>5
OrderProcessor
“CustomerMoney ”Decreases by 5×unit price *
preconditionGetTokenValueByKey[token,“Or
derAmount“]
PostconditionGetTokenValueByKey[token,“Order
Amount“]
How to test pre/post conditionsHow to test pre/post conditionsHow to test pre/post conditionsHow to test pre/post conditions
SaveIntoDB
_Finish
System testing•Database Before Running•Print out the Running Result
(in computer memory)•Database After Running
Comparison Results:
• Get["DrinkableMilk`DrinkableMilk`"];• RunGraph["1",OPNGraph,200,PR® True];• • Barrierlogin• {355118,0,{Iss,Pre-1},{275854},{},{}}• 0• 0• BarrierProcessing• {979397,0,{Plant,Pre-4},{877581},{tokenType,plantID,volume,locX,locY},{PLANT,2,15.0,45.0,81.0}}• 0• BarrierProcessing• {554280,0,{OrderToPlant,Pre-3},{263933},
{customerID,demand,farmerID,locX,locXC,locXP,locY,locYC,locYP,need,plantID,tokenType,totalTime},{5,23,NULL,21.,NULL,NULL,21.,NULL,NULL,NULL,NULL,ORDER,NULL}}
• &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&7• 0• BarrierMilking• {563776,0,{Farmer,Pre-6},{711},{tokenType,farmerID,speed,locX,locY},{FARMER,4,14.0,65.0,43.0}}
BarrierProcessing{554280,0,{OrderToPlant,Pre3},{263933},{customerID,demand,farmerID,OrderID, plantID,totalTime},
{5,23,4,69,2,35399200}}
New Tuple added
New Tuple added
AgendaAgenda
•Background: Application of Dairy Farm System
•Whole process from design to development
▫Step 1: Client v.s. DrinkableMilk Development Group
(DDG) Client puts forward their demands
Review
Review▫Step 2:
DDG deals with the demands Build up conceptual process model
▫Step 3: design the detailed process model Functions, parameters, return values… DDG will generate a …
▫Step 4: Data Model Design (ER Model) Establish conceptual Model and optimize
using…▫Step 5: Mapping to
Relational data model
Process model (NET)Process model (NET)
Activities(NODE)Activities(NODE)
Int CalculatingTime()
Int CalculatingDist()……
Functions (DETAILS)Functions (DETAILS)
Client’s DemandClient’s Demand
Process+Data Model
Process+Data Model
ActivitiesActivities
FunctionsFunctions
▫Step 6: Implementation and Unit test Independently Separately
▫Step 7: Integration test & System test
Review
•Miserable experience before▫Coding without thinking before▫Unclear steps for working on a project.
•A new method▫Process Model and Data Model▫Design and Development
Begin with Process in mind
•THANKS
▫By DrinkableMilke Group▫2008-10-29