BoBs: Breakable Objects Building blocks for flexible application - - PowerPoint PPT Presentation

bobs breakable objects
SMART_READER_LITE
LIVE PREVIEW

BoBs: Breakable Objects Building blocks for flexible application - - PowerPoint PPT Presentation

BoBs: Breakable Objects Building blocks for flexible application architectures Ph.D. Viva-Voce July 23 rd 2007 Vikram Jamwal Advisor: Prof. Sridhar Iyer IIT Bombay, Mumbai Contents Problem and Motivations Breakable Object (BoB)


slide-1
SLIDE 1

BoBs: Breakable Objects

Building blocks for flexible application architectures

Ph.D. Viva-Voce July 23rd 2007

Vikram Jamwal Advisor: Prof. Sridhar Iyer IIT Bombay, Mumbai

slide-2
SLIDE 2

Contents

 Problem and Motivations  Breakable Object (BoB) basics  BoB for application partitioning  BoB as elements of reuse  Related work comparisons  Discussion and conclusions

slide-3
SLIDE 3

Contents

 Problem and Motivations  BoB basics  BoBs for application partitioning  BoBs as elements of reuse  Related work comparisons  Discussion and conclusions

slide-4
SLIDE 4

Given

 Computing devices with

various capabilities

 Networks which are

diverse

 Applications need to

adapt

 to different

deployment scenarios

slide-5
SLIDE 5

Furthermore…

 Applications need to evolve  Change in user requirements  Different sets of user requirements  Restructuring for

  • better maintenance
  • better performance
slide-6
SLIDE 6

A A/ Aσ

Refactor Redesign Adapt Adapt

Application adaptation

slide-7
SLIDE 7

Broader Problem

 Design and implement an application  Such that

 Given the software for one scenario, we can generate a

version of application for a new scenario

  • Through refactoring ( and / or ) adaptation
  • Easily
  • Automatically ?

Scenario specific Transformations

Scenario B Scenario A

?

slide-8
SLIDE 8

Problems:

1.

Environmental Heterogeneity

2.

Distribution of Components

3.

Functionality Partitioning

(1) and (2) active areas of research, many solutions exist

(3) still requires adequate attention

slide-9
SLIDE 9

Motivating Example

 E-mail Application  Different devices  PC, Web-Client, Mobile

Device

 Different Modes / Scenarios  On-line  Disconnected  Off-line

slide-10
SLIDE 10

Functionality Partitioning

 Apportioning application functionality into

deployment specific component sub-sets

 Difficult to achieve in practice because we

cannot draw clean lines of separation

 Some functionality may span across

multiple classes

 A single class may contain multiple

functionality

slide-11
SLIDE 11

E-mail Internals(jwma)

slide-12
SLIDE 12

E-mail-design

 Different

partitioning for different versions

 Store class on

server

 Folder class

partitioned between user and server

E-mail Client GUI

Folder-2 Folder-Impl Login <<abstract>> Folder

javax.mail

IMAP Folder <<abstract>> Message Multipart MimeMessage BodyPart <<interface>> Part <<abstract>> Sore Service #folder #store Preferences AddressBook Message-Impl

slide-13
SLIDE 13

More specific problem:

 Design and implement an OO application

such that

 functionality of constituent objects is factorable

 The part-units

 are of desired granularity  can be easily extracted  are reusable  How?

slide-14
SLIDE 14

Jwma Classes

JwmaDisplayMessage JwmaFolder <<interface>> JwmaFolderImpl JwmaFolderList JwmaInboxInfo <<interface>> JwmaMessage <<interface>> JwmaMessageInfo <<interface>> JwmaMessageInfoImpl JwmaMessageInfoListImpl JwmaMessagePart <<interface>> JwmaMessagePartImpl JwmaStoreImpl JwmaStoreInfo <<interface>> JwmaTrashInfo <<interface>> #m_Subfolder m_messageInfoList List(from util) m_Folders m_MessageInfos MessageInfoListImpl is used to keep handy information about mssages in a folder for sorting etc. MessageSorting(from util)

  • m_ActualFolder

#m_Store

  • m_Folders

ComposeMessage

  • m_RepliedMessage
  • m_MessageParts[]

#m_ActualMessage

slide-15
SLIDE 15

Jwma Folder

JwmaFolder <<interface>> JwmaFolderImpl
  • log: Logger = Logger.getLogger(JwmaFolderImpl.class)
#m_Name: String #m_Path: String #m_Type: int #m_OnlineCounting: boolean #m_DraftProfile: FetchProfile <<create>>-JwmaFolderImpl(f: Folder) <<create>>-JwmaFolderImpl(f: Folder, store: JwmaStoreImpl) +getName(): String
  • setName(name: String)
+getPath(): String
  • setPath(path: String)
