15
2004 The University of Auckland New Zealand SOFTWARE ENGINEERING Formalizing and Analyzing Feature models in Alloy Jing Sun Computer Science [email protected]

2004 The University of Auckland New Zealand SOFTWARE ENGINEERING Formalizing and Analyzing Feature models in Alloy Jing Sun Computer Science [email protected]

Embed Size (px)

Citation preview

Page 1: 2004 The University of Auckland New Zealand SOFTWARE ENGINEERING Formalizing and Analyzing Feature models in Alloy Jing Sun Computer Science j.sun@cs.auckland.ac.nz

20

04

Th

e U

niv

ers

ity o

f A

uck

lan

d

New

Zeala

nd

SO

FTW

AR

E E

NG

INEER

ING

Formalizing and Analyzing Feature models in Alloy

Jing Sun

Computer Science

[email protected]

Page 2: 2004 The University of Auckland New Zealand SOFTWARE ENGINEERING Formalizing and Analyzing Feature models in Alloy Jing Sun Computer Science j.sun@cs.auckland.ac.nz

20

04

SO

FTW

AR

E E

NG

INEER

ING

Th

e U

niv

ers

ity o

f A

uck

lan

d

N

ew

Z

eala

nd

Outline

= Feature modeling

= The Alloy language

= Formalizing feature diagram

= Checking feature models

= Conclusion and future work

Page 3: 2004 The University of Auckland New Zealand SOFTWARE ENGINEERING Formalizing and Analyzing Feature models in Alloy Jing Sun Computer Science j.sun@cs.auckland.ac.nz

20

04

SO

FTW

AR

E E

NG

INEER

ING

Th

e U

niv

ers

ity o

f A

uck

lan

d

N

ew

Z

eala

nd

Feature & Feature Modeling

= Conceptual modeling perspective– an important property of a concept– allows to express the commonalities and differences

between concept instance

= Domain engineering context– represents reusable, configurable requirements

= Feature modeling– is the activity of modeling the common and the variable

properties of concepts and their inter-dependencies and organizing them into a coherent model

– feature model diagram

Page 4: 2004 The University of Auckland New Zealand SOFTWARE ENGINEERING Formalizing and Analyzing Feature models in Alloy Jing Sun Computer Science j.sun@cs.auckland.ac.nz

20

04

SO

FTW

AR

E E

NG

INEER

ING

Th

e U

niv

ers

ity o

f A

uck

lan

d

N

ew

Z

eala

nd

Feature & Software Engineering

= Feature-oriented programming (Prehofer, 1997)– Can programs be created by composing features?– Next generation of OO programming?

= Feature and advanced separation of concern– Feature is regarded as one dimension of concern (Tarr et al.,

1999)– Can we separate feature concerns from other concerns?

= Feature and software evolution and maintenance– Locating features from source code (Eisenbarth, 2003)– Understanding the implementation of certain features in

programs

Page 5: 2004 The University of Auckland New Zealand SOFTWARE ENGINEERING Formalizing and Analyzing Feature models in Alloy Jing Sun Computer Science j.sun@cs.auckland.ac.nz

20

04

SO

FTW

AR

E E

NG

INEER

ING

Th

e U

niv

ers

ity o

f A

uck

lan

d

N

ew

Z

eala

nd

Feature & Software Engineering

= Feature and requirements engineering– Representing and structuring the problem domain as

features– A well known problem: Feature interaction in

telecommunication domain (Zave, 1993)

= Feature and software process– Feature-driven development: an agile, highly adaptive,

software development process (Palmer and Felsing, 2002)

= Feature and software reuse– FORM (Feature-Oriented Reuse Method) (Kang et al., 1998) – Modeling a software product line’s commonalties and

variability in terms of features

Page 6: 2004 The University of Auckland New Zealand SOFTWARE ENGINEERING Formalizing and Analyzing Feature models in Alloy Jing Sun Computer Science j.sun@cs.auckland.ac.nz

20

04

SO

FTW

AR

E E

NG

INEER

ING

Th

e U

niv

ers

ity o

f A

uck

lan

d

N

ew

Z

eala

nd

Our current interest

= Analyzing features and their relationships, organizing them into feature model

= Representing feature models

= Formalizing feature models

= Analyzing and verifying feature models

Page 7: 2004 The University of Auckland New Zealand SOFTWARE ENGINEERING Formalizing and Analyzing Feature models in Alloy Jing Sun Computer Science j.sun@cs.auckland.ac.nz

20

04

SO

FTW

AR

E E

NG

INEER

ING

Th

e U

niv

ers

ity o

f A

uck

lan

d

N

ew

Z

eala

nd

Feature modeling

= Basic relations among features– One feature may depend on another feature– One feature may exclude another feature

= Feature Types– Mandatory features: must be included in the description

of a concept instance– Optional features: may be included in the description of a

concept instance– Or features: may have any non-empty subset of the or-

features included in the description of a concept instance– Alternative features: …

Page 8: 2004 The University of Auckland New Zealand SOFTWARE ENGINEERING Formalizing and Analyzing Feature models in Alloy Jing Sun Computer Science j.sun@cs.auckland.ac.nz

20

04

SO

FTW

AR

E E

NG

INEER

ING

Th

e U

niv

ers

ity o

f A

uck

lan

d

N

ew

Z

eala

nd

Feature diagram example

= A car concept feature diagramCar

Transmission Engine

Automatic Manual

Car BodyPulls trailer

Electric Gasoline

Page 9: 2004 The University of Auckland New Zealand SOFTWARE ENGINEERING Formalizing and Analyzing Feature models in Alloy Jing Sun Computer Science j.sun@cs.auckland.ac.nz

20

04

SO

FTW

AR

E E

NG

INEER

ING

Th

e U

niv

ers

ity o

f A

uck

lan

d

N

ew

Z

eala

nd

Applying formal methods

= Alloy – a light-weight formal modeling language

– Based on first order predicate logic

– A subset of Z

– Support automatic analysis

= Applying Alloy to feature modeling– Formalizing a feature model

– Checking a feature model (e.g., checking valid/invalid combination of features, semantic equivalence, …)

Page 10: 2004 The University of Auckland New Zealand SOFTWARE ENGINEERING Formalizing and Analyzing Feature models in Alloy Jing Sun Computer Science j.sun@cs.auckland.ac.nz

20

04

SO

FTW

AR

E E

NG

INEER

ING

Th

e U

niv

ers

ity o

f A

uck

lan

d

N

ew

Z

eala

nd

Feature language in Alloy

sig Feature {} // define a set of features

disj sig Concept extends Feature { // define a concept

holds : set Feature // all possible configuration of a concept

}

// Depends - The selection of f2 depended on the selection of f1

fun Depends(c:Concept, f1:Feature, f2: Feature) {

f1 in c.holds => f2 in c.holds

}

// Alternative feature type

fun Alternative(c:Concept, pf:Feature, s:set Feature) {

all f : s | Excludes(f, s-f) && Depends(f, pf)

pf in c.holds => one f : s | Depends(pf, f)

} …

}

Page 11: 2004 The University of Auckland New Zealand SOFTWARE ENGINEERING Formalizing and Analyzing Feature models in Alloy Jing Sun Computer Science j.sun@cs.auckland.ac.nz

20

04

SO

FTW

AR

E E

NG

INEER

ING

Th

e U

niv

ers

ity o

f A

uck

lan

d

N

ew

Z

eala

nd

Feature model in Alloy

open feature/FeatureModel

static disj sig Automatic extends Feature{}

static disj sig Manual extends Feature{}

static disj sig CarBody extends Feature{}

static disj sig Car extends Concept{}

fact {Mandatory(Car, Car, CarBody+Transmission+Engine)}

fact {Optional(Car, Car, PullsTrailer)}

fact {Alternative(Car, Transmission, Automatic+Manual)}

fact {Or(Car, Engine, Electric+Gasoline)}

Page 12: 2004 The University of Auckland New Zealand SOFTWARE ENGINEERING Formalizing and Analyzing Feature models in Alloy Jing Sun Computer Science j.sun@cs.auckland.ac.nz

20

04

SO

FTW

AR

E E

NG

INEER

ING

Th

e U

niv

ers

ity o

f A

uck

lan

d

N

ew

Z

eala

nd

Checking & analyzing feature models

= Checking valid/invalid feature configurations– assert correctness { all c : GPL | c.holds != GPL + Algorithm +

Connected + Search + BFS + Graph + Undirected + Weighted }

= Checking the source of unsatisfiability using “core extension”

= Checking the solvability of feature models

= Analyzing semantic equivalence of feature models

Page 13: 2004 The University of Auckland New Zealand SOFTWARE ENGINEERING Formalizing and Analyzing Feature models in Alloy Jing Sun Computer Science j.sun@cs.auckland.ac.nz

20

04

SO

FTW

AR

E E

NG

INEER

ING

Th

e U

niv

ers

ity o

f A

uck

lan

d

N

ew

Z

eala

nd

Checking & analyzing feature models

= Semantic equivalence checking

Page 14: 2004 The University of Auckland New Zealand SOFTWARE ENGINEERING Formalizing and Analyzing Feature models in Alloy Jing Sun Computer Science j.sun@cs.auckland.ac.nz

20

04

SO

FTW

AR

E E

NG

INEER

ING

Th

e U

niv

ers

ity o

f A

uck

lan

d

N

ew

Z

eala

nd

Conclusion & future work

= Defined a formal semantics for the feature modeling language in Alloy

– Provide a precise and rigorous formal basis for the feature diagram

– Identify basic relations in feature diagram and showed that other complex relations can be expressed as a combination of the two

= Checking feature models using Alloy analyzer.

= Dynamic feature model re-configurations– Feature interaction problem

Page 15: 2004 The University of Auckland New Zealand SOFTWARE ENGINEERING Formalizing and Analyzing Feature models in Alloy Jing Sun Computer Science j.sun@cs.auckland.ac.nz

20

04

Th

e U

niv

ers

ity o

f A

uck

lan

d

New

Zeala

nd

SO

FTW

AR

E E

NG

INEER

ING

Questions?

Jing SunComputer Science

[email protected]