development environments and processes
Download
Skip this Video
Download Presentation
Development environments and processes

Loading in 2 Seconds...

play fullscreen
1 / 57

Development environments and processes - PowerPoint PPT Presentation


  • 92 Views
  • Uploaded on

Development environments and processes. Claude Petitpierre, Olivier Buchwalder, Paul-Louis Meylan. EPFL - Ecole Polytechnique Fédérale de Lausanne. ( Swiss Federal Institute of Technology). ~ 340 professors ~ 3400 researchers ~ 6000 students 6 schools

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Development environments and processes' - sacha-vazquez


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
development environments and processes
Development environments and processes

Claude Petitpierre,

Olivier Buchwalder,

Paul-Louis Meylan

epfl ecole polytechnique f d rale de lausanne
EPFL - Ecole Polytechnique Fédérale de Lausanne

(Swiss Federal Institute of Technology)

  • ~ 340 professors
  • ~ 3400 researchers
  • ~ 6000 students
  • 6 schools
  • ENAC: Architecture, civil engineering, environment
    • I&C: Informatic & communications SB: Math, physics, chemistry STI: Electricity, mechanics, microtechnics, materials
    • SV: Life sciences
    • CDM: Management of Technology
how to build internet applications
How to build Internet applications ?
  • RUP, MDA, IDE, Environment ?
    • J2EE + WebLang
    • Language Workbench

http://ltiwww.epfl.ch/WebLang

the fbi tragic experience
The FBI tragic experience

The VCF was supposed to automate the FBI\'s paper-based work environment, allow agents and intelligence analysts to share vital investigative information, and replace the obsolete Automated Case Support (ACS) system. Instead, the FBI claims, the VCF\'s contractor, delivered 700 000 lines of code so bug-ridden and functionally off target that this past April, the bureau had to scrap the US $170 million project […]

IEEE Spectrum: Who Killed the Virtual Case File?September 2005

patterns they are often not adapted to an application s description address too low a level
Patterns ?They are often not adapted to an application’s description !Address too low a level!
spaghetti programming pac mvc

add element

main

program call

list selected

combo box selected

resize

invokeLater

or

event

Spaghetti Programming (PAC + MVC)
the mvc pattern

The MVC pattern

Wikipedia (search MVC > Holub)

Events

Controller

View

Model (data)

jboss ide wizards
JBoss IDE (Wizards)

Tutorial

See Chapter 5, Generation of the EJB related files

Tedious, poor overview!

arc styler mda uml diagrams
Arc Styler (MDA – UML diagrams)

Tutorial

See page 35 and previous pages

Not much improvement!

will mda save the world
Will MDA save the world ?

UML2, OCL and Action semantics coupled with the MOF seem destined to be sucked into yet another committee attempt to unify the world in a single grand language – the vain quest for a “computer Esperanto”.

Dave Thomas

http://www.jot.fm/issues/issue_2003_01/column1

what else then
What else then ?
  • DSL, domain specific languages
  • http://www.codegeneration.net
  • Language benchwork
  • MSP, by Jetbrains, a tool to create DSL
  • http://www.martinfowler.com/articles/mpsAgree.html
  • Our language: WebLang
    • list of templates (derived form examples)
    • parser (Javacc)
    • generator (JET)
weblang generator

User

WebLang Generator

user program

parser (javacc)

component

database

templates

producer (JET)

DSL Syntax

Examples

control files

( .xml)

classes

See: www.codegeneration.net

a template jet
A Template (≠ JET)

//*START $OOTTYPE $OOTNAME $OOTREL $UOOTREL*//

public $OOTPACK.$OOTTYPE get$UOOTREL() {

return ($OOTREL);

}

