UML to Database Patterns
Mike Sneen's .Net Blog
Sunday, July 25, 2010
Saturday, June 26, 2010
UML Sequence Diagrams - Activation Blocks - steps
Here are the steps for making a sequence diagram with activations
Start by drawing the actor initiating the activity and the participating classes and objects
Once you have added all of the messages you want to show, finish off your activation blocks. Waiting until the end is easier, because you know how long they need to be.
Start by drawing the actor initiating the activity and the participating classes and objects
Start the first activation block. An activation block representation of C# is any set of open and closed braces{}, such as for a method, try catch, if, foreach, etc
Next, add in the next message. Any place an arrow will terminate, before drawing in the arrow head, start the next activation block, then draw in the arrowhead pointing to that activation block(See Fig 4 and 5)
Once you have added all of the messages you want to show, finish off your activation blocks. Waiting until the end is easier, because you know how long they need to be.
Monday, June 21, 2010
UML Sequence Diagrams - Activation blocks - foreach statements
UML Sequence Diagrams - Activation blocks
Activation blocks tend to confuse people when learning UML Sequence Diagrams. I have to admit, if I haven't sequenced something for awhile, I forget how and especially why, too.
Activation blocks are usually only necessary once you start sequencing multiple calls within the same object or class.
If a sequence starts in an asp.net web page, such as Page_Load(...), and then a call is made to a method called InitializeVariables(), and then one to GetLogonUser(), as in Fig 1. Did Page_Load(...) call GetLogonUser(), or did InitializeVariables()?
We don't know unless we use activation blocks (See Fig 2 and Fig 3, showing each way).
Fig 2 shows that InitializeVariables() called GetLogonUser(),
Activation blocks are usually only necessary once you start sequencing multiple calls within the same object or class.
If a sequence starts in an asp.net web page, such as Page_Load(...), and then a call is made to a method called InitializeVariables(), and then one to GetLogonUser(), as in Fig 1. Did Page_Load(...) call GetLogonUser(), or did InitializeVariables()?
We don't know unless we use activation blocks (See Fig 2 and Fig 3, showing each way).
Fig 2 shows that InitializeVariables() called GetLogonUser(),
Sunday, June 20, 2010
Sequence Diagram - If statement
While UML 2.0 has syntax for blocks like if -else and loops in Sequence Diagrams, I prefere to use pseudo - c#. I use the if, else, for, foreach, etc as the message, and an activation block to show what happens inside the block. I know this is not standard UML, but I find it much more readable, especially for reverse engineering
Friday, June 18, 2010
Speeding up RadGrids
If you can, turn viewstate off
HierarchyLoadMode="ServerOnDemand"
Do your data load for the top level parent table in The NeedDataSource Event
if (!e.IsFromDetailTable)
{
grd.DataSource = DAL.Practice.Catalog.GetMasterCatalogSuppliers();
}
Load the child table data in the _OnDetailTableDataBind event
//Get the id of the parent item
GridDataItem gridParentDataItem = e.DetailTableView.ParentItem as GridDataItem;
int brandID = gridParentDataItem.GetColumnInt32("BrandID");
//Note that the GetColumnInt32 is an Extension Method I wrote, you won't have it
// bind the detail grid
grd.MasterTableView.DetailTables[0].DataSource = Get...(brandID);
If you can, turn viewstate off
HierarchyLoadMode="ServerOnDemand"
Do your data load for the top level parent table in The NeedDataSource Event
if (!e.IsFromDetailTable)
{
grd.DataSource = DAL.Practice.Catalog.GetMasterCatalogSuppliers();
}
Load the child table data in the _OnDetailTableDataBind event
//Get the id of the parent item
GridDataItem gridParentDataItem = e.DetailTableView.ParentItem as GridDataItem;
int brandID = gridParentDataItem.GetColumnInt32("BrandID");
//Note that the GetColumnInt32 is an Extension Method I wrote, you won't have it
// bind the detail grid
grd.MasterTableView.DetailTables[0].DataSource = Get...(brandID);
Subscribe to:
Posts (Atom)