Presentation is loading. Please wait.

Presentation is loading. Please wait.

Software Engineering Modern Approaches Eric Braude and Michael Bernstein 1.

Similar presentations


Presentation on theme: "Software Engineering Modern Approaches Eric Braude and Michael Bernstein 1."— Presentation transcript:

1 Software Engineering Modern Approaches Eric Braude and Michael Bernstein 1

2 © 2010 John Wiley & Sons Ltd. Chapter 21: Advanced and Emerging Methods in Software Design 2

3 Learning Goals of This Chapter How is the design process affected when engineers are geographically distributed? In what ways can aspect-oriented programming help software engineering? How does a UML framework like UMLsec help with designing for security? What are the main goals of Model- Driven Architecture? What is a formal design process in the B language? Requirements analysis Design Implementation Testing Maintenance Planning The Software Development Lifecycle Phase most relevant to this chapter is shown in bold © 2010 John Wiley & Sons Ltd. 3

4 Design Tools for Distributed Development (IBM) License distributed teams  requirement – Seek flexible license model  response Apply service-oriented architecture – Model process flow with UML – Build in Web Services from inception Communicate design to all engineers – Use UML models – Make Web-viewable http://www3.software.ibm.com/ibmdl/pub/software/rational/web/guides/GC34-2500-00.pdf 4

5 © 2010 John Wiley & Sons Ltd. Tools for Distributed Design Web-based development environments – E.g., Google Code, SourceForge Wikis – Track changes to designs Web-based whiteboards – Graphic elements visible to all Conference calls – Aural discussions of designs Hyperlinked UML diagrams http://www3.software.ibm.com/ibmdl/pub/software/rational/web/guides/GC34-2500-00.pdf 5

6 © 2010 John Wiley & Sons Ltd. The Idea of Aspect-Oriented Programming Class ModelAspects Efficiency Security Business logic - domain specific e.g., “financial” “logistical,”etc. A BC D E F G Transaction management 6

7 © 2010 John Wiley & Sons Ltd. Runtime Aspects: Decorating a Core Process Paths without security or persistent aspects Process invalid id/password Order valid else … Execute order … Security aspect Store order Persistence aspect …. Get order information 7

8 Example of Security Requirement in Use Case sales «fair exchange» Buy product Sell product customer vendor Adapted from Jurjens p 16 Imposes mandate on use case specifics © 2010 John Wiley & Sons Ltd. 8

9 «fair exchange» in a Derived Activity Diagram Adapted from Jurgens p 54 Buy product «fair exchange» start={Pay} stop={Reclaim, Obtain} Request product Pay Wait until delivery due time ReclaimObtain Deliver CustomerVendor “Processing that gets here...” “… must reach one of these.” © 2010 John Wiley & Sons Ltd. 9

10 Goals of Model-Driven Architecture Portability – Platforms, languages, middleware Interoperability Reusability of designs [1][1] http://www.omg.org/docs/omg/03-06-01.pdfhttp://www.omg.org/docs/omg/03-06-01.pdf 10

11 © 2010 John Wiley & Sons Ltd. Means of Model-Driven Architecture Design independent of implementation and environment Generate code as automatically as possible from designs Uses models as the primary means of “understanding, design, construction, deployment, operation, maintenance, and modification.”[1] Specified and organized by OMG [1][1] http://www.omg.org/docs/omg/03-06-01.pdfhttp://www.omg.org/docs/omg/03-06-01.pdf 11

12 © 2010 John Wiley & Sons Ltd. Generating Skeleton Code From UML Customer +getCreditRating(): int VideoCustomer +getNumDVDsRented(): int DVD class Customer { public int getCreditRating {return 0; } } class VideoCustomer extends Customer { DVD dvd; public int getNumDVDsRented {return 0; } } class DVD { } 12

13 Round-Trip Engineering Requirements analysis Design CodingTesting Create class model Regenerate class model from code base Generate skeleton code Augment skeleton code Augment class model 1 2 3 4 5 © 2010 John Wiley & Sons Ltd. 13

14 Middleware description Pervasive service description (example) The MDA Concept Application Adapted from http://www.omg.org/mda/ Middle- ware 1 Middle- ware 2 UML model Middle- ware 3 Perva- sive svce 1 Perva- sive svce 2 Application © 2010 John Wiley & Sons Ltd. 14

15 The MDA Concept: Annotated http://www.omg.org/mda/ Core design (explained later) Common to many app’s middleware Target applications (select middleware & pervasive services © 2010 John Wiley & Sons Ltd. 15

16 © 2010 John Wiley & Sons Ltd. Main MDA Artifacts 1.Platform-independent Model (PIM) Design independent of platform 2.Platform-Specific Models (PSM) 3.Code implementing PSM’s PIM PSM1PSM2PSM3 Code3Code2 Code1 (Standard) description of platform #1 1. 2. 3. 16

17 © 2010 John Wiley & Sons Ltd. MDA Example PIM Java PSM VideoCustomer Relational PSM Video customer E.R.D. “PSM bridge” -- relates customer objects to table records Java code Relational code “code bridge” 17

18 © 2010 John Wiley & Sons Ltd. Uses of OCL To specify invariants on classes and types in the class model To describe pre- and post conditions on operations and methods To describe guards (“if ”) As a navigation language To specify constraints on operations i.e., limits http://lcm.csa.iisc.ernet.in/soft_arch/OCL.htm 18

19 Examples of OCL Syntax Relational expression score > 8.3 value <= next.value Logical expression score > 8.3 and score <= 9.4 p implies q p1 <> p2 implies p1.name <> p2.name Primary expression MyClass::myMethod(myArgu ment) if expression if name = ‘JohnSmith' then score > 8.3 endif Set : Set { 1, 2, 5, 88 } Set { 'apple', 'orange', ‘peach' } Sequence : Sequence { 1, 3, 45, 2, 3 } Sequence { 'ape', 'nut' } Sequence { 10..24 } adapted from http://www.csci.csusb.edu/dick/samples/ocl.html#Glossary © 2010 John Wiley & Sons Ltd. 19

20 © 2010 John Wiley & Sons Ltd. PIM Example with Approximate OCL VideoCustomer +name: String +numRented: int 0..10 customer initially: 0 Rental +year: String getFine(daysLate: integer): float precondition: daysLate==1 or daysLate== 2 invariant: 0< name.length()<= 20 0..1 20

21 © 2010 John Wiley & Sons Ltd. Example of a PIM / PSM / Code Transformation Video Store PIM Relational PSM EJB Component PSM Web PSM SQL source code EJB source code JSP source code PIM - to - EJB Components transformation Code generation PIM - to - Relational transformation PIM - to - Web transformation Code generation 21

22 © 2010 John Wiley & Sons Ltd. PSM Java/UML Example VideoCustomer -name: String -numRented: int -rentals: Set Rental -year: String -videoCustomer: Set getYear(): int setYear(year: int) getFine(daysLate: integer): float … getName(): String setName(name: String) … 22

23 © 2010 John Wiley & Sons Ltd. PIM / PSM / Transformation Example with Communications Video Store PIM Relational PSM EJB Component PSM Web PSM SQL source code EJB source code JSP source code Communications PIM level PSM level Code level 23

24 © 2010 John Wiley & Sons Ltd. MOF Specification of UML: A Part UML Element Class 0..* Method “every class is an element composed of zero or more attributes and methods.” Attribute 0..* 24

25 © 2010 John Wiley & Sons Ltd. Application of the MOF PIMa PSM Model language 1Model language 2 MOF Meta-language Transformation program Transformation definition is specified via … input is specified via … is specified via … is specified via … uses 25

26 © 2010 John Wiley & Sons Ltd. The Parts of a B Specification 1.MACHINEIdentifies part; has parameters 2.CONSTRAINTSOn parameters & constants 3.VARIABLESLike those of a class 4.INVARIANTRespected by all operations 5.INITIALIZATIONCarried out automatically 6.OPERATIONS Like methods in a class 26

27 MACHINE table( lowest, highest ) CONSTRAINTS lowest  NAT ‡ ⋀ highest  NAT ⋀ 0< lowest ⋀ lowest  highest VARIABLES ….. INVARIANT …… Lookup Example in B -- 1 Parameters of the entire machine.. on parameters and constants; includes types continued ‡ NAT = the natural numbers © 2010 John Wiley & Sons Ltd. 27

28 MACHINE table( lowest, highest ) CONSTRAINTS … VARIABLES min, max, Pred, found, xx INVARIANT min  NAT ⋀ max  NAT ⋀ min  lowest ⋀ max  highest ⋀ [ Pred  ( min..(max-1)  BOOL ) ] ⋀ found  BOOL ⋀ xx  NAT Pred maps each natural number between min and max- 1onto true or false. e.g., Pred(3)==false Lookup Example in B -- 2 Only names are lists (type specifications are part of the invariant); at least 2 letters continued © 2010 John Wiley & Sons Ltd. 28

29 INITIALIZATION /* Not used in this example */ OPERATIONS Search = def IF  ii  ( ii  min..(max-1) ) ⋀ ( Pred(ii) = true ) THEN found = true ⋀ ANY jj WHERE ( jj  min..(max-1) ) ⋀ ( Pred(jj) = true ) THEN xx >= jj END ELSE (found = false) ⋀ (xx = max) END Lookup Example in B -- 3 “The following specifies Search” “If an index exists where Pred is true” “jj is any index where Pred is true” Adapted from Monin p108 12345678 12345678 © 2010 John Wiley & Sons Ltd. 29

30 © 2010 John Wiley & Sons Ltd. Refinement Example (Database Query) Requirement: “The top DVD rentals in each category are present on the monitor.” Refinement 1: variable topRental = VERY_LOW_RENTAL “For each category, display category name For each rental if( rental frequency > topRental frequency ) topRental := rental display topRental” 30

31 Refinement of Lookup (“table”) Example 1 of 2 REFINEMENT tableR1(Low, Hi) REFINES table VARIABLES min1,max1, Pred1, xx1 INVARIANT min1 = min  max1 = max  Pred1 = Pred  xx1 = xx  min1  xx1  xx1  max1  ( xx1 = max1  found = false ) INITIALIZATION /* none applied */ Every part of table applies Variables additional to table. Connects the variables of table and table1 To honor table’s invariant continued © 2010 John Wiley & Sons Ltd. 31

32 OPERATIONS Search = def IF  ii  ( ii  min1..(max1-1) )  ( Pred1(ii) = true ) THEN ANY jj WHERE ( jj  min 1..(max-1) )  ( Pred(ii) = true ) THEN xx1 : = jj END ELSE xx1 : = max1 END END END Refinement of Lookup Example 2 of 2 Refined definition of Search Still somewhat non-deterministic; needs further refinement Less deterministic because of these assignments © 2010 John Wiley & Sons Ltd. 32


Download ppt "Software Engineering Modern Approaches Eric Braude and Michael Bernstein 1."

Similar presentations


Ads by Google