public void set$UOOTREL ( $OOTPACK.$OOTTYPE _$OOTNAME

) throws Exception {

if (_$OOTNAME != null) {

. . .

}

//*END *//

a servlet and its caller
A servlet and its caller

Client Server

html: showDate

servlet: showDate

doGet() ;

best way to call a servlet here is our choice
Best way to call a servlet ?Here is our choice:

html: InputForms

<FORM action= “Test">

a

b

m1

c

b

m2

servlet: Test.java

doGet() {

. . .

}

m1(int a, String b) { ... }

m2(String c, long d) { ... }

weblang servlet module
WebLang Servlet Module

servlet Test {

package myPackage;

m1 (int a, String b) { ... }

m2 (String c, long d) { ... }

}

// The compiler generates automatically// the .java and the .html files

servlet template
Servlet template

public class Testextends HttpServlet {

public void doGet ( HttpServletRequest request,

HttpServletResponse response)

throws ServletException, IOException {

response.setContentType("text/html");

x = request.getSession().getArgument("a");

myMethod(x);

}

void m1(String a) {

}

}

template for a html page that calls the servlet
Template for a html pagethat calls the servlet

html: InputForms

<FORM action= "test">

<INPUT ... name=“a">

<INPUT ... name=“b">

<SUBMIT name="m1">

</FORM>

<FORM action= "test">

<INPUT ... name="c">

<INPUT ... name=“d">

<SUBMIT name="m2">

</FORM>

persistent objects in weblang
Persistent objects in WebLang

Client

N

1

Server

WebLang modules

html: TownInCtr

CMP bean: Town

name

population

servlet: TownInCtry

enterData()

CMP bean: Country

name

area

ejb weblang modules
EJB WebLang Modules
  • cmpbean Town {
  • package geo;
  • relations (Country = N:1)
  • String name; // DB attributes
  • int number;
  • public void myMet (String s) {
  • System.out.println(s);
  • }
  • // creators - finders
  • }
creation and use of a persistent object in weblang
Creation and use of a persistent object in WebLang

Town t ;

Country c ;

t = townHome.create("Lausanne");

c = countryHome.create("Switzerland");

System.out.println( t.getName() );

c.setName( "Suisse" );

workflow functions
Workflow (functions)

Sun’s Tutorial

Workflow(devices)

petstore in weblang mvc 2 extended three tiers each object corresponds to a module
PEtStore in WebLang (MVC-2 extended)(three-tiers, each object corresponds to a module)

petListForm.petForm[ ]

(form)

Struts

petListForm

(JSP)

Action Forms

0

not

confimed

basket.petFrom[ ]

(form)

showBasket

basket

(JSP)

1

confirmed

your_order

(JSP)

2

PetOrder

status = ordered

OrderItems*

(CMP+CMR)

CMP bean

OK

JSPs

Action Servlet

weblang module states and pages
WebLang Module : states and pages

struts PersonManagement {

package management;

stateMachine

statedef State_0 (person);

statedef State_1 (job);

. . .FSM. . .

page person {

forms ( personForm,

personForm.sportForm[ ],

personForm ("Comment", submitName) );

}

}

weblang module finite state machine
WebLang Module : Finite State Machine

stateMachine {

statedef State_0 (supply);

statedef State_1 (supplyConfirmation);

switch (sessionState) {

caseState_S:

sessionState = State_0;

break;

caseState_0:

Pet pet = petHome.create( petForm.getName() );

sessionState = State_1;

break;

caseState_1:

if (supplyConfirmation.getConfirmation())

sessionState = State_0;

}

}

// Pure Java code

three tiers overview

browseForm.petForm[ ]

(form)

Three tiers (overview)

Buying

Struts

browser

(JSP)

Administrator

Struts

0

areYouThe-

Administrator

(JSP)

PetOrder

status = toBeChecked

OrderItems*

(CMP+CMR)

0

not

confir-

med

basket.petFrom[ ]

(form)

showBasket

login

1

showBasket

(JSP)

checkOrders

(JSP)

OrderForm.petForm[ ]

not  accept

(form)

select

1

confirmed

order-

registered

(JSP)

2

confirmed

PetOrder

status = ordered

OrderItems*

(CMP+CMR)

OK

SendSupplierPO

MDBean

Queue

file

PetOrder

status = awaitInvoice

OrderItems*

(CMP+CMR)

Database

+ Dataflow

Display

Business Layer

Business Layer

Display

action forms cmp beans

PersonForm

Person

Action Forms CMP Beans

Next Problem:

Action forms

Recreate a collection and copie one into the other member by member

CMP beans

improving current architectures
Improving current architectures
  • Container managed beans of J2EE too complex for what they offer
  • A CMP bean cannot be used as a Java bean (requires data transfers)
  • Hibernate improves the situation, but …
  • … our SQL beans still go one step further
sql bean example
SQL Bean Example

sqlbean Town extends ActionForm { package appliT; relations (<isCapitalOf 1:1 hasCapital> Country); String name; public long findPK_OfTown(String x) throws Exception { query = "SELECT * FROM Town

WHERE name=$name;

OR name=$x“

}}

use of the sql bean
Use of the SQL bean

MySQLBean mb = new MySQLBean ( );

mb.setName("someName");

mb.store();

// stores the content into the database// and set the PK into the bean

// No home proxy !

use of a finder
Use of a finder

// we assume that country has been created// and filled by the Struts mechanism

case State_1:

long pkC = country.findPK_OfCountry();

if (pkC != 0) { country.reloadAll(pkC); // from the DB } else { country.store(); // into the DB } country.addTownN(town);

sql bean example1
SQL Bean Example

sqlbeanTown extends ActionForm { package appliT;. . .

}

TownN { // object used to look for collections public void findN_TownList(String s) throws Exception { query = "SELECT * FROM Town WHERE name>$s"}

finders throwing exception
Finders throwing Exception

TownN { String name; public void findTownList (String s) throws Exception { query = "SELECT * FROM Town WHERE name>$s" }} ……………………………………………………………..

TownN tn = new TownN();

try { tn.findTownList(“N”);} catch (weblangUtils.SQLException we) { System.out.println(“Not found”);}

for (Town t: tn) { System.out.println(“t.getName());}

fsm of the sql beans
FSM of the SQL beans

o = new Xxx()

Detached object

o.set(o1)

o.add(o1)

o.set(null)

o.remove(o1)

o.store()

o.findPKXx()

o.findXx()

o.store()

o.delete()

o.delete()

Attached object

pk!=0

Linked object

pk==0

o.reload(pk)

o.delete()

o.set(null)

o.remove(o1)

o.set(o1)

o.add(o1)

o.reloadAll()

o.storeAll()

Attached + linked

+ connected object

pk!=0 rel!=0

o.deleteAll()

o.reload()

o.reloadAll()

o.update()

o.updateAll()

operations of the sql beans
Operations of the SQL beans

store Copies the data of the object into the database, new primary key inserted in the object

findXxx Query method returning a DB row, the object must be instantiated before the method is called

findPKXxx Returns the value of the primary key (or 0), method may also throw an exception

reload(pk) Method copies the data of the object into a DB row with primary key pk

update Dual of the reload, updates the database row that has the PK found in memory

delete Removes the data in the database, not the memory, resets the object’s primary key

sql beans
SQL beans
  • SQL beans have been devised at the EPFL: they present the same structure as Hibernate 3 (particularly within WebLang), but they only use JDBC and the standard SQL
  • Much simpler to debug, as all statements may be traced within the debugger
  • No home nor manager, the object holds the finder; it is instantiated by new before find can be called.
better use of listeners
Better use of Listeners

GUI

setUsername ()

getUsername ()

setPosition ()

setError ()

Server

Java client

topic

GUI Listeners

actionPerformed() {

}

Message Listener

onMessage () {

}

Business layer

FSM () {

}

conclusions
Conclusions
  • WebLang provides a lower bound in the level of development complexity. No system should be more complex without reason.
  • A language provides a simpler mean for the developer and the user of the compiler.
  • WebLang opens new directions for creating Web (and other) applications.
  • WebLang is not alone on this avenue: competition, such as MSP of Jetbrains and Ruby on Rails are coming up.
object o 1
Object O1

Object O2

run () {

. . .

select {

case

O2.send (msg) ;

case

O3.m(x);

}

. . .

}

void send (String msg)

{ ......... }

run () {

accept send;

}

object o 11
Object O1

Object O2

run () {

. . .

select {

case

O2.send (msg) ;

case

O3.m(x);

}

. . .

}

void send (String msg)

{ ......... }

run () {

accept send;

}

void send (String msg)

{ .......... }

run () {

accept send;

}

how to use this uml diagram
How to Use thisUML Diagram ?

P. Kruchten, The Rational Unified Process – An Introduction, Addison-Wesley

implementation of the collaboration diagram
Implementation of the Collaboration Diagram

9 : PIN valid ?

: Session

Manager

: Authenticator

3 : validate card

// Session manager

loop {

2 : read card

3 : validate card

5 : "Enter PIN"

8 : get PIN

9 : PIN valide ?

}

: Card

Validator

10 : PIN valid ?

8 : get PIN

2 : read card

5 : "Enter PIN"

: Card

Reader

: Display

: Keypad

: ATM Network

6 : "Enter PIN"

11 : PIN valid ?

7 : PIN entered

1 : insert card

(4 : new session)

: customer

: ATM network

sliding w indow p rotocol s ystem c onfiguration
Sliding Window Protocol: System Configuration

User 2

User 1

Source

Destination

channels

C2In

C2Out

C1Out

C1In

messages losses

swp m essage e xchanges
SWP : Message Exchanges

Source

Destination

message 0

acknowledgement 1

message 1

acknowledgement 2

message 2

time

swp d ata s torage
SWP: Data Storage

last

middle

first

window

1

2

3

4

5

6

7

0

1

2

3

messages

sent and

acknowledged

messages ready for

sending

future

messages

messages

sent but not

acknowledged

messages kept in a queue

within the source

swp 4 e vents r endezvous h andled by the e mitter
SWP: 4 Events (Rendezvous) Handled by the Emitter
  • Reception of a message from the user
  • Acceptance of a message by the network driver (in order to send it)
  • Timeout (one acknowledgement expected)
  • Reception of an acknowled-gement from the network

User 1

Source

C2Out

C1In

swp p rogram b eginning

middle

first

window

4

5

6

7

0

SWP Program (Beginning)

for ( ; ; )

select {

when ( window < WindowSize ) // a message from the user

accept Write;

window++ ;

ULMessage.NS = NSend;

NSend = ( NSend + 1 ) % WindowRange;

Q.PutMessage ( ULMessage );

||

when ( Q.middle != NULL ) // a message is ready to be sent

C1.In ( MakeACopy (Q.middle) );

Q.middle.date = now();

Q.middle = Q.middle.next;

||

. . .

swp p rogram e nd

middle

first

window

4

5

6

7

0

SWP Program (End)

||

when ( Q.middle != Q.first ) // at least 1 message is not acknowledged

waituntil ( Q.first.date + T1 );

Q.middle = Q.first;

||

LLMessage = C2.Out (); // get an acknowledgement

while ((Q.first != NULL) && (Q.first.NS != LLMessage.NR)) {

window-- ;

ackgedMsg=Q.ExtractMessage ( ); // delete acknowledgedmessages

// middle has been updated if needed;

}

}

};

The receiver just accepts and acknowledges the messages in sequence

ad