+getType(): int
  • setType(type: int)
+isType(type: int): boolean +isSubscribed(): boolean +setSubscribed(b: boolean) +getFolder(): Folder +isOnlineCounting(): boolean +setOnlineCounting(b: boolean) +addIfSubfolder(folder: JwmaFolderImpl) +removeIfSubfolder(path: String) +removeIfSubfolder(folders: String) +isSubfolder(folder: String, possiblesubfolder: String): boolean +listSubfolders(type: int): JwmaFolder +listSubfolders(): JwmaFolder +listSubfolders(type: int, subscribed: boolean): JwmaFolder +hasSubfolders(): boolean +hasMessages(): boolean +getNewMessageCount(): int +hasNewMessages(): boolean +getUnreadMessageCount(): int +hasUnreadMessages(): boolean +getMessageCount(): int +isEmpty(): boolean +getActualMessage(): JwmaMessage
  • getMessage(num: int): Message
+getReadMessages(): int +getNextMessageNumber(): int +getPreviousMessageNumber(): int +checkMessageExistence(number: int): boolean +getJwmaMessage(num: int): JwmaMessage +getDraftMessage(num: int): JwmaMessage +listMessageInfos(): JwmaMessageInfo +getMessageInfoList(): JwmaMessageInfoListImpl +deleteActualMessage(): int +deleteMessage(number: int) +deleteAllMessages() +deleteMessages(numbers: int) +moveActualMessage(destfolder: String): int +moveMessage(number: int, destfolder: String) +moveMessages(numbers: int, destfolder: String) +writeMessagePart(part: Part, out: OutputStream) +equals(o: Object): boolean +prepare() +update(store: JwmaStoreImpl) +createJwmaFolderImpl(store: JwmaStoreImpl, f: Folder): JwmaFolderImpl +createJwmaFolderImpl(store: JwmaStoreImpl, fullname: String): JwmaFolderImpl +createLight(folder: Folder): JwmaFolderImpl JwmaInboxInfo <<interface>> JwmaMessage #m_ActualMessage JwmaMessageInfoListImpl #m_MessageInfoList JwmaStoreImpl #m_Store
  • m_TrashFolder
  • m_JwmaRootFolder
  • m_ActualFolder
  • m_InboxFolder
JwmaStoreInfo <<interface>> JwmaTrashInfo <<interface>> javax.mail.Folder #m_Folder JwmaFolderList #m_SubFolders
  • m_Folders
slide-16
SLIDE 16

Our solution:

 Reformulate basic component of the application

so that it can be readily partitioned into sub- components

 Hence Breakable Objects (BoBs)  Main Advantage:

 Designing and implementing applications using

BoBs makes them more flexible; specifically, more amenable to partitioning. ฀

slide-17
SLIDE 17

Account +Id +Debit() +Credit() +getBalance() Savings ATM Single +userName Shared +usersNameList Checking LifeLine Senior/StudentChecking MoneyMarket Account +Id +Debit() +Credit() +getBalance() Savings ATM Checking LifeLine Senior/StudentChecking MoneyMarket SingleATM SharedATM SingleSaving SharedSaving

Other issues:

slide-18
SLIDE 18

Problems with inheritance and composibility

 Decomposition Duplicated Features Inappropriate hierarchies Duplicated wrappers  Composition Conflicting Features Fragile Hierarchies

slide-19
SLIDE 19

Other issues:

 Inheritance based composition

mechanisms

 Problem of software contraction  Large software sizes Heavier and more complex versions

slide-20
SLIDE 20

Javax Record Store

InvalidRecordIDException RecordComparator <<interface>> +compare(rec1: byte, rec2: byte): int RecordEnumeration <<interface>> +numRecords(): int +nextRecord(): byte +nextRecordId(): int +previousRecord(): byte +previousRecordId(): int +hasNextElement(): boolean +hasPreviousElement(): boolean +reset() +rebuild() +keepUpdated(keepUpdated: boolean) +isKeptUpdated(): boolean +destroy() RecordEnumerationImpl +numRecords(): int +nextRecord(): byte +nextRecordId(): int +previousRecord(): byte +previousRecordId(): int +hasNextElement(): boolean +hasPreviousElement(): boolean +reset() +rebuild() +keepUpdated(keepUpdated: boolean) +isKeptUpdated(): boolean +recordAdded(recordStore: RecordStore, recordId: int) +recordChanged(recordStore: RecordStore, recordId: int) +recordDeleted(recordStore: RecordStore, recordId: int) +destroy() RecordFilter <<interface>> +matches(candidate: byte): boolean RecordListener <<interface>> +recordAdded(recordStore: RecordStore, recordId: int) +recordChanged(recordStore: RecordStore, recordId: int) +recordDeleted(recordStore: RecordStore, recordId: int) RecordStore +AUTHMODE_PRIVATE: int +AUTHMODE_ANY: int +deleteRecordStore(recordStoreName: String) +openRecordStore(recordStoreName: String, createIfNecessary: boolean): RecordStore +openRecordStore(recordStoreName: String, createIfNecessary: boolean, authmode: int, writable: bool ean): RecordStore +openRecordStore(recordStoreName: String, vendorName: String, suiteName: String): RecordStore +setMode(authmode: int, writable: boolean) +closeRecordStore() +listRecordStores(): String +getName(): String +getVersion(): int +getNumRecords(): int +getSize(): int +getSizeAvailable(): int +getLastModified(): long +addRecordListener(listener: RecordListener) +removeRecordListener(listener: RecordListener) +getNextRecordID(): int +addRecord(data: byte, offset: int, numBytes: int): int +deleteRecord(recordId: int) +getRecordSize(recordId: int): int +getRecord(recordId: int, buffer: byte, offset: int): int +getRecord(recordId: int): byte +setRecord(recordId: int, newData: byte, offset: int, numBytes: int) +enumerateRecords(filter: RecordFilter, comparator: RecordComparator, keepUpdated: boolean): Record Enumeration RecordStoreException RecordStoreFullException RecordStoreNotFoundException RecordStoreNotOpenException
slide-21
SLIDE 21

Implementation

RecordStore + AUTHMODE_PRIVATE: int = 0 + AUTHMODE_ANY: int = 1
  • AUTHMODE_ANY_RO: int = 2
  • DB_INIT: byte[* ] = { }
  • SIGNATURE_LENGTH: int = 8
  • DB_RECORD_HEADER_LENGTH: int = 16
  • DB_BLOCK_SIZE: int = 16
  • DB_COMPACTBUFFER_SIZE: int = 64
  • dbCache: java.util.Vector = new java.util.Vector(3)
  • dbCacheLock: Object = new Object()
  • recordStoreName: String
  • uniqueIdPath: String
  • opencount: int
  • dbraf: RecordStoreFile
~ rsLock: Object
  • recordListener: java.util.Vector
  • recHeadCache: RecordHeaderCache
  • CACHE_SIZE: int = 8
  • recHeadBuf: byte[* ] = new byte[DB_RECORD_HEADER_LENGTH]
  • dbNextRecordID: int = 1
  • dbVersion: int
  • dbAuthMode: int
  • dbNumLiveRecords: int
  • dbLastModified: long
  • dbFirstRecordOffset: int
  • dbFirstFreeBlockOffset: int
  • dbDataStart: int = 48
  • dbDataEnd: int = 48
  • dbState: byte[* ] = new byte[DB_INIT.length]
  • RS_SIGNATURE: int = 0
  • RS_NUM_LIVE: int = 8
  • RS_AUTHMODE: int = 12
  • RS_VERSION: int = 16
  • RS_NEXT_ID: int = 20
  • RS_REC_START: int = 24
  • RS_FREE_START: int = 28
  • RS_LAST_MODIFIED: int = 32
  • RS_DATA_START: int = 40
  • RS_DATA_END: int = 44
< < create> > -RecordStore() < < create> > -RecordStore(uidPath: String, recordStoreName: String, create: boolean) + deleteRecordStore(recordStoreName: String) + openRecordStore(recordStoreName: String, createIfNecessary: boolean): RecordStore + openRecordStore(recordStoreName: String, createIfNecessary: boolean, authmode: int, writable: boolean): RecordStore + openRecordStore(recordStoreName: String, vendorName: String, suiteName: String): RecordStore + setMode(authmode: int, writable: boolean) + closeRecordStore() + listRecordStores(): String + getName(): String + getVersion(): int + getNumRecords(): int + getSize(): int + getSizeAvailable(): int + getLastModified(): long + addRecordListener(listener: RecordListener) + removeRecordListener(listener: RecordListener) + getNextRecordID(): int + addRecord(data: byte, offset: int, numBytes: int): int + deleteRecord(recordId: int) + getRecordSize(recordId: int): int + getRecord(recordId: int, buffer: byte, offset: int): int + getRecord(recordId: int): byte + setRecord(recordId: int, newData: byte, offset: int, numBytes: int) + enumerateRecords(filter: RecordFilter, comparator: RecordComparator, keepUpdated: boolean): RecordEnumeration
  • findRecord(recordId: int, addToCache: boolean): RecordHeader
  • getAllocSize(numBytes: int): int
  • allocateNewRecordStorage(id: int, dataSize: int): RecordHeader
  • splitRecord(recHead: RecordHeader, allocSize: int)
  • freeRecord(rh: RecordHeader)
  • removeFreeBlock(blockToFree: RecordHeader)
  • storeDBState()
~ isOpen(): boolean
  • checkOpen()
  • notifyRecordChangedListeners(recordId: int)
  • notifyRecordAddedListeners(recordId: int)
  • notifyRecordDeletedListeners(recordId: int)
~ getInt(data: byte, offset: int): int ~ getLong(data: byte, offset: int): long ~ putInt(i: int, data: byte, offset: int): int ~ putLong(l: long, data: byte, offset: int): int ~ getRecordIDs(): int
  • compactRecords()
  • checkOwner(): boolean
  • checkWritable(): boolean
slide-22
SLIDE 22

Contents

 Problem and Motivations  BoB basics  BoBs for application partitioning  BoBs as elements of reuse  Related work comparisons  Discussion and conclusions

slide-23
SLIDE 23

BoB

m1( )

A.bob

m2( ) m3( ) m4( ) m6( ) m5( ) Interface methods Together methods

slide-24
SLIDE 24

BoB Splits

m1 m2 m3 m4 m5 m6 m1 m2 m4 m3 m6 m1 m2 m5 m5 m3 m4 m6

Independent splits Interdependent splits

split-config-1 A-1 A-2 A-3 A-5 A-4

A

split-config-2

slide-25
SLIDE 25

Calculator CalculatorMUL CalculatorADD CalculatorSUB CalculatorDIV Denotes is-split-of and is-principal-of

  • relationships. The thick head lies towards

the principal class’s side.

slide-26
SLIDE 26

Contents

 Problem and Motivations  BoB basics  BoBs for application partitioning  BoBs as elements of reuse  Related work comparisons  Discussion and conclusions

slide-27
SLIDE 27

Program Reorganization

m1 m2 m4 m3 m6 m5

A-1 A-2 A-3

m1 m2 m3 m4 m5 m6

A

Client CL-1 Client CL-3 Client CL-2 After Splitting Client CL-1 Client CL-3 Client CL-2

m1() m3() m2() m4() m6() m2() m5() m4() m5() m3() m6() m1() split-config-1

slide-28
SLIDE 28

Redeployment

m1 m2 m4 m3 m6 m5

A-2 A-1

Client CL-1 Client CL-3 Client CL-2

m2() m4() m5() m3() m6() m1()

A-3 NODE-X NODE-Z NODE-Y

slide-29
SLIDE 29

BODA:Breakable Object

Driven Architecture

High Level Requirement Specification BoB based Application (Design) + (Implmentation) Application Functionality Specification Application Deployment Specification

+

Split Configuration SPLITTING ENGINE Application Topology - 1 Application Topology … Application Topology - n DEPLOYMENT ENGINE Deployment Configuration Application for Deployment Scenario – n Application for Deployment Scenario … Application for Deployment Scenario – 1

+ 2a 1 2b 6 8b 7 5b 8a 9 5a 1 4

split-cfg-1 split-cfg-1 split-cfg … dep-cfg … dep-cfg-1 dep- cfg-n

slide-30
SLIDE 30

Folder BoB

slide-31
SLIDE 31

Online-Disconnected- Offline

Folder-2 Folder-1 Folder-1

E-mail GUI

NODE - USER NODE - MAIL SERVER

E-mail GUI Folder List Msg List IMAP Folder IMAP Folder STORE STORE STORE E-mail GUI

Folder Folder-2

Folder List Msg List Folder List Msg List IMAP Folder

SPLIT CONFIG 1 ONLINE SPLIT CONFIG 3 SPLIT CONFIG 2 DISCONNECTED OFFLINE

slide-32
SLIDE 32

Programming Model

Allowed volatile Not Allowed transient Allowed final Allowed static Not Allowed package Not Allowed protected Allowed private Not Allowed public Field Declarations Allowed implements Interface Not Allowed extends Super Allowed class Name of Class Allowed (default) final Not Allowed abstract Allowed public Class declarations

Status in JAVABoB Construct in JAVA Status in JAVABoB Construct in JAVA

Not Allowed Nested Class / Inner Class Not Allowed Threads Allowed Exceptions Allowed Constructors Miscellaneous Allowed synchronized Not Allowed native Allowed final Not Allowed abstract Allowed static Not Allowed package Not Allowed protected Allowed private Allowed public Method Declarations

slide-33
SLIDE 33

Inheritance and BoBs

A M1 M2 M3 B M2 M4 M5 Split Config-1 S1 = M1, M2, M3 S2 = M4, M5 A M1 M2 M3 B1 M2 B2 M4 M5 BOB

slide-34
SLIDE 34

Inheritance and BoBs

A M1 M2 M3 B M2 M4 M5 Split Config-2 S1 = M1, M3, M4 S2 = M2, M5 A1 M1, M3 B1 M4 A2 M2 B2 M2 M5 BOB

slide-35
SLIDE 35

Inheritance and BoBs

A M1 M2 M3 B M2 M4 M5 Split Config-3 S3 = M1, M2, M7 S4 = M3, M8 A3 M1 M2 C1 M2 M7 A4 M3 C2 M8 C M2 M7 M8 A a = new A; A b = new B; ? A c = new C; ? Each child can split A in a unique way

slide-36
SLIDE 36

Retaining old type?

 Case 1, A remains along with A1, A2  Case 2, only A1 and A2 remain  We prefer case 2, and

  • allow only interface inheritance with the

condition that

  • all the methods of an interface are designated

together

 Recommended  Aggregation or delegation as the principal

composition mechanisms for BoBs.

  • Neater design, reduces complexity
slide-37
SLIDE 37

Class-level/object level

We do class-level partitioning

If we allow object-level partitioning

 i.e. we allow a BoB to be split in more than one way

For assignment, need to know the <type> of object on RHS and then convert it to the type being assigned (LHS)

A ax = new A();

A ay = new A();

ax split ax1 = m1, m2, split ax2 = m3

ay split ay1 = m2, split ay2 = m1, m3;

ax = ay ?

Such a support is not available in the present languages

Class level BoB partitioning - sufficient for meaningful applications

slide-38
SLIDE 38

Splitting Engine

CLIENT REORGANIZER CLIENT REORGANIZER SPLITTER SPLITTER

A.bob

CL-1.java

split-info

CL-2.java CL-3.java

SPLIT CONFIG BoB Internal

Dependency Graph

GENERATOR VALIDATOR

A1.java A2.java

CL-1.java CL-2.java CL-3.java

Program P Program: Psplit ( to Deployment Engine )

slide-39
SLIDE 39

Split Config

 Format

 Properties

 Only public methods are specified.  Every public method in each BoB has to be specified

as part of some split.

 A method cannot belong to more than one split.  Clubbed methods (identified by the together

construct) cannot be split.

Number of BoBs = n; BoB 1 BoB Name { No of splits = k; Split 1 = (‘;’ separated list of methods specified as MethodName (list ArgumentTypes) ) . . . Split k = . . . } BoB n BoB Name { . . . }

slide-40
SLIDE 40

Splitting Engine Details

 Algorithms  Program Equivalence split and non-split program versions  Equivalency Proofs  Details

slide-41
SLIDE 41

Deployment

 Presently uses mechanisms by  J-orchestra ,  Pangaea for BoB deployments  Both use RMI as the underlying

distribution mechanism

slide-42
SLIDE 42

.class J-Orchestra classifier J-Orchestra pofiler J-Orchestra translator User Partitioning Info Partitioned Application Original Bytecodes .class

slide-43
SLIDE 43

Centralized Program (100% Java) .java Distribution Requirements Analyser Backend-Adapter for (Java Party) for (CORBA) for (DOORASTHA) .java Distributed Program (backend-specific) DOORASTHA .class Executable Program

slide-44
SLIDE 44

A B C D E Partition - I Partition - II Partition - III

slide-45
SLIDE 45

D Partition - I Partition - II Partition - III A1 B1 C1 E1 A2 B2 C2 E2

Aux A1- A2 Aux B1- B2 Aux E1-E2

C3

Aux C1-C2

slide-46
SLIDE 46

Contents

 Problem and Motivations  BoB basics  BoBs for application partitioning  BoBs as elements of reuse  Related work comparisons  Discussion and conclusions

slide-47
SLIDE 47

Add BoB Remove BoB Modify BoB Create BoB Delete BoB SOURCE MANIPULATION LAYER SOURCE CODE LAYER Merge BoB A B C D E

slide-48
SLIDE 48

Add BoB Slice Remove BoB Slice Modify BoB Slice Create BoB Slice Delete BoB Slice SLICE MANIPULATION LAYER SOURCE CODE LAYER Merge BoB Slice A B C D E A1 B1 C1 D1 E1 A2 B2 C2 D2 E2 Split Merge

slide-49
SLIDE 49

Add Fragment Remove Fragment Modify Fragment External Fragment Delete Fragment BoB MANIPULATION LAYER BoB LAYER Merge Fragment BoB FRAGMENT LAYER A A1 A2 A3 Split Merge Extract from another BoB Create New

slide-50
SLIDE 50

Problems with inheritance and composibility

 Decomposition Duplicated Features Inappropriate hierarchies Duplicated wrappers  Composition Conflicting Features Fragile Hierarchies

slide-51
SLIDE 51

BoB Operators

 Split, Merge  Extract, Remove  Addition, Subtraction Overwriting Hierarchical  Replace

slide-52
SLIDE 52

A, {{m1,m2}, {m3}, {m4,m5},{m6}} Selection Set: Operation: split B12

m1 m2

B3

m3

B4

m4

A12

m2

A3 A45

m5 AUXB f

A6

m6 AUXA g m overriding method m interface method dependence

f

field

A

m2 m5 m6

B

m2 m3 m1 m4

f g

slide-53
SLIDE 53

Operation: merge A

m1 m3 m4

B

m2 m1

f g B1

m1

B2

m2

A1

m1

A23

AUXB f

A4

m4 AUXA h AUXA g AUXB f AUXA g AUXA g AUXA h

B1

m1 m2

B2

m3

A1

m1

A23

AUXB f

A4

m4 AUXA h AUXA g m3

h Selection Set: {A1,A23, A4}

slide-54
SLIDE 54
  • 1. A, {m1,m2}
  • 2. A, {m6}

Selection Sets: Operation: extract B12

m1 m2

A12

m2

A6

m6 AUXB f AUXA g AUXA g

Case (1) Case (2) A

m2 m5 m6

B

m2 m3 m1 m4

f g

slide-55
SLIDE 55

A, {m1,m2} Selection Sets: Operation: remove A

m2 m5 m6

B

m2 m3 m1 m4

f g B3

m3

B4

m4

A3 A45

m5 AUXB f

A6

m6 AUXA g

A

m5 m6

B

m3 m4

f g

slide-56
SLIDE 56

A + B Operation: fragment addition – hierarchical C

m1

A

m3 m2

B

m2 m3 m2 m1 m4

C

m1

A

m2 m3 m2 m1 m4

j k i k i A/

m3 m2

j f g f g f g x

Normal Field

y

Aux Field Interface Method

slide-57
SLIDE 57

A - B Operation: fragment subtraction - hierarchical C

m1

A

m2 m3 m2 m1 m4

k i B

m3 m2

j C

m1

A

m2 m3 m2 m1 m4

k i B

m3 m2

j f g g f g

slide-58
SLIDE 58

A (-) B Operation: fragment subtraction - overwriting C

m1

A

m2 m3 m2 m1 m4

k i B

m3 m2

j C

m1

A

m1 m4

k i B

m3 m2

j f g g f

slide-59
SLIDE 59

A (+) B Operation: fragment addition – overwriting C A

m3 m2

B

m2 m3 m2 m1 m4

C

m1

A

m2 m3 m2 m1 m4

j k i j k i f g f g g f

m1

slide-60
SLIDE 60

B # D Operation: fragment replacement C

m1

A

m2 m3 m2 m1 m4

k i B

m3 m2

j D

m5 m6

n C

m1

A

m2 m3 m2 m1 m4

k i D

m5 m6

n f g h f g h

slide-61
SLIDE 61

Example: Graph Product Line

 Family of classical graph applications  Typical of product lines  No two applications will have same set of features  Features of GPL  (Un)Directed, Weight, Search, Algorithm GPL := Gtp Wgt Src Alg+; Gtp := Directed | Undirected; Wgt := Weighted | Unweighted; Src := DFS | BFS | None; Alg := Number | Connected | StronglyConnected | Cycle | MST Prim | MST Kruskal | Shortest;

slide-62
SLIDE 62

MST Kruskal Weighted Directed MST Prim Undirected Cycle Transpose DFS BFS Number Strongly Connected Connected Shortest

A needs B B A Graph Top Layer Graph Algorithm Layer Graph (Un)Weighted Layer Graph Search Layer

slide-63
SLIDE 63
slide-64
SLIDE 64

Graph-Directed + vertices: LinkedList + edges: LinkedList + isDirected = true: Boolean + Graph() + run(): void + addAnEdge(star: Vertex, end, weight): void + addVertex(Vertex v): void + addEdge(Edge the_edge): void + addOnlyEdge(Edge the_edge): void + findsVertex(String theName): Vertex + display(): void Graph-Undirected + vertices: LinkedList + edges: LinkedList + isDirected = false: Boolean + Graph() + void run(Vertex s) + void addAnEdge(Vertex start, Vertex end, int weight) + void addVertex(Vertex v) + addEdge(Edge the_edge) + void addOnlyEdge(Edge the_edge) + Vertex findsVertex(String theName) + Edge findsEdge(Vertex theSource, Vertex theTarget) + void display() Edge + Vertex start + void EdgeConstructor(Vertex the_start, Vertex the_end) + void adjustAdorns(Edge the_edge) + void display() Neighbour + Vertex end + Edge edge + Neighbor() + Neighbor(Vertex v, Edge e) Vertex + LinkedList neighbors + String name + Vertex() + void VertexConstructor() + Vertex assignName(String name) + void addNeighbor(Neighbor n) + void display() Edge + Vertex start + void EdgeConstructor(Vertex the_start, Vertex the_end) + void adjustAdorns(Edge the_edge) + void display() Vertex + LinkedList neighbors + String name + Vertex() + void VertexConstructor() + Vertex assignName(String name) + void addNeighbor(Neighbor n) + void display() Neighbour + Vertex end + Edge edge + Neighbor() + Neighbor(Vertex v, Edge e)

slide-65
SLIDE 65

Graph-Weighted + void addAnEdge(Vertex start, Vertex end, int weight) Vertex-DFS + boolean visited + void VertexConstructor() + void init_vertex(WorkSpace w) + void dftNodeSearch(WorkSpace w) + void display() Kum, Deukkyu1 Edge-Weighted + int weight + EdgeConstructor(Vertex the_start, Vertex the_end, int the_weight) + void adjustAdorns(Edge the_edge) + void display() Graph-DFS + void GraphSearch(WorkSpace w) GlobalVarsWrapper + static LinkedList Queue = new LinkedList() Workspace + void init_vertex(Vertex v) + void preVisitAction(Vertex v) + void postVisitAction(Vertex v) + void nextRegionAction(Vertex v) + void checkNeighborAction(Vertex vsource, Vertex vtarget) Vertex-BFS + boolean visited + void VertexConstructor() + void init_vertex(WorkSpace w) + void bftNodeSearch(WorkSpace w) + void display() Graph-BFS + void GraphSearch(WorkSpace w) Workspace + void init_vertex(Vertex v) + void preVisitAction(Vertex v) + void postVisitAction(Vertex v) + void nextRegionAction(Vertex v) + void checkNeighborAction(Vertex vsource, Vertex vtarget)

slide-66
SLIDE 66

NumberWorkspace + int vertexCounter + NumberWorkSpace() + preVisitAction(Vertex v) Graph-Number + void run(Vertex s) + void NumberVertices() Vertex-Number + int VertexNumber + void display() Graph-Connected + void run(Vertex s) + void ConnectedComponents() Vertex-Connected + int componentNumber + void display() FinishTimeWorkSpace + int FinishCounter + FinishTimeWorkSpace() + void preVisitAction(Vertex v) + void postVisitAction(Vertex v) CycleWorkSpace + boolean AnyCycles + int counter + boolean isDirected + static final int WHITE = 0 + static final int GRAY = 1 + static final int BLACK = 2 + CycleWorkSpace(boolean UnDir) + void init_vertex(Vertex v) + void preVisitAction(Vertex v) + void postVisitAction(Vertex v) + void checkNeighborAction(Vertex vsource, Vertex vtarget) Graph-Cycle + void run(Vertex s) + boolean CycleCheck() WorkSpaceTranspose + int SCCCounter + WorkSpaceTranspose() + void preVisitAction(Vertex v) + void nextRegionAction(Vertex v) Vertex-StronglyConnected + int finishTime + int strongComponentNumber + void display() Graph-StronglyConnected + void run(Vertex s) + Graph StrongComponents() RegionWorkspace + int counter + RegionWorkSpace() + void init_vertex(Vertex v) + void postVisitAction(Vertex v) + nextRegionAction(Vertex v) Vertex-Cycle + int VertexCycle + int VertexColor + void display()

slide-67
SLIDE 67

Graph-MSTPrim + void run(Vertex s) + Graph Prim(Vertex r) Graph-Transpose + Graph ComputeTranspose(Graph the_graph) Vertex-Shortest + String predecessor + int dweight + void display() Graph-Shortest + void run(Vertex s) + Graph ShortestPath(Vertex s) Main + static void main(String[] args) Lim, Heejin1 Graph-Benchmark + Reader inFile + static int ch + static long last = 0, current= 0, accum= 0 + void runBenchmark(String FileName) + void stopBenchmark() + int readNumber() + static void startProfile() + static void stopProfile() + static void resumeProfile() + static void endProfile() Vertex-MSTPrim + String pred + int key + void display() Vertex-MSTKruskal + Vertex representative + LinkedList members + void display() Graph-MSTKruskal + void run(Vertex s) + Graph Kruskal(Vertex r)

slide-68
SLIDE 68

A

A1 A2 A3 to node Y to node Z to node X

A B C

mA1 mB2 mB3 mB1

A1 B13

mA1 mB3 mB1 mA1

+

Split

mB3 mB1

Extractpart Combinepart Deploy

A

mA1 mA2

A3

mA3

Add

A

mA1 mA3 mA2

A1

mA1

Subtract

A

mA3 mA2 mA2 mA3 mA2 mA1 mA3 mA1

Example Scenario –I Example Scenario –II Example Scenario –III

mA2

slide-69
SLIDE 69

Flavor

slide-70
SLIDE 70

Contents

 Problem and Motivations  BoB basics  BoBs for application partitioning  BoBs as elements of reuse  Related work comparisons  Discussion and conclusions

slide-71
SLIDE 71

Related Work/Comparison

 Traditional Objects  Related Composition Mechanisms  Traits, Jigsaw  Fragmented Objects  Fragmentation in Databases  Application Partitioning  Class Refactoring  Multi Dimension Separation of Concerns  Distributed Design Paradigms

slide-72
SLIDE 72

Objects

 Objects can be considered an

extreme case of BoB where:

 all the interface methods are

designated as together

 Other differences come from the

programming model chosen for BoBs.

slide-73
SLIDE 73

Operators in JIGSAW [GiladBracha92]

Merge

Yields the concatenation of two modules. Only non confliction attributes are considered

Modification

Overriding (M1 override M2)

Name conflict resolution

M rename a to b

Select

Returns the value of attribute named a in r

Restrict

Removes the attribute a from the module

Project

Retain particular attribute(s) definition(s)

Freeze

Statically binding an attribute a

Dual operation

  • freeze_all_except a

Attribute Visibility

M hide a, M show a

Rename: Access to overriden definitions

copy a as b

slide-74
SLIDE 74

Operators in Traits[Toplas06]

 Composing Classes

 Class = Superclass + State + Traits + Glue methods

 Trait Composition Operators Sum (+) Aliasing (->) Exclusion (-)

slide-75
SLIDE 75

Fragmented Objects (FOs)

 FO is a

 Distributed shared object  Clients in different address spalce  Internally a set of fragments  Fragments communicate through communication channels

 Comparison

 Very different concepts; distributed shared object v/s

breakable objects

 BoBs don’t carry the notion of distribution per say  BoBs can be used to build FOs

  • Possible to achieve dynamic FOs – form and the location of

fragments keeps on changin

 BoBs don’t retain a single identity after splitting

slide-76
SLIDE 76

Fragmentation in Databases

slide-77
SLIDE 77

Application Partitioning

 J-orchestra, Pangaea, Coign, Addistant  So far focused mainly on

 finding optimal ways to partition an application among

different nodes, and

 component conversions into distributed components.

 Our focus is:

 to have an entity which is more suitable for such

partitioning

 declarative approach to application partitioning.

 Granularity level of partitioning

 objects or components,  our case, granularity level

  • finer
  • related to the methods of a BoB.
slide-78
SLIDE 78

Class Refactoring

 Different refactoring methods have been proposed  Class refactoring method

 Extract Class  Extract Interface [Fowler:catalogue]

 provides a means to create new class by moving the

relevant fields Move Filed and methods Move Method from the old class into a new class.

 The main intent here is to improve the code design by

splitting bloated classes and creating new crisper classes.

 No comprehensive techniques exist to provide refactoring

  • f application classes for functional partitioning
slide-79
SLIDE 79

Distributed Design Paradigms

slide-80
SLIDE 80

Contents

 Problem and Motivations  BoB basics  BoBs for application partitioning  BoBs as elements of reuse  Related work comparisons  Discussion and conclusions

slide-81
SLIDE 81

Contributions of Work

 The concept of Breakable Object (or BoB)  BoBProgramming Model

 Structure

 Application Partitioning

 Splitting, Merging  Program Equivalence

  • Proof of equivalence

 BoB Driven Architecture (BODA)  BoB Composition Mechanisms

slide-82
SLIDE 82

Publications (related to this work)

  • 1. Automated Refactoring of Objects for Application Partitioning 12th

Asia-Pacific Software Engineering Conference (APSEC) ,Taipei , Taiwan, December 15-17,2005. Authors: Vikram Jamwal and Sridhar Iyer

  • 2. Breakable Objects: Building Blocks for Flexible Application

Architectures 5th Working IEEE/IFIP Conference on Software Architecture(WICSA), November 6 - 10, 2005, Pittsburgh, Pennsylvania, USA Authors: Vikram Jamwal and Sridhar Iyer

  • 3. BoBs: Breakable Objects (Poster Paper) 20th Object-Oriented

Programming, Systems, Languages And Applications (OOPSLA) October 16- 20, 2005, San Diego, California, USA Authors: Vikram Jamwal and Sridhar Iyer

  • 4. Mobile Agent based Realization of a Distance Evaluation System 2003

International Symposium on Application and the Internet (SAINT 2003), Orlando, Florida, USA, Jan 27-31, 2003 Authors: Vikram Jamwal and Sridhar Iyer

  • 5. Mobile Agents for effective structuring of large-scale distributed

applications Workshop on Software Engineering and Mobility, ICSE 2001 at Toronto, Canada Authors: Vikram Jamwal and Sridhar Iyer

slide-83
SLIDE 83

Thank you