1 / 57

Development environments and processes

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

Download Presentation

Development environments and processes

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Development environments and processes Claude Petitpierre, Olivier Buchwalder, Paul-Louis Meylan

  2. 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

  3. How to build Internet applications ? • RUP, MDA, IDE, Environment ? • J2EE + WebLang • Language Workbench http://ltiwww.epfl.ch/WebLang

  4. 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

  5. Patterns ?They are often not adapted to an application’s description !Address too low a level!

  6. add element main program call list selected combo box selected resize invokeLater or event Spaghetti Programming (PAC + MVC)

  7. The MVC pattern Wikipedia (search MVC > Holub) Events Controller View Model (data)

  8. JBoss IDE (Wizards) Tutorial See Chapter 5, Generation of the EJB related files Tedious, poor overview!

  9. Arc Styler (MDA – UML diagrams) Tutorial See page 35 and previous pages Not much improvement!

  10. 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

  11. 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)

  12. User WebLang Generator user program parser (javacc) component database templates producer (JET) DSL Syntax Examples control files ( .xml) classes See: www.codegeneration.net

  13. 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 *//

  14. Details of our language

  15. A servlet and its caller Client Server html: showDate servlet: showDate doGet() ;

  16. 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) { ... }

  17. 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

  18. 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) { … } }

  19. 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>

  20. 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

  21. 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 • }

  22. 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" );

  23. WebLang leads to better descriptions than the ones Sun used for its Pet Store

  24. The Pet Store: Application Description

  25. Workflow (functions) Sun’s Tutorial Workflow(devices)

  26. 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

  27. 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) ); } }

  28. 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

  29. 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

  30. PersonForm Person Action Forms CMP Beans Next Problem: Action forms Recreate a collection and copie one into the other member by member CMP beans

  31. 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

  32. 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“ }}

  33. 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 !

  34. 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);

  35. 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"}

  36. 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());}

  37. 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()

  38. 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

  39. 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.

  40. How to standardize client architecture ?

  41. Standard use of listeners in a GUI GUI elements

  42. Better use of Listeners GUI setUsername () getUsername () setPosition () setError () Server Java client topic GUI Listeners actionPerformed() { } Message Listener onMessage () { } Business layer FSM () { }

  43. 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.

  44. Synchronous Java(Concurrent objects)Available in WebLang

  45. Object O1 Object O2 run () { . . . select { case O2.send (msg) ; case O3.m(x); } . . . } void send (String msg) { ......... } run () { accept send; }

  46. 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; }

  47. Event-driven versus listeners:active objects skeleton GUI elements read stub

  48. Coding a UML State Diagramwith Synchronous Active Objects

  49. How to Use thisUML Diagram ? P. Kruchten, The Rational Unified Process – An Introduction, Addison-Wesley

  50. 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

More Related