Summary of Unified Modeling Language UML UML comprises a family of diagram

Summary of unified modeling language uml uml

This preview shows page 422 - 424 out of 517 pages.

Summary of Unified Modeling Language (UML): UML comprises a family of diagram types to illustrate various aspects of a software design and implementation. UML class diagrams are widely used even by engineers who don’t use other UML features. They show a class’s name, its most important public and private methods and attributes, and its relationship to other classes.
Image of page 422
ELABORATION: When to use UML? While heavyweight, UML is useful for modeling very large applications divided into subsystems being worked on by widely- distributed teams. Also, since UML notation is language-neutral, it can be helpful for coordinating international teams. Because of UML’s maturity, many tools support its use; the challenge is keeping the diagrams “in sync” with the code and the design, which is why most such tools try to go in both directions, synthesizing code skeletons from UML and extracting UML diagrams from code. One such tool useful for learning UML is UMPLE , a domain-specific language developed at the University of Ottawa for expressing class relationships. The Try Umple web site can generate UML class diagrams from UMPLE code, generate UMPLE code from diagrams you draw yourself, or generate executable code in various programming languages corresponding to your UMPLE code or UML diagrams. It’s a great tool for exploring UML and class diagrams, but we don’t recommend using the Ruby code it generates, which is non-DRY and somewhat non-idiomatic. Self-Check 11.2.1. In a UML class diagram depicting the relationship “University has many Departments,” what multiplicities would be allowable on each side of the association? The University side has multiplicity 1 , because a Department must belong to exactly one University. The Department side has multiplicity 1..* , because one or more Departments can belong to a University. Self-Check 11.2.2. Should the relationship “University has many Departments” be modeled as an aggregation or a composition? It should be a composition, since departments wouldn’t survive the closing of a university. 11.3 Single Responsibility Principle The Single Responsibility Principle (SRP) of SOLID states that a class should have one and only one responsibility—that is, only one reason to change. For example, in Section 5.2 , when we added single sign-on to RottenPotatoes, we created a new SessionsController to handle the sign-on interaction. An alternate strategy would be to augment MoviegoersController , since sign-on is an action associated with moviegoers. Indeed, before the single sign-on approach described in Chapter 5 , this was the recommended way to implementing password-based authentication in earlier versions of Rails. But such a scheme would require changing the Moviegoer model and controller whenever we wanted to change the authentication strategy, even though the “essence” of a Moviegoer doesn’t really depend on how he or she signs in. In MVC, each controller should specialize in dealing with one resource; an authenticated user session is a distinct resource from the user himself, and deserves its own RESTful actions and model methods. As a rule of thumb, if you cannot describe the responsibility of a class in 25
Image of page 423
Image of page 424

You've reached the end of your free preview.

Want to read all 517 pages?

  • Spring '19
  • Dr.Marcos

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors