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.

Framework

Application

13

Library Management System A

A

A







B

B

B

1→1

1→n

A search ()

Patron

display ()

Catalog

borrowed ()

okToBorrow ()

Student

m→n

Item

DVD

B

Faculty

putOnReserve ()

Book

reserved ()

14

Case Study 

Subject System: JHotDraw 

Version 6.0 beta 1 



Version 7.1 



71,000 LOC, 17 packages, 396 classes 91,000 LOC, 32 packages, 561 classes

Goal: 

Did the package partition criteria change as the architecture changed ?

15

Shared Resources 

JHotDraw 6.0b1    

# top-level pkg. = 8 # shared res. = 648 Avg. inport size = 157 Avg. outport size = 181



JHotDraw 7.1    

# top-level pkg. = 10 # shared res. = 838 Avg. inport size = 107 Avg. outport size = 107

16

1 →1

m→1

1 →n

m→n

1→1

m→1

1→n

m→n

Shared Resources in V6.0 1→1 #res

m→1 1→n

144

201

m→n

112 7

1→1

191 #res

m→1 1→n

144

m→n

201

112

191

40

4

9

3

73

12

29

applet

3

application

3

12

22

contrib

34

2

74

151 contrib

41

163

10

164

figures

30

9

57

105 figures

18

107

21

88

framework

11

17

samples

8 applet 16 application

framework 71

125 samples

64

191

5

106

139 standard 36 util

15

29

35

131

3

23

25

42

144

626

112

569

standard

32

93

61

util

31

68

35

total

144

201

327

# res associated with inports

580 total

# res associated with outports 17

Shared Resources in V7.1 1→1 # res

m→1

403

samples

32

app

13

draw

255

1→n

119

6

m→n

1→1

6

undo

10

1

xml

13

27

geom

27

63

io

16

3

util

6

13

m→n

90 # res

403

119

182

90

182

90 samples

298

115

15

89

app

58

11

13

4

draw

42

116

146

86

15

4

163

86 1

31

1→n

182

beans gui

m→1

4

1

beans gui

1 5

1

undo

4

xml

2

2

6

2

geom io util

18

Discussion 

Compared to JHotDraw 6.0, JHotDraw 7.1   

 



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 ...

6. Library Management System(1). Faculty. putOnReserve () reserved(). Book. Item. DVD. Catalog. Student. Patron search() display(). okToBorrow () borrowed (). B. A. Faculty. putOnReserve (). Patron. Item. okToBorrow () reserved(). Book. Item. DVD. Catalog. Student. Patron search() display(). okToBorrow () borrowed().

221KB Sizes 0 Downloads 103 Views

Recommend Documents

Single studies using the CaseControl package - GitHub
Jun 29, 2016 - Loading data on the cases and potential controls from the database .... for which no matching control was found be removed from the analysis.

Single studies using the SelfControlledCaseSeries package - GitHub
Transforming the data into a format suitable for an SCCS study. .... Now we can tell SelfControlledCaseSeries to extract all necessary data for our analysis:.

Single studies using the CaseCrossover package - GitHub
Apr 21, 2017 - Loading data on the cases (and potential controls when performing a case-time-control analysis) from the database needed for matching. 2.

Single studies using the CohortMethod package - GitHub
Jun 19, 2017 - We need to tell R how to connect to the server where the data are. ..... work has been dedicated to provide the CohortMethod package.

PG Dating Pro Open Source package (All Modules)
RTL language support, 6+ payment systems, dynamic profile builder for unique profile & search forms, SEO module, ... MFNRocks streams music 24/7 365 . ... PG Dating Pro Open Source package (All Modules) Pc All New Software Download.

Interpretation of Complex STR Results Using the Forensim Package
A detailed description of forensim is given in the package tutorial, avail- .... The analysis button launches a window where you have to specify the model param-.

SOUND SOURCE SEPARATION USING ... - Research at Google
distribution between 0 dB up to clean. Index Terms— Far-field Speech Recognition, Sound ... Recently, we observed that training using noisy data gen- erated using “room simulator” [7] improves speech ... it turns out that they may show degradat

The PythonTeX package
It would be nice for the print statement/function,6 or its equivalent, to automatically return its output within the LATEX document. For example, using python.sty it is .... If you are installing in TEXMFLOCAL, the paths will have an additional local

understanding open source and free software licensing pdf ...
Page 1 of 1. understanding open source and free software licensing pdf. understanding open source and free software licensing pdf. Open. Extract. Open with.

The graphicx package
Feb 16, 1999 - Various existing packages (for LATEX 2.09) have ... For this reason this graphicx package, .... 28 \def\Gread@parse@vp#1 #2 #3 #4 #5\\{%. 29.

Understanding International Price Differences Using Barcode Data ...
of market segmentation from the behavior of price indexes, aggregate prices of goods ... large within-country idiosyncratic variation of relative goods prices while ..... The foregoing analysis provides a simple roadmap for understanding the way ...

Spoken Language Understanding using the Hidden ...
Apr 15, 2005 - The Hidden Vector State (HVS) model is an extension of the basic discrete Markov model in which context is encoded as a stack-oriented state vector. State transitions are factored into a stack shift operation similar to those of a push

Guide to Using Open-Source Software to ... - Mercogliano Isidoro
the product to address business critical issues. Sun announced the GlassFish Portfolio to enable enterprises to take advantage of open-source innovation in the Web application platform space while enjoying the assurance of enterprise-class support. T