260 likes | 268 Views
This presentation explores the roots of architecture and GUIs, including topics such as computer augmentation, mental models, and data. It also covers the user's mental model, user-machine interaction, and the model-view-controller architecture. Use cases and frontloading algorithms are discussed, along with the essence of object orientation and the classification of classes and roles.
E N D
Things your motherdidn't tell you about architecture and GUIsPart II ROOTS 2007 Trygve Reenskaug Department of Informatics University of Oslo PowerPoint and Java code atfolk.uio.no/trygver/2007/roots07.zip
What it is All About Doug Engelbart: computer augmentation ? mental model ? data ? ? Computer usecases operations 2007.04.26-ROOTS-Architecture #2
Scripting vs. Direct Manipulation S F • Out of main door • Turn right • 5th left • Right at 4th light • ½ left at 1st light • You’re there 2007.04.26-ROOTS-Architecture #2
User’s Mental ModelActivity Planning Network actA actC Code Algorithms DefineUseCases actD 2 weeks 3 weeks System Integration actB Define & CodeDomainClass attributes 2 weeks 7 weeks 2007.04.26-ROOTS-Architecture #2
User – Machine Interaction GUI GUI bridgesgap between brain and data usermental model data DomainData User 2007.04.26-ROOTS-Architecture #2
Model – View - Controller Controller 1 View 1 * 1 1 * View User work withModel seen throughView Controller creates and coordinates multiple Views usermental model data Model User Run Demo 2007.04.26-ROOTS-Architecture #2
Use Case exampleA Functional Requirement • Use Case # N: frontloading function • An activity is characterized by its duration, earlyStarttime, earlyFinish time,its predecessors and successors activities. • By default, earlyFinish = earlyStart + durationspecial activities may have more complex algorithms • An activity can start when all its predecessors are finished:earlyStart = MAX (earlyFinish all predecessors) Run Demo 2007.04.26-ROOTS-Architecture #2
frontloading – 1UML Diagrams COLLABORATION frontpreds [*] frontloader [1] INTERACTION frontpreds [*] frontloader [1] frontload() earlyFinish() • Critical Questions: • What are the roles? • How are they interconnected? • How do they interact? 1. What are the roles?2. How are they interconnected? 3. How do they interact? 2007.04.26-ROOTS-Architecture #2
The Essence of Object Orientation:Objects interact to achieve a given goal Critical questions: • What are the relevant objects? • The relevant objects are seen as a structure of Roles. • A role names the usage of one or more objects. • The name is seen as an alias for those objects. • How are they connected? • A Collaboration describes the structure of roles. • How do they interact? • An Algorithm specifies the interaction in terms of the roles. 2007.04.26-ROOTS-Architecture #2
Class and Role – 1Steven Pinker: How The Mind Works Classification: Group on common features (inst.vars. & methods) • Role (Artifact) : Group on common purpose • People categorize objects in terms of the roles they play within intuitive theories about how the world operates. • Roles are defined by what they can do and by what someone, somewhere, makes them to do at some time. 2007.04.26-ROOTS-Architecture #2
Class and Role – 2The TrumpeterHändel: Messiah, Hallelujah choir Note: PowerPoint sound doesn’t work over the internet?! One Role - Two Classes 2007.04.26-ROOTS-Architecture #2
Role Playing in the TheatreHenrik Ibsen: Peer Gynt The Royal Hall of the King of the Dovre-Trolls. THE OLD MAN OF THE DOVRE sits on the throne, crowned, and with his sceptre in his hand. His CHILDREN and NEAREST RELATIONS are ranged on both sides. PEER GYNT stands before him. Violent commotion in the hall. ---------------- (THE GREEN-CLAD ONE) http://norsk.kameraklubb.net/coppermine/displayimage/album=167/pos=6.html 2007.04.26-ROOTS-Architecture #2
frontloading – 1UML Diagrams COLLABORATION frontpreds [*] frontloader [1] INTERACTION frontpreds [*] frontloader [1] frontload() earlyFinish() • Critical Questions: • What are the roles? • How are they interconnected? • How do they interact? 1. What are the roles?2. How are they interconnected? 3. How do they interact? 2007.04.26-ROOTS-Architecture #2
frontloading-2 Algorithm public void frontload (Integer startWeek) { FrontIntffrontloader = ??; Set<FrontpredIntf>frontpreds = ??; Integer earlyStart = startWeek; for (FrontpredIntf pred : frontpreds) { earlyStart = Math.max(earlyStart, pred.earlyFinish() + 1); } frontloader.setEarlyStart(earlyStart); } 2007.04.26-ROOTS-Architecture #2
What it still is All About mental model data GUI Model usecases operations 2007.04.26-ROOTS-Architecture #2
Data ModelConceptual Schema Model actC actA Activity name earlyStart earlyFinish duration color actD activities dependencies * * Dependency actB predecessor successor 2007.04.26-ROOTS-Architecture #2
Data ModelJava Domain Classes publicclass Model {public Set<Activity> activities= new HashSet<Activity>();public Set<Dependency> dependencies = new HashSet<Dependency>();…} publicclass Activityimplements FrontpredIntf, FrontIntf {private Integer earlyStart, earlyFinish, duration;private String name; …} publicclass Dependency {private Activitypredecessor, successor;…} 2007.04.26-ROOTS-Architecture #2
Roles and ObjectsBridging the gap with queries Interaction Algorithm Data Objects frontloader [1] frontpreds [*] actC actA frontload() mental model earlyFinish() data Collaboration Model actD frontloader [1] frontpreds [*] Query actB definefrontloaderas select act from activities act where act.earlyStart == nil and (for all pred in predecessors(act): pred.earlyStart != nil ) someInstance definefrontpredsas select dep.predecessor from dependencies dep where dep.successor = frontloader GUI usecases operations 2007.04.26-ROOTS-Architecture #2
frontloading-3 Algorithm public voidfrontload (Integer startWeek) { FrontIntffrontloader = ??; Set<FrontpredIntf>frontpreds = ??; Integer earlyStart = startWeek; for (FrontpredIntf pred : frontpreds) { earlyStart = Math.max(earlyStart, pred.earlyFinish() + 1); } frontloader.setEarlyStart(earlyStart); } FrontCollab frontCollab = new FrontCollab();FrontIntf frontloader = frontCollab.frontloader; Set<FrontpredIntf> frontpreds = frontCollab.frontpreds; 2007.04.26-ROOTS-Architecture #2
FrontCollabExternal Data View public classFrontCollab{public FrontIntf frontloader; public FrontpredIntf frontpreds;publicFrontCollab () {frontloader = selectFrontloader();frontpreds = predecessorsOf(frontloader);} } 2007.04.26-ROOTS-Architecture #2
Select domain object tofrontloader role by Java Query private FrontIntf selectFrontloader(){ for (Activity act : model.allActivities()) { if (act.earlyStart() == null) { Set<FrontpredIntf> predSet = predecessorsOf(act); if (areAllDone(predSet)) { frontloader = act; return(frontloader); } } } returnnull; 2007.04.26-ROOTS-Architecture #2
Select domain objects tofrontpreds role by Java Query public FrontpredIntf predecessorsOf(FrontIntf act){ Set<FrontpredIntf> preds = new HashSet<FrontpredIntf>(); for (Dependency assoc : model.dependencies() ) { if (assoc.successor() == act) { preds.add(assoc.predecessor()); } } return preds; } 2007.04.26-ROOTS-Architecture #2
Conclusion – 1 of 2: User NeedsBalance Thinking and Doing User needs are in two dimensions; they should be supported in harmony: thinking:→ mental model → data model → objects doing: → use case → collaboration → role → query → objects 2007.04.26-ROOTS-Architecture #2
Conclusion – 2 of 2: Architecture Balance State and Behavior realize instantiate Mental Model Use Cases Algorithm role interaction Conceptualschema reference roles Collaboration roles and links Classattributes select objects behavior state Data Objects 2007.04.26-ROOTS-Architecture #2
That’s all, thank you Questions? PowerPoint and Java code atfolk.uio.no/trygver/2007/roots07.zip 2007.04.26-ROOTS-Architecture #2
http://www.ifi.uio.no/~trygvermailto: trygver ‘at’ ifi.uio.no dca-demo example code:http://heim.ifi.uio.no/~trygver/2006/09-JavaZone/BabyProject-2/ Reenskaug, T.: Original MVC notes from Xerox PARChttp://folk.uio.no/trygver/2007/MVC_Originals.pdf Reenskaug, T,: The BabyUML discipline of programming(where A Program = Data + Communication + Algorithms).SoSym 5,1 (April 2006). DOI: 10.1007/s10270-006-0008-x.http://heim.ifi.uio.no/~trygver/2006/SoSyM/trygveDiscipline.pdf Reenskaug, T.: Programming with Roles and Classes; the BabyUML ApproachTo be published by Nova publishers as a chapter in a book on Computer Software Engineering Research [WEB PAGE] http://folk.uio.no/trygver/2007/babyUML.pdf (.PDF)) Unified Modeling Language: Superstructure. Version 2.1.Object Management Group (OMG) document ptc/06-04-02. http://www.omg.org Arisholm, E.; Sjøberg, D.:A Controlled Experiment with Professionals to Evaluate the Effect of a Delegated versus Centralized Control …,Simula Research Laboratory Technical Report 2003-6http://www.simula.no/publication_one.php?publication_id=601 Reenskaug, T; Wold, P.;, Lehne, O. A.: Working With Objects. This book is out of print. An early .pdf version kan be downloaded free from http://folk.uio.no/trygver/1996/book/book11d.pdf Wirfs-Brock, R.; McKean, A.; Object Design. Roles, Responsibilities, and Collaborations.ISBN 0‑201‑37943‑0; Addison-Wesley; Boston, MA, 2003. Andersen, E. P.; Conceptual Modeling of Objects. A Role Modeling Approach.D.Scient thesis, November 1997, University of Oslo. [web page] http://heim.ifi.uio.no/~trygver/1997/ EgilAndersen/ConceptualModelingOO.pdf Pinker, S.; How the Mind Works; ISBN 0-393-04535-8; Norton; New York, NY, 1997. More reading 2007.04.26-ROOTS-Architecture #2