How access UserDictionary in Python?

My favorite example of interpreting UML class diagrams in the picture below.

All about Types
Notice that the diagram shows two (2) ways to define “type”. The traditional Object Oriented (OO) Inheritance way (Male and Female classes descending from “Human”) and the more flexible GenderType-link to a, well, a GenderType (more advanced both technically and conceptually because it also allows changing the gender, and to add any number of “genders”… :slight_smile: ).

Hierarchy
Anyway, since OOP involves “inheritance” I think that an example of Kind (Class Humans) as opposed to Generations (depicted by children & parents) helps the mind to find the best way to define different kinds of hierarchies.

Interface - The Interface type is not included here, only Classes, Attributes and Relations, but Interfaces are simply “injected” to classes with a pin symbol with a round pin head.

Ownership Links - Notice the difference between filled and unfilled diamond symbols for certain relations :

  • Filled diamonds (black) can be perceived as “owns” and code generators typically injects code to auto-create such related objects On Create of the owning class (and also destroyed together with the owning object)
  • Unfilled diamonds can be perceived as “has”. A “has”-relation can be dropped, or reconfigured to refer to some other object instance as opposed to “owns” which live and die with the owner object.

Configurable Type - The “advanced” GenderType kind of type-concept (shown far below in the picture) is often used in other contexts, so never mind the concept of gender, it just goes well together with human inheritance and relations etc.

Roles - Notice also the direction from which you read the link-roles (“wife” is technically an attribute of Male and “husband” is an attribute of “Female” etc).

There are a few more other UML notations not shown here, but this is the basic stuff that makes most sense for a start.

Edit: Notice also that using inheritance for defining Male & Female in software is not recommended (but for explaining the technical OO concept of inheritance it is useful). One reason for not using inheritance for gender is that the sequence of events for gaining the information may require that you create a “Person” or “Human” object first, and only after that you will learn about the gender, and so it’s more convenient to just create the Person class and assign the GenderType-link only when that info is known.

// Rolf