21
Exploring Role Based Adaptation Exploring Role-Based Adaptation Sebastian Götz Defense Großer Beleg20 11 08 Sebastian Götz, Defense Großer Beleg 20.11.08

Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

Exploring Role Based AdaptationExploring Role-Based Adaptation

Sebastian Götz Defense “Großer Beleg” 20 11 08Sebastian Götz, Defense Großer Beleg 20.11.08

Page 2: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

OutlineTU Dresden - Faculty of Computer Science - Software Engineering Group

1. Motivation

2. Elements of Role-based Adapters

3. Realization in ObjectTeams/Java

4. Demo

5. Conclusion

6. Future Work

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz) Slide 1 of 13

Page 3: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

1. MotivationTU Dresden - Faculty of Computer Science - Software Engineering Group

Student Report

?printGrades() : voidgetMatrikel()  : int

printReport(data: DataRows) : void?DBComponent

• already existedretrieve(q: DBQuery) : ResultSet• is to be improved

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz) Slide 2 of 13

Page 4: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

1. MotivationTU Dresden - Faculty of Computer Science - Software Engineering Group

Adapter Design Pattern [1] applied twiceintertwined code

Student Reportreport

Target 1&2

Adapter 1&2

Adaptee 1

printGrades() : voidgetMatrikel() : int

printReport(data: DataRows) : void

DBComponent//Create Query from Student‘s DataDBQuery q = new DBQuery(…student.getMatrikel()…)ResultSet rs = db.retrieve(q);

Adaptee 2

retrieve(q: DBQuery) : ResultSetdb//Transform ResultSet to DataRowsDataRows data = new DataRows();Subject sbj = new Subject(rs.getString(1), rs.String(2));data.addString(sbj.toString())//…report.printReport(data);

Roles annotated as in [2]

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz) Slide 3 of 13

Page 5: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

1. MotivationTU Dresden - Faculty of Computer Science - Software Engineering Group

Goal: separation of adaptation concerns

Student Report

printGrades() : voidgetMatrikel()  : int

printReport(data: DataRows) : void

University Domain Reporting Domain

DBComponentDatabase Domain

separate:retrieve(q: DBQuery) : ResultSet

separate:• code of different domains• code for type conversion

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz) Slide 4 of 13

Page 6: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

2. Elements of Role-based AdaptersTU Dresden - Faculty of Computer Science - Software Engineering Group

implement adapter roles as first-order programming constructs

StudentTarget 1&2

Adapter 1&2Report

Adaptee 1

printGrades() : voidgetMatrikel()  : int

printReport(data: DataRows) : void

DBComponentAdaptee 2

retrieve(q: DBQuery) : ResultSet

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz) Slide 5 of 13

Page 7: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

2. Elements of Role-based AdaptersTU Dresden - Faculty of Computer Science - Software Engineering Group

split adapter

Student Report<<playedBy>>

printGrades() : voidgetMatrikel()  : int

printReport(data: DataRows) : void

<<playedBy>>

p y y

DBComponentStudentIn

ReportOut

M

<<playedBy>>

<<playedBy>>

retrieve(q: DBQuery) : ResultSetStudentIn

DBOut

M

target role adapter role adaptee role

client role omitted (as it is left open)

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz) Slide 6 of 13

client role omitted (as it is left open)

Page 8: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

2. Elements of Role-based AdaptersTU Dresden - Faculty of Computer Science - Software Engineering Group

type conversion implemented twice (for Report and DB component)code replication

ReportStudent

University Domain Reporting Domain

DBComponent

y

Customer

Selling Domain Database Domain

type conversion should not be the task of In-/Out-Roles

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz) Slide 7 of 13

Page 9: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

2. Elements of Role-based AdaptersTU Dresden - Faculty of Computer Science - Software Engineering Group

UniAmbassador ReportingAmbassador

Student Report

UniAmbassador ReportingAmbassador

printGrades() : voidgetMatrikel()  : int

printReport(data: DataRows) : void

DatabaseAmbassador

DBComponentStudentIn

ReportOut

Mretrieve(q: DBQuery) : ResultSet

StudentIn

DBOut

M

Ambassadors for type conversionno code replicationreuseable

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz) Slide 8 of 13

Page 10: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

3. Realization in ObjectTeams/JavaTU Dresden - Faculty of Computer Science - Software Engineering Group

use ObjectTeams [3]roles are played by actors in a context [4]roles are played by actors in a context [4]

MyTeamT 0 1 BasePackageMyTeam

+ teamMethod(z : TypeZ) : TypeY- teamField : TypeX

BasePackage

MyRole R

roleMeth1roleMeth2

MyBaseClass

method1()th d2()

«playedBy»

roleMeth1 «method1roleMeth2 »method2

method2()

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz) Slide 9 of 13

Page 11: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

3. Realization in ObjectTeams/JavaTU Dresden - Faculty of Computer Science - Software Engineering Group

Student Report

printGrades() : voidgetMatrikel()  : int

printReport(data: DataRows) : voiddB

StudentAdapterT 0 1

ayed

By»«p

laye

+distribute(matrikel : int) : voidDBComponent

retrieve(q: DBQuery) : ResultSet

StudentIn R

printGrades « printGrades

«pla

By»

+distribute(matrikel : int) : void

printGrades printGrades

ReportOut R

printReport » printReport «pla

yedBcallin

DBOut R

retrieve » retrieve

calloutAmbassadors are omitted for clarity.

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz) Slide 10 of 13

Page 12: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

4. DemonstrationTU Dresden - Faculty of Computer Science - Software Engineering Group

Demonstration

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz) Slide 11 of 13

Page 13: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

5. ConclusionTU Dresden - Faculty of Computer Science - Software Engineering Group

Advantages Disadvantages

• Less effort for maintenance • More initial coding effort

• More flexible allocation of developers

• More initial training effort

• Easier development of adapters

• (Reusable Ambassadors)

Published as ECOOP-workshop paper [5] at RAM-SE 2008

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz) Slide 12 of 13

Page 14: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

6. Future WorkTU Dresden - Faculty of Computer Science - Software Engineering Group

• Collection of Empirical Data Using an Experiment

• Parameterizable RBAs

Using RBAs for Change Encapsulation• Using RBAs for Change Encapsulation

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz) Slide 13 of 13

Page 15: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering GroupTU Dresden - Faculty of Computer Science - Software Engineering Group

Thank you very much for your attention.

Any Questions ?

Exploring Role-Based Adaptation (Sebastian Götz)TU Dresden, 20.11.2008

Page 16: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

5. Future WorkTU Dresden - Faculty of Computer Science - Software Engineering Group

• Collection of Empirical Data Using an Experiment

- 2 Teams of 5 Students each

1st Phase:- 1st Team develops the UMS using class-based adapters- 2nd Team uses RBAs2nd Team uses RBAs

2nd Phase:B th T i t t f h- Both Teams incorporate a set of changes

Time measurement, Software Metrics and Surveys after 1st and 2nd Phase.

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz)

Page 17: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

5. Future WorkTU Dresden - Faculty of Computer Science - Software Engineering Group

• Parameterizable Role-based Adapters

– RBAs take an ordered set of components as parameter

T*C1(1)

RBA

T

C2(2)

(3)C3

(3)

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz)

Page 18: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

5. Future WorkTU Dresden - Faculty of Computer Science - Software Engineering Group

• Sequence RBA

C1 C3C2RBA C1 C3C2RBAm1()

am2(a)

Return value of C(n) is passed as

C( 1)( )

m3(b)b

c

argument to C(n+1)

• Pick RBA

C1 C3C2RBA C1 C3C2RBAm1()

„use 3rd“ C(1) decides, whichC(n) to call

m3(b)c

C(n) to call

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz)

Page 19: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

5. Future WorkTU Dresden - Faculty of Computer Science - Software Engineering Group

• Using Role-based Adapters for Change Encapsulation

RBA1UMS V1 DB V1

Reporting V1

volu

tion eShop V1 RBA2

Ev RBA1UMS V1

Reporting V2

DB V1

eShop V1 RBA2

– Easy location of positions in code to change

Reporting V2eShop V1 RBA2

Easy location of positions in code to change– But multipe RBAs need to be adjusted

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz)

Page 20: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

5. Future WorkTU Dresden - Faculty of Computer Science - Software Engineering Group

• Using Role-based Adapters for Change Encapsulation

C2RBAC1

RBA C3 V1 C3 V2

- Put an RBA in front of the new version- Adapt new version to old version

Role-based realization of ComeBack-adapters [6]Role based realization of ComeBack adapters [6]

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz)

Page 21: Exploring Role-Based Adaptation - TU Dresdenst.inf.tu-dresden.de/sgoetz/papers/goetz-gb-defense.pdf · Reporting V2 DB V1 eShop V1 RBA2 ... Hannover. 2000 [5] Götz, S., Savga, I.:

TU Dresden Faculty of Computer Science Software Engineering Group

LiteratureTU Dresden - Faculty of Computer Science - Software Engineering Group

[1] Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading, Massachusetts (1995)(1995)

[2] Riehle, D.: Framework Design – A Role Modeling Approach. PhD-Thesis, Swiss federal institute of technology, Zurich. 2000.

[3] Herrmann, S., Hundt, C., Mosconi, M.: ObjectTeams/Java Language Definition - version 1.0. Technical Report 2007/03, Technical University Berlin (2007)

[4] Steimann, F.: Formale Modellierung mit Rollen. Habilitationsschrift, Universität Hannover. 2000

[5] Götz, S., Savga, I.: Exploring Role-Based Adaptation. In Proceedings of the 5th ECOOP'2008 Workshop on Reflection, AOP and Meta-Data for Software Evolution, RAM SE '08 2008RAM-SE '08. 2008

[6] Savga, I., Rudolf, M., Götz, S., Aßmann, U.: Practical Refactoring-based Framework Upgrade In Proceedings of the 7th Internaional Conference on Framework Upgrade. In Proceedings of the 7th Internaional Conference on Generative Programming and Component Engineering, GPCE'08, 2008.

TU Dresden, 20.11.2008 Exploring Role-Based Adaptation (Sebastian Götz)