Understanding Source Package Organization Using the Hybrid Model Xinyi Dong and Michael W. Godfrey Software Architecture Group (SWAG) David R. Cheriton School of Computer Science University of Waterloo
1
Introduction
Objects are
Packages are
the basic units of abstraction in OOD. defined by classes. too fine-grained to model large systems. groups of classes. coarse-grained logical design units.
Understanding package organization is key to understanding high-level design. 2
Package Diagram
A Package Diagram
Captures structural dependencies.
A search ()
Patron
Contains little semantic information.
borrowed ()
okToBorrow ()
Student
display ()
Catalog
Item
DVD
B
Faculty
putOnReserve ()
Book
reserved () 3
Package Diagram
How is the functionality implemented in package A used by package B?
Why the system’s classes are divided into this set of packages?
Is package B a design abstraction or just a contain?
A
B
Is package B a part of a bigger abstraction? 4
The Hybrid Model
A Hybrid Model enriches a package diagram with semantic information.
A package represents the objects that can be instantiated from concrete classes it contains.
Ports of a package capture the interface through which objects interact with its environment.
5
Library Management System(1) A search()
Patron
Catalog
borrowed ()
okToBorrow ()
Student
search()
display()
Item
Patron
Faculty
putOnReserve ()
Book
reserved()
UML Package Diagram
Faculty
Item
DVD
B
Patron
borrowed ()
okToBorrow ()
Student
DVD
display()
Catalog
okToBorrow ()
putOnReserve ()
borrowed ()
Item Book reserved () 6
Library Management System(2) A search()
Patron
Catalog
borrowed ()
okToBorrow ()
Student
search()
display()
Item
Patron
Faculty
putOnReserve ()
Book
reserved()
UML Package Diagram
Faculty
Item
DVD
B
Patron
borrowed ()
okToBorrow ()
Student
DVD
display()
Catalog
okToBorrow ()
putOnReserve ()
borrowed ()
Item
Book reserved ()
Hybrid Model
7
Ports
An inport is the interface through which a package provides resources to others. An outport is the interface through which a package requires resources from others.
A
B
8
Connectors
A connector specifies the client-server relationship between two packages. A
A
A
B
B
B
9
Analyzing Package Design Using the Hybrid Model
We examine package relations from two perspectives:
Resources associated with a port
Similarity in ports
Resources associated with a connector
Collaboration patterns
10
Similarity in Ports
High similarity in inports
Two packages contain implementations of the same set of concepts. E.g. 9 sub-packages in org.opencms.db
A
B
High Similarity in outports
Two packages may have similar behaviors. E.g. 3 sub-packages in org.opencms.xml
11
Collaboration Patterns
How is a resource shared among packages?
1→1 m→1 1→n m→n
: : : :
One consumer one provider Many consumers one provider One consumer many providers Many consumers many providers
A
A
A
B
B
B 12
Package Collaboration
Check the composition of the set of resources shared between two packages.
Has more packages. Shares more resources among packages. Has more 1→1 and 1→n collaboration, but fewer m→1 and m→n collaborations. Exhibits a layered structure. Forms a clear framework-application pattern.
Reducing coupling, especially inheritance coupling, is the main concern in version 7.0. 19
Conclusion & Future Work
Package Diagrams lack of necessary semantic information to understanding package design. Hybrid Models are helpful in interpreting package partition criteria. Future Work
Identify collaboration patterns in hierarchical package organization. Automate the process of analyzing package relations.
20
Understanding Source Package Organization Using the ...