feature location for multi-layer system based on formal concept analysis
DESCRIPTION
Presented at CSMR 2012http://dx.doi.org/10.1109/CSMR.2012.54TRANSCRIPT
Feature Location for Multi-Layer System Based on Formal Concept Analysis
†1 NTT Cyber Space Laboratories†2 Tokyo Institute of Technology
Hiroshi Kazato†1Shinpei Hayashi†2Satoshi Okada†1Shunsuke Miyata†1Takashi Hoshino†1Motoshi Saeki†2
Mo#va#on
• In mul#-‐layer systems, implementa#on of feature is o6en sca8ered across the applica#on
• Loca#ng features in mul#-‐layer systems (e.g. web applica#ons) poses a new challenge [Marcus 2005] [Dilshener 2011]
[Marcus 2005] Marcus et al.: “Static techniques for concept location in object-oriented code”, In Proc. of IWPC 2005, pp.33-42, 2005. [Dilshener 2011] Dilshener et al.: “Relating developers concepts and artefact vocabulary in a financial software module”, In Proc. of ICSM 2011, pp. 412-417, 2011
Related Work
• Semi-‐automa#c FL based on formal concept analysis of execu#on traces [Eisenbarth 2003]
[Eisenbarth 2003] Eisenbarth et al. : Locating Features in Source Code, IEEE TSE, 29(3) 210-224, 2003.
f1 f2 f3 u1 u2 u3 u4 u5 u6 u7
s1 ✔ ✔ ✔ ✔ ✔ ✔
s2 ✔ ✔ ✔ ✔ ✔ ✔
s3 ✔ ✔ ✔ ✔ ✔ ✔
Features Computa#onal Unit
(Methods or Func#ons)
({u7}, {s1, s2, s3})
({u1, u2, u3, u4, u5, u6, u7}, ø)
({u3, u5, u6, u7}, {s3}) ({u1, u4, u6, u7}, {s1})
({u5, u7}, {s2, s3})
({u2, u4, u5, u7}, {s2})
({u4, u7}, {s1, s2})
({u6, u7}, {s1, s3})
Our Goal
• Locate collabora#on which realizes features, composed of various kinds of program element in a mul#-‐layer system
Page 1
Table 1 Concept La^ce
Exis#ng
Technique
Proposed
Technique
Feature 1
…
Method 1
Method 2
Method 3
Concept La^ce
Feature 1
…
Method 1
Method 2
Method 3
Overview of the Proposed Technique
• Conduct dynamic analysis separately for each layers
• Interrelate observed elements by FCA
S (Scenarios)
L0 (Features)
L1 Presenta#on
L2 Applica#on
L3 Data
s1
s2
sl
f1 p11 /index.shtml
p12
p31 Browse Category
CatalogService. init()
PRODUCT
p21
p13
p14
p22
p23
p24
f2
f3
fm
p32
p33
p34
...
...
...
...
...
Prepareing Scenarios
Extrac#ng Execu#on Traces of Each Layer Applying FCA FL using Formal
Concepts
f2
p12 p23 p32
f1
p11 p21
p31 p22
Concept La^ce
Analyst
Example: iBATIS JPetStore 5.0
• Reference applica#on of Java EE – e-‐commerce system
• Three layers – L1: Presenta#on – L2: Applica#on – L3: Data
CHAPTER 11 ARCHITECTURE OF THE SAMPLE APPLICATION362
Figure 11.5 Use Cases between Customer and Web Site
A customer accessing the Web site expects to see:
• Links or navigation bars to common navigational tasks
• A catalog providing an organized view of the site’s contents
• A search mechanism
• A master view of catalog items
customer
Browse Catalog
Search Catalog
Browse Categories
Update Shopping Cart
Browse Item Details
Browse Product Details
Sign On and Off
Update Account
Update Personalization
Submit OrderSend Purchase Order
to Order Fulfillment Center<<include>>
DEA2e.book Page 362 Friday, March 8, 2002 12:31 AM
Usecases of JPetStore
Singh et al.: “Designing Enterprise Applications with the J2EE Platform, Second Edition”, Prentice Hall, 2002, Figure 11.5
Feature-‐Scenario Mapings s1 s2 s3 s4 s5 s6
f1: Browse Catalog ✔ ✔ ✔ ✔
f2: Search Catalog ✔
f3: Browse Categories ✔ ✔ ✔
f4: Browse Product Details ✔ ✔ ✔ ✔
f5: Browse Item Details ✔
f6: Update Shopping Cart ✔
f7: Sign On and Off ✔ ✔ ✔
f8: Update Account ✔
f9: Update Personalization ✔
f10: Submit Order ✔
L1: Presenta#on Layer
• Observe URL of web pages displayed in each scenario – from the headers of HTTP requests
2011-12-16 00:13:49,174 DEBUG HttpRefererLogger - http://localhost:8080/JPetStore-5.0/!2011-12-16 00:13:53,722 DEBUG HttpRefererLogger - http://localhost:8080/JPetStore-5.0/shop/index.shtml!2011-12-16 00:13:59,375 DEBUG HttpRefererLogger - http://localhost:8080/JPetStore-5.0/shop/viewCategory.shtml?categoryId=FISH!
L2: Applica#on Layer
• Observe Java methods executed during scenarios
...!
1329320179938,16,MethodEntry,1!
1329320179938,16,MethodEntry,33!
1329320179939,16,ClassLoad,
1529,"com.ibatis.jpetstore.persistence.DaoConfig"!
1329320179939,16,MethodInstrument,1529,150,
"com.ibatis.jpetstore.persistence.DaoConfig.<clinit>()"!
1329320179945,16,MethodInstrument,1529,151,
"com.ibatis.jpetstore.persistence.DaoConfig.getDaoManager()"!
1329320179950,16,MethodInstrument,1529,152,
"com.ibatis.jpetstore.persistence.DaoConfig.newDaoManager(java.util.Pro
perties)"!
1329320179954,16,MethodEntry,150!
1329320179954,16,MethodEntry,152!
...
L3: Data Layer
• Observe database tables manipulated during scenarios – from SQL statement logs
2011-12-16 00:24:04,836 DEBUG Connection - {conn-100000} Connection!
2011-12-16 00:24:04,918 DEBUG PreparedStatement - {pstm-100001}
PreparedStatement: select PRODUCTID, NAME, DESCN as description, CATEGORY
as categoryId from PRODUCT WHERE lower(name) like ? OR lower(category)
like ? OR lower(descn) like ? !
2011-12-16 00:24:04,918 DEBUG PreparedStatement - {pstm-100001}
Parameters: [%koi%, %koi%, %koi%]!
2011-12-16 00:24:04,918 DEBUG PreparedStatement - {pstm-100001} Types:
[java.lang.String, java.lang.String, java.lang.String]!
2011-12-16 00:24:04,944 DEBUG ResultSet - {rset-100002} ResultSet!
...
Formal Context
• Merge traces for all scenarios and layers L0: Features L1: Presenta#on L2: Applica#on L3: Data
f1 … f10 /in
dex.shtm
l
…
/sho
p/view
prod
uct.shtml
AbstractBe
an
.setMessage(String)
…
Sequ
enceSqlM
apDa
o.getNextId
(String)
ACCO
UNT
…
SIGN
ON
s1 ✔ … ✔ … … …
s2 ✔ … ✔ … ✔ … …
s3 ✔ … ✔ ✔ … ✔ ✔ … ✔ ✔ … ✔
s4 … ✔ … … ✔ … ✔
s5 … ✔ … … ✔ … ✔
s6 ✔ … ✔ … … …
Loca#ng Features in Formal Concepts
f3: Browse Categories!!/shop/viewCategory.shtml!CatalogBean.getCategory()!CatalogBean.setCategoryId(String)!CatalogBean.viewCategory()!CatalogService.getCategory(String)!Category.getName()!Category.setCategoryId(String)!Category.setDescription(String)!Category.setName(String)!CategorySqlMapDao.getCategory(String)!@CATEGORY!
c4 = ({s1}, {f3, ... })
c10 c7 c14 c6
c12
c11 c9 c13
c8
c3
c1
c2
c5
Analyzing the Concept La^ce
c10 = ({s5}, {f8, f9, ... }) [ 2 / 17 / 0 ]
c7 = ({s2}, {f5, ... }) [ 0 / 4 / 0 ]
c14 = ({s6}, {f2, ... }) [ 1 / 6 / 0 ]
c6 = ({s3}, {f6, f10, ... }) [ 5 / 103 / 4 ]
f1: Browse Catalog!f4: Browse Product Details!!CatalogBean.getItemList()!CatalogBean.getProduct()!CatalogBean.getProductList()!CatalogBean.setProductId(String)!CatalogBean.viewProduct()!CatalogService.getItemListByProduct(String)!CatalogService.getProduct(String)!Item.getAttribute1()!Item.getAttribute2()!Item.getAttribute3()!Item.getAttribute4()!Item.getAttribute5()!Item.getItemId()!Item.getListPrice()!Item.getProduct()!Item.getProductId()!Item.setAttribute1(String)!Item.setAttribute2(String)!Item.setAttribute3(String)!Item.setAttribute4(String)!Item.setAttribute5(String)!Item.setItemId(String)!Item.setListPrice(BigDecimal)!Item.setProduct(Product)!Item.setStatus(String)!Item.setSupplierId(int)!Item.setUnitCost(BigDecimal)!ItemSqlMapDao.getItemListByProduct(String)!Product.getCategoryId()!Product.getName()!Product.getProductId()!ProductSqlMapDao.getProduct(String)!@ITEM!
c12 = (ø, {f1, f4, ... }) [ 0 / 32 / 1 ]
c11 [ 0 / 8 / 0 ]
c9 = ({s4}, { ... }) [ 1 / 2 / 0 ]
f3: Browse Categories!!/shop/viewCategory.shtml!CatalogBean.getCategory()!CatalogBean.setCategoryId(String)!CatalogBean.viewCategory()!CatalogService.getCategory(String)!Category.getName()!Category.setCategoryId(String)!Category.setDescription(String)!Category.setName(String)!CategorySqlMapDao.getCategory(String)!@CATEGORY!
c4 = ({s1}, {f3, ... }) [ 1 / 9 / 1 ]
f2: Search Catalog!!/shop/searchProducts.shtml!CatalogBean.searchProducts()!CatalogBean.setKeyword(String)!CatalogService.searchProductList(String)!ProductSqlMapDao.searchProductList(String)!ProductSqlMapDao$ProductSearch.getKeywordList()!ProductSqlMapDao$ProductSearch(String)!
f5: Browse Item Details!!CatalogBean.getItem()!CatalogBean.setItemId(String)!CatalogBean.viewItem()!Item.getQuantity()!
c13 [ 0 / 1 / 0 ]
c8 = (ø, {f7, ... }) [ 1 / 36 / 4 ]
c3 [ 0 / 2 / 0 ]
c1 [ 2 / 17 / 1 ]
formal concept related to a feature formal concept related to two or more features formal concept related to no specific feature
[ p / a / d ] # of program elements from presenta#on / applica#on / data layers
c2 = (ø, ø)���[ 0 / 0 / 0 ]
c5 = (ø, { ... }) [ 1 / 3 / 1 ] /shop/viewProduct.shtml!CatalogService.getItem(String)!Item.setQuantity(int)!ItemSqlMapDao.getItem(String)!@INVENTORY!
/shop/signonForm.shtml!AccountBean.clear()!AccountBean.signoff()!
Discussion
• Advantages to exis#ng FLTs – Incorporate different kinds of elements into FL
• Flexibility to mul#-‐layer systems – Independent from the number and combina#on of layers
• Understanding complicated concepts – Concepts may contain many elements – Metrics and/or visualiza#on of program elements contained in those concepts may help
Conclusion
• Proposed a semi-‐automa#c technique to locate features in a mul#-‐layer system – by extending exis#ng technique based on FCA and dynamic analysis
• Showed the feasibility – by applying it to the example of web applica#on based on typical three-‐layer architecture of Java EE
Conclus#on
• Future work – Suppor#ng analysis of formal concepts – Conduc#ng a case study through industrial and open-‐sourced mul#-‐layer systems
Overview'of'the'Proposed'Technique�
• Conduct'dynamic'analysis'separately'for'each'layers'
• Interrelate'observed'elements'by'FCA'
S'(Scenarios)�
L0'(Features)�
L1'PresentaCon�
L2'ApplicaCon�
L3'Data�
s1�
s2�
sl�
f1' p11'/index.shtml�
p12'
p31�Browse'Category�
CatalogService.'init()�
PRODUCT�
p21�
p13'
p14'
p22�
p23�
p24�
f2'
f3'
fm(
p32�
p33�
p34�
...�
...�
...�
...�
...�
Prepareing'Scenarios�
ExtracCng'ExecuCon'Traces'of'Each'Layer'
Applying'FCA�FL'using'Formal'
Concepts�
f2'
p12' p23� p32�
f1'
p11'p21�
p31�p22�
Concept'LaQce�
Analyst�
Concept(La+ce�
f3: Browse Categories!!/shop/viewCategory.shtml!CatalogBean.getCategory()!CatalogBean.setCategoryId(String)!CatalogBean.viewCategory()!CatalogService.getCategory(String)!Category.getName()!Category.setCategoryId(String)!Category.setDescription(String)!Category.setName(String)!CategorySqlMapDao.getCategory(String)!@CATEGORY!
c4 = ({s1}, {f3, ... })
c10 c7 c14 c6(
c12(
c11 c9 c13
c8(
c3
c1
c2
c5(
Credit
• "Day 273 -‐ Tiny Trachodon" by puuikibeach – h8p://www.flickr.com/photos/puuikibeach/3768359322