Docsity

Adaptive Software Engineering, Study notes of Compiler Design

Toggle sidebar
bg1
1
1
Adaptive Software Engineering
G22.3033-007
Session 5 - Main Theme
Software Engineering Tools Primer
Dr. Jean-Claude Franchitti
New York University
Computer Science Department
Courant Institute of Mathematical Sciences
2
Agenda
Session 4 Review
GRASP Patterns
Sample OCL Problem
Using UML to Model Application of XML
Software Engineering Tools Primer
Build Tools (e.g., Ant)
Continuous Build Process Frameworks (e.g., CruiseControl)
Unit Testing Frameworks (e.g., jUnit)
Refactoring Browsers (e.g., IntelliJ’s IDEA)
Selecting Appropriate Tools
Summary
Individual Assignment #4 & Team Assignment #1
Course Project (Part 2) - Ongoing
Readings
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19

Partial preview of the text

Download Adaptive Software Engineering and more Study notes Compiler Design in PDF only on Docsity!

1

Adaptive Software Engineering

G22.3033-

Session 5 - Main Theme

Software Engineering Tools Primer

Dr. Jean-Claude Franchitti

New York University

Computer Science Department

Courant Institute of Mathematical Sciences

2

Agenda

„ Session 4 Review

„ GRASP Patterns „ Sample OCL Problem „ Using UML to Model Application of XML

„ Software Engineering Tools Primer

„ Build Tools (e.g., Ant) „ Continuous Build Process Frameworks (e.g., CruiseControl) „ Unit Testing Frameworks (e.g., jUnit) „ Refactoring Browsers (e.g., IntelliJ’s IDEA) „ Selecting Appropriate Tools

„ Summary

„ Individual Assignment #4 & Team Assignment # „ Course Project (Part 2) - Ongoing „ Readings

3

Summary of Previous Session

„ Use Cases Review

„ Use Case Design

„ GRASP Patterns

„ System Design

„ UML and OOAD Summarized

„ UML to Java Mapping

„ Sample OCL Problem

„ Summary

„ Individual Assignment # „ Course Project (Part 2) „ Readings

4

Part I

Software Engineering Tools Primer

7

„ Thoughtworks Tools (continued):

„ http://opensource.thoughtworks.com/index.html „ Dashboard: Dashboard is a plugin for IntelliJ IDEA and Eclipse that gives instant feedback to the developer regarding the current status of a continuous integration build on a remote machine. It is currently used to give a stage by stage, visual representation of the state of a cruise control build. „ Marathon: Marathon is a gui-test tool that allows you to play and record scripts against a java swing ui. It's written in java, and uses python as its scripting language - the emphasis being on an extremely simple, readable syntax that customers/testers/analysts feel comfortable with.

eXtreme/Agile Programming Tools

(continued)

8

„ Apache Software Foundation (Jakarta)

„ Ant - is a platform independent build system (somewhat analogous to make). „ JMeter - a 100% pure Java desktop application designed to load test functional behavior and measure performance. „ Cactus - Cactus is a simple test framework for unit testing server-side java code.

„ SourceForge.net

„ Unit Tests Generator - part of "Web Test Tools" - provides tools for automatically generating unit tests. Integrate these using Ant to get automatic generation of new tests when a class or method is added. „ Dbunit - This database testing framework is a JUnit extension which sets up your database in a known state before executing your tests.

eXtreme/Agile Programming Tools

(continued)

9

eXtreme/Agile Programming Tools

(continued)

„ SourceForge.net (continued)

„ XMLUnit - Seems to be mostly about testing for differences. „ JUnitEE - provides a TestRunner which outputs HTML and a servlet which can be used as an entry point to your test cases. „ JUNITPP - an extension to the JUNIT framework that allows a test data repository and load/stress test from the command line. „ Hansel is an extension to JUnit implementing code coverage tests. „ Grinder is a Java load-testing framework that is freely available under a BSD-style open-source license. „ JTestCase helps you in separating test data from test code. In another word, JTestCase enables unit tests to be "data-centric".

10

eXtreme/Agile Programming Tools

(continued)

„ SourceForge.net (continued)

„ JFunc is an extension to the JUnit testing framework to make it easier for use with functional (integration) tests. „ TagUnit is a framework whereby JSP custom tags can be tested inside the container, and in isolation to the application specific pages on which they will ultimately be used. „ MaxQ is a free web functional testing tool. It includes an HTTP proxy that records your test script, and a command line utility that can be used to playback tests. „ StrutsTestCase is an extension of the JUnit TestCase class that allows testing of individual Action objects with or without a running servlet engine. This framework provides both mock servlet objects as well as Cactus support to simulate the environment.

13

Java IDEs

  • Eclipse
  • NetBeans
  • Sun ONE Studio
  • JBuilder
  • Visual Age for Java
  • VisualCafé
  • Codewarrior for Java
  • WebGain Studio
  • ModelJ
  • J2ME Wireless Toolkit
  • IntelliJ
  • etc.

14

(Java) IDEs – Selection Criteria

  • User Interface Ease of Use
  • IDE Customization Features
  • Code Editing Features
  • On-the-Fly Code Analysis
  • Code Style, Generation, Inspection
  • Refactoring Support
  • J2EE Support (JSP, XML, EJB, etc.)
  • Navigation
  • Search and Replace
  • JavaDoc Support
  • Local Version Control Support
  • Version Control System (VCS) Integrations
  • Compiler
  • Running/Debugging Support
  • Debugger
  • Other Integrated Tools
  • Open API
  • Written in Java / Available on All Platforms

15

Software Tools for XP

http://jakarta.apache.org/cactus/ http://www.junit.org/index.htm

• Cactus

  • Test framework for unit testing server-side java code

(Servlets, EJBs, Tag Libs, Filters, …)

  • Cactus uses JUnit and extends it
  • JUnit is a regression testing framework written by Erich

Gamma and Kent Beck. It is used by the developer who

implements unit tests in Java

  • Provides a packaged and simple mechanism based on

Ant to automate server-side testing

16

Software Tools for XP

(continued)

19

MDA

(continued)

UML Model (PIM)

Auto Color : String Door : Integer Engine : Integer

Red 4 2

XMI Document (PSM)

XMI

<!Element Auto

(Color*,

Door*,

Engine*)>

XMI DTD, Schema (PSM)

X MI

M O F

interface Auto { };

IDL, Java… (PSM)

Class Auto {public String color; public int Door; public int Engine; }

20

MDA

• OMG's MDA (Model-Driven Architecture)

specification describes:

– a PIM - platform-independent models (i.e.

business design)

– PSMs - the mapping of a PIM to one or more

platform-specific model

• MDA => Model Once, Generate

Everywhere

• Review MDA presentations:

  • http://www.io-software.com

21

UML’s Business Engineering Methodology

„ Business Model/Architecture

„ Use Case View/Model

„ Application Model/Architecture

„ Logical and Process View/Models „ Content, Data, and Process Model (e.g., OIM’s knowledge management, and database/datawarehousing models)

„ Application Infrastructure Model/Architecture

„ Implementation View „ Component Model (e.g., OIM’s component and object model)

„ Technology Model/Architecture

„ Deployment View/Model

22

UML and Modeling Methodologies

„ UML: object modeling „ XML: content modeling

„ ORM: data modeling

25

XML Metadata Management

„ Issue: UML may not provides enough modeling views and

enough expressive power in each view to represent a complete

application

„ Possible Solutions:

„ Extend UML

„ See CWM’s Analysis and Design Model

„ Use Different Modeling Languages:

„ See handout on “XML Information Modeling” (uses

different models such as UML, XML, and ORM)

„ Use a Meta-Model: MOF and XMI

26

XML Support for UML Modeling

„ Meta Object Facility (MOF)

„ CORBA Common Facility for the Management of Meta

Information such as UML Models, Database Schemas,

Programming Language Types, etc.

„ XML Metadata Interchange (XMI)

„ Enables interchange of metadata between modeling tools

„ Develop models using Rational Rose or Java, and the XMI toolkit

(now part of IBM’s EMF).

„ Use Objects by Design xmi-to-html.xsl style sheet and Cocoon

framework to present the resulting model

27

MDA Development Approach

28

Sample MOF MetaModel

31

Simplified UML XMI DTD

32

XML Information Modeling

„ Steps

„ Documenting the Information Structure

„ Representing the Information Structure in XML Form

„ Defining XML DTDs and/or Schemas

„ Modeling Techniques

„ UML: object modeling

„ XML: content modeling

„ ORM: data modeling

„ UML, MOF and XMI

33

Using UML to Model MLs

Query Gloss aries

Trans lator

glos s ary_reques t

< < c om m unicate> >

< < c om m unic ate> >

  • reply _rec ipient

glos s ary_reply

  • reply_s upplier

  • reques t_s upplier

  • request_rec ipient

34

Using UML to Model MLs

(continued) XSD Datatypes <> Gl os sar ies XH TML

<>(from XSD D atatypes)stri n g <>Di a l e ctCo d e

a u th o rNa m e : stri n g^ S i g n e d E n try cr ea ti o n Da te : d a te

<> fre n ch Ca n a d i a n : stri n gDi a l e ctIn fo d i a l e ctCo d e : Di a l e ctCo d e

<>

<>G l o ssa ri e s

e n g l i sh [0 ..1 ] : stri n gE n try fre n ch [0 ..1 ] : stri n g

<> 0 ..n0 ..n

<> to p i c : stri n gGl o ssa ry <> cre a ti o n Da te : d a te

<> 0 ..n

+g l o ssa ry 0 ..n

0 ..n

1 +e n try (^) 0 ..n

1

0 ..n +d e scri p ti o n0 ..20 ..2 P l a ce Ho l d e r( fro m XH T ML)

+su b -g l o ssa ry 0 ..n

37

AspectJ – Locking Sample

01 aspect Lock { 03 Data sharedDataInstance; 04 Lock( Data d ) { 05 sharedDataInstance = d; 06 } 08 introduce Lock Data.lock; 09 10 advise Data() { 11 static after { 12 thisObject.lock = new Lock( thisObject ); 13 } 14 } 17 }

  • Creating a new aspect called lock with introduce and advise

cross-cuts

38

AspectJ – Locking Sample

(continued)

15 boolean locked = false; 16 17 advise Worker.perform(..), AnotherWorker.perform(..) { 18 before { 19 if ( thisObject.sharedDataInstace.lock.locked ) // enqueue, wait 20 thisObject.sharedDataInstace.lock.locked = true; 21 } 22 after { 23 thisObject.sharedDataInstace.lock.locked = false; 24 } 25 } 26 }

  • Advising classes that work with the data (note that all the

locking code is included in an aspect!)

39

Catalog of Patterns (www.martinfowler.com/eaaCatalog) „ Domain Logic Patterns (e.g., Service Layer) „ Data Source Architectural Patterns „ e.g., Data Mapper „ Object-Relational Behavioral Patterns „ e.g., Unit of Work „ Object-Relational Structural Patterns „ e.g., Inheritance Mappers „ Object-Relational Metadata Mapping Patterns „ e.g., Repository „ Web Presentation Patterns „ e.g., MVC, Application Controller „ Distribution Patterns (e.g., Remote Façade, DTO) „ Offline Concurrency Patterns (e.g., Implicit lock) „ Session State Patterns (e.g., Server Session State) „ Base Patterns (e.g., record set, value object)

40

MVC Pattern splits user interface interaction into three different roles