Wednesday, August 26, 2009

UML: Sequence, Activity or State?

Do you find yourself torn between modeling types for your component? These rule-of-thumb's from Martin Fowler's book "UML Distilled" may come in handy!!

"You should use sequence diagrams when you want to look at the behavior of several objects within a single use case. Sequence diagrams are good at showing collaborations among the objects; they are not so good at precise definition of the behavior."

"If you want to look at the behavior of a single object across many use cases, use a state diagram."

"If you want to look at behavior across many use cases or many threads, consider an activity diagram"

Tuesday, August 25, 2009

Simple Semantic Context Brought to You By Typedef

You vote: Confusing as heck or extremely useful?

The typedef specifier in C++ allows you to add that little bit of context that may be missing from your variable's type.

The following statement tells us that our property is not just a collection of Strings, but a collection of Strings that represent first names. 

typedef vector<bstr> FirstNames;
FirstNames mtvFirstNames;

The variable name implies the additional type context to me, but hey... I'm a Java developer.
Is there some uber niche where this comes in really handy?