Page 334 -
P. 334

CHAPTER 12  ANALYSIS MODELING                                      305

               FIGURE 12.4
               Relationships
                                  Book                                Bookstore


                                         (a) A basic connection between objects


                                                    Orders

                                                    Displays
                                                     Stocks
                                  Book                                Bookstore
                                                     Sells

                                                    Returns
                                           (b) Relationships between objects




                              The relationships orders, displays, stocks, sells, and returns define the relevant con-
                              nections between book and bookstore. Figure 12.4b illustrates these object/rela-
                              tionship pairs graphically.
                                It is important to note that object/relationship pairs are bidirectional. That is, they
                              can be read in either direction. A bookstore orders books or books are ordered by a
                              bookstore. 2

                              12.3.2 Cardinality and Modality
                              The elements of data modeling—data objects, attributes, and relationships— provide
                              the basis for understanding the information domain of a problem. However, addi-
                              tional information related to these basic elements must also be understood.
                                We have defined a set of objects and represented the object/relationship pairs that
                              bind them. But a simple pair that states: object X relates to object Y does not pro-
                              vide enough information for software engineering purposes. We must understand
                              how many occurrences of object X are related to how many occurrences of object
                              Y. This leads to a data modeling concept called cardinality.

                              Cardinality. The data model must be capable of representing the number of occur-
                              rences objects in a given relationship. Tillmann [TIL93] defines the cardinality of an
                              object/relationship pair in the following manner:



                              2  To avoid ambiguity, the manner in which a relationship is labeled must be considered. For exam-
                                ple, if context is not considered for a bidirectional relation, Figure 12.4b could be misinterpreted
                                to mean that books order bookstores. In such cases, rephrasing is necessary.
   329   330   331   332   333   334   335   336   337   338   339