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

















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


As I mentioned in a previous post, you can use an activation block to show the contents of a foreach loop, with "foreach" as the message and (Company company in Companies) as parameters ( use whatever type an name you are actually looping through ).

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(),









Fig 3 shows that Page_Load(...) did.

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

Sequence Diagrams Static vs Instance Methods

To show that a Method call is static - Underline it
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);