Move Class to Library Project through Refactoring

Refactoring is the technique of moving project data (i.e. model elements/diagrams) from current project to dependent project to aid in project data sharing among depending projects. This eases not just the sharing of common project data, but also the improvement of readability as well as the reduction of complexity of project.

May 3, 2011
User Rating: / 1
Views: 1,760
PDF Link Add comments
Edition: Professional or above (Edition comparison)

In this tutorial, we will refactor some library classes from a depending project to a library project.

  1. Start VP-UML.
  2. Download online_bookstore.vpp and library.vpp that attach with this tutorial. Place them to the same folder.
  3. Open online_bookstore.vpp by selecting File > Open Project from the main menu. online_bookstore.vpp depends on library.vpp. If you have put both projects in the same folder, you should be able to open online_bookstore.vpp without any difficulties. If you are asked to resolve project dependency, please select library.vpp manually.
  4. There are two class diagrams in the project. Let's take a look. Open the domain diagram first. Double click on the class diagram domain in Diagram Navigator to open it.
    open diagram
  5. Study the content. There are several domain classes. OrderList and BookList are subclasses of the List class.
    domain diagram opened
  6. Open another class diagram named lib. This diagram contains we what called the library classes. The List class, super class of OrderList and BookList, exist also in this diagram. Library classes are classes that are readily be used by other projects due to their generic nature. In this tutorial, we want to refactor the library classes to the lib project.
    lib diagram opened
  7. Open the Model Explorer.
    open model explorer
  8. The lib package contains the classes we want to refactor. Right click on the lib package and select Refactor to Dependent Project... from the popup menu.
    refactor
  9. Click Yes when you are prompted to save project.
    choose yes
  10. Since the master views of selected classes are owned by the lib diagram, you need to refactor also the lib diagram. An alternative solution is to remove the class shapes from the diagram. But for this tutorial, we just refactor also the diagram. Click Include Diagram(s) to continue.
    include diagram
  11. Review the elements that will be refactored. If everything is alright, click Continue.
    refactor
  12. You are prompted refactor success. You can see that the lib package and the lib diagram do not exist in the online bookstore project. Actually they are moved to the library project. Open the domain diagram.
    domain diagram
  13. We knew that the List class is one of the library classes. The List class you can see on the diagram is actually depending on the List class just refactored. To prove this, try to double click on it. Due to the List class is a dependent element, you can find it not editable.
    list class

Resources

  1. library.vpp
  2. online_bookstore.vpp

Rate this Article

Click on one of the stars below to rate this article from 1 (lowest) to 5 (highest).

You may be interested in

  1. Writing Effective Use Case
  2. Draw Entity Relationship Diagram (ERD)
    Tagged:
  3. UML Package Diagram
    Tagged:
  4. Produce UML Use Cases from Business Process Diagram (BPD)
  5. Oracle database design with Entity Relationship Diagram

Comments (1)

written by Jessie on December 16, 2011

That takes us up to the next level. Great postnig.

Write comment

Rating

Comment

Enter the calculation result

security code