860 likes | 991 Views
Development of Rigorous Adaptive Information Systems. Dr. Nasreddine Aoumeur FIN, ITI, DB group aoumeur@iti.cs.uni-magdeburg.de Course Site: wwwiti.cs.uni-magdeburg.de/~aoumeur wwwiti.cs.uni-magdeburg.de/iti_db/lehre/oois/inde.
E N D
Development of Rigorous Adaptive Information Systems Dr. Nasreddine Aoumeur FIN, ITI, DB group aoumeur@iti.cs.uni-magdeburg.de Course Site: wwwiti.cs.uni-magdeburg.de/~aoumeur wwwiti.cs.uni-magdeburg.de/iti_db/lehre/oois/inde ... Service-Driven Applications
Service-Driven Applications Rigorous Development OO Concepts and UML Method Dr. Nasreddine Aoumeur FIN, ITI, DB group aoumeur@iti.cs.uni-magdeburg.de wwwiti.cs.uni-magdeburg.de/~aoumeur wwwiti.cs.uni-magdeburg.de/iti_db/lehre/soa ... Service-Driven Applications
Information Systems: Working definition • reactive systems (i.e. in continuous interaction with their environment), with • large amount of immutable and non-immutabledata(i.e. fixed and changing) and, with • processes and activities for exhibiting behaviors on these (state-less and –full) data. ... Service-Driven Applications
Different generations of CMs : “Entity first” Entity-Relationship[1973..] - Intuitive / Simple - Revolutionary for IS - UoD : Entities+Relations - Mathematically sound - Rich abstraction mechnanisms - Different variants (NIAM / SADT / MERISE / ..) IS Conceptual Model State-less and -ful DATA Process-centric Formalisms - CCS, CSP, DFD, Petri Nets, .. - Synchronous / asynchronous - Mathematically sound - Executable / operational Processes and Rules ... Service-Driven Applications
CMs Generation shift: “Entity To Object” From E/R to “Object-Object Entity Name Attribute1 : Type1 Attribute2 : Type2 .... Attributei : Typei n-m PART i-j Assoc m Entit(ies) data Property1 ..... operations IS-A n Entit(ies) data operations Processes, Operationsand Rules ... Service-Driven Applications
First generation of CMs : “Entity to Object” E/R Conceptual Model (Running) Account Number : Nat Balance : Money Limit : Money History : List[Date,Money] Customer Name : String Birth-Date : Date Address : Address Income : Money 1-2 0-N Own Open-Date Bank IS-A Saving Account Number : Nat Interest : Percent Balance Processes and Rules Account USE : Firstopen --- then deposit – then (withdraw-deposit)* - then Close-or-be-closed ... Service-Driven Applications
CMs generation shift : “From Entity to object” From E/R to Object Model : Banking Example (Running) Account Number : Nat Balance : Money Limit : Money History : List[Date,Money] Customer Name : String Birth-Date : Date Address : Address Income : Money 1-2 0-N Own Open-Date Bank Own(account) : Boolean Deposit (amount) Withdraw(Amount) • +open (date, bank) • close(date) • Debit(Amount) • Credit(Amount) +open - close deposit withdraw Processes,operations and Rules Account USE: First open - then deposit–> then (withdraw-deposit)* --> thenClose-or-be-closed ... Service-Driven Applications
CM Generation shift : “From Entity to Object” From E/R Model to Object : ATM example Customer Name : String AutomaticTellerMachine ATM-Reference : String Cash : Hidden Bank : String Transaction : List[Money] History :List[Card-Nb,Acnt-Nb,Money Bank-Card Number : Nat Account-Nb: Nat Code : String 1-2 • Withdraw (ac, amount) • deposit (ac, amount) 0-N Withdraw • Create() • Delete() • - Accepted() • Rejected() Amount Date • - Read-card() • Enter-Pin(Code) • Enter-Amount(Money) • Get-Money(Money) Enter-card Enter-code enter-amount Get-money Processes, operations and Rules ATM-use : First enter-card – then enter-code– then enter-transaction— get money ... Service-Driven Applications
CM Generation shift: “From Entity to Object” From E/R Model to Object : The Library Example Book Reference : String Name : String Author : String Publisher : String Student Name : String Subscription-Nb Semester Borrow 0-N 0-3 Date-Out Date-Back • Add() • Suppress() • - ToBorrow(Date) • ToReturn(Date) • Subscribe2Library • Unsubscribe • GetCard • ReceivePenalty Subscribe Unsubscribe Borrow Return Penality Processes, operations and Rules First subscribe-- Get library-card – (Borrow – Return –or– Penality)*--(be)Unsubscribe(d) ... Service-Driven Applications
Object-Oriented Paradigm : General Overview In real world terms: • An object represents an individual entity or thing. • A class represents a group of objects that exhibit some common characteristics or behavior. • Classes are resulted from classification. OO phylosophy : The real-world consists in a society of interacting objects. • Examples of classes in real world: • Students • Graduate students • Undergraduate students • MS students • Ph.D. students ... Service-Driven Applications
Object-Oriented Paradigm : Main concepts • An object has • state: defined by the set of fields or attributes. • behavior: defined by the set of methods oroperationthat can be applied to the object. • identity: determined at the creation time to uniquely referencing the object. • Class • A template for creating objects. • Objects of the same class exhibit the same behavior. • But generally, they posses different states (attribute values) ... Service-Driven Applications
Object-Oriented Paradigm : Main conceptsObject and Class Like in real world: • Id : IF-43342 • Title : „Petri Nets“ • Author : „W.Reisig“ • State :{available, borrowed, use..} • borrowed • returned • edited • ..... one can has Book Attributs (state) Methods (behaviour) Object ... Service-Driven Applications
Object-Oriented Paradigm : Main conceptsobject-class The class MyDate The object d is an instance of class MyDate MyDate d:MyDate fields day (or:,variables day = 31 month state month = 1 year attributes) year = 2000 set (d,m,y) set (d,m,y) incDays (nDays) methods incDays (nDays) getWeekDay ( ) getWeekDay () ... Service-Driven Applications
Object-Oriented Paradigm : Main concepts Object-Class The class Accounts Object Ac-Nasr instance Account Ac-Nasr : Account Number balance (fields, variables Number = 3130888 limit state Balance = 1200 history attributes) Limit = 20 History = [20.2.2.07,…] methods + open Close debit(amount) Credit(amount Tranfer(ac1,ac2) ... Service-Driven Applications
Object-Oriented Paradigm : Main concepts Encapsulation The Account Class The ATM Class debit(Id, Money) • - Transaction(Tr) • AcntNb(AcN) • CardNb(AcN) • - Balance(Bal) : Money • Limit(Lm) : Money • History(Hs) :List[M.D] - Pin(Id) • - Store(Sr) : Money • State(St) : State credit(Id, Money) Insert-Card(InC)() Insert_Code(InsC)(C) Choose_Trans(CTr)(M) ... Service-Driven Applications
Object-Oriented Paradigm : Main conceptsEncapsulation Principles • In general all attributes should be private. • Use EXCLUSIVELY methods such as debit and credit to access the internal state. • Only methods that are part of the “interface” should be public. • Instance variables and methods are visibile within that object and other instances of the class. • With respect to other objects and classes scope can be modified • private : accessible only within the concerned class • protected : could be changed at subclasses • public : could be manipulated everywhere ... Service-Driven Applications
Object-Oriented Paradigm : Main conceptsEncapsulation At-work ENCAPSULATION class MyDate { private int day, month, year; public void set (int d, int m, int y) {day=d, month= m, year= y … } public void incDays (int nDays) {. . .} public int getWeekDay ( ) { . . . } } class OtherClass { void anyMethod { MyDate d = new MyDate ( ) ; d.set (09, 5, 2007) ; d.month = 3; // COMPILATION ERROR !!! } } ... Service-Driven Applications
//without encapsulation: circle k = new circle(); k.radius = – 88; // radius negative! //with encapsulation circle k = new circle(); boolean b = k.setRadius(– 88); // radius never negative! Object-Oriented Paradigm : Main conceptsEncapsulation At-work class circle{ double radius, middlepointX, middlepointY; boolean setRadius(double newRadius){ if (newRadius > 0) { radius = newRadius; return true;} else return false; } } ... Service-Driven Applications
Object-Oriented Paradigm : Main conceptsInheritance Concept A mechanism to organize classes by commonalities. • subclasses, specialization • superclass, generalization • Is-a relation Example: • A graduate student is a student. • A Master student is a graduate student. • A Ph.D. student is a graduate student. • An undergraduate student is a student. ... Service-Driven Applications
Object-Oriented Paradigm : Main conceptsInheritance concept and illustration ... Service-Driven Applications
Object-Oriented Paradigm : Main conceptsInheritance concept and illustration Running Account Number : Nat Balance : Money Limit : Money History : List[Date,Money] • +open (date, bank) • close(date) • Debit(Amount) • Credit(Amount) Saving Account Interest : Percent BalanceSav : Money • +open (date, bank) • close(date) • IncreaseInterest(Percent) • Money(money,account) ... Service-Driven Applications
Object-Oriented Paradigm : Main conceptsInheritance concept and illustration (ordinary) book NumberCode : Nat Title : String Status : {available, borrrowed.} NumberCopies : Natural • Toborrow (date) • ToReturn(Date) Thesis Field Supervisor Mark Date-defense Periodics Editors Publisher Online-Publications URL Durationsubscription GetCoppy • +subscribe • unsubscribe ... Service-Driven Applications
Object-Oriented Paradigm : Main conceptsInheritance at work class Base { Base(){} Base(int i) {} protected void foo() {…} } class Derived extends Base { protected void foo() {…} Derived(int i) { super(i);… super.foo(); } } Base Derived ... Service-Driven Applications
Object-Oriented Paradigm:Main constructions Overloading and Polymorphism concept Overloading: • Two or more methods/constructors with the same name but different numbers or different types of parameters: void methodB(int i)void methodB(float f) Overriding • Replacing the implementation of a methods in the superclass with one of your own. • You can only override a method with the same signature. Please Avoid overloading !!!! ... Service-Driven Applications
Object-Oriented Paradigm:Main constructions Overloading and Polymorphism concept Polymorphism: • Inheritance creates an “is a” relation: • For example, if B inherits from A, then we say that “B is kind of an A”. • A same method same defined in the class hierarchy • How to dynamically choose the right methods ? ... Service-Driven Applications
Object-Oriented Paradigm:Main constructions Polymorphism concept GuiComponent width:int height:int center:point setOptimalSize( ) moveTo(newX, newY) Editbox Scrollbar minValue text: String maxValue getValue( ) append(String) setOptimalSize( ) getText( ) ... Service-Driven Applications
Object-Oriented Paradigm:Main constructions Polymorphism at-work • A subclass inherits all members of its superclass: • Variabls • Methods • A subclass can: • Add more variables • Add more methods • Override methods of its superclass Scrollbar sb = new Scrollbar ( ) ; Q : What are the attributes (variables) of sb? What are the methods that sb can execute? ... Service-Driven Applications
Object-Oriented Paradigm:Main constructions Polymorphic Dynamic binding GuiComponent g ; if (scrollbarWasSelected) g = new Scrollbar ( ) ; else g = new EditBox ( ) ; g.setOptimalSize ( ) ; / / dynamic binding • A reference to a superclass can point to objects of its subclasses. • The pointer g is a polymorphic pointer. ... Service-Driven Applications
Object-Oriented Paradigm:Main constructions Complex Polymorphic Dynamic binding GuiComponent [ ] ga = new GuiComponent [3] ; ga[0] = new Scrollbar ( ) ; ga[1] = new Scrollbar ( ) ; ga[2] = new EditBox ( ) ; for (int i=0 ; i<ga.length ; i++) { ga[i] . setOptimalSize ( ) ; //line 6 } Q: Which version of setOptimalSize is called in line 6? Polymorphism allows us to work with an object without knowing its exact type ... Service-Driven Applications
Object-Oriented Paradigm:Main constructions Polymorphism at-work (casting problem) CASTING class GuiComponent { void setOptimalSize ( ) { . . . } } class Scrollbar extends GuiComponent { void setOptimalSize ( ) { . . . } int getMinValue ( ) {.. . } } guiComponent g ; g = new Scrollbar ( ) ; Suppose we know that g currently points to a Scrollbar, and we want to call: n = g.getMinValue ( ) ; This will cause a compilation error (why?) …. Casting problem ... Service-Driven Applications
Object-Oriented Paradigm:Main constructions Polymorphism at-work (casting problem) • The solution is casting (actually down casting). • Casting = convert a variable from one type to another. • Down Casting = convert from a superclass to one of its subclasses. sb = ( (Scrollbar) g).getMinValue ( ) ; Or: Scrollbar sb = (Scrollbar) g ; sb.getMinValue ( ) ; • We “tell” the compiler that g currently points to a Scrollbar. • if g does not currently point to a Scrollbar, a ClassCastExceptionis thrown. ... Service-Driven Applications
C C D D C C D D Object-Oriented Paradigm:Main constructions Association Types association directed association aggregation whole part a stronger form of association composition If an object d of class D is related to an object c of class C, then d depends existencialy on c. a stronger form of aggregation ... Service-Driven Applications
C C C D D D Object-Oriented Paradigm:Main constructions Association Types Association Ends Each object of class C is related to 1 to 5 objects of class D Each object of class D is related to exactly one object of class C 1 1..5 Each object of class C is related to at least one object of class D Each object of class D is related to arbitrary many objects of class C * 1..* {ordered} Associated objects of class D are ordered * 1..* ... Service-Driven Applications
Line Point Object-Oriented Paradigm:Main constructions Association Types lRole determine -pRole 0..1 2 association name role used to navigate direction 2 points determine a line directed aggregation ... Service-Driven Applications
C D C D Object-Oriented Paradigm:Main constructions Association Types Class Diagrams Inheritance Class C inherits from class D dependency relationship Class C depends on class D ... Service-Driven Applications
Object-Oriented Paradigm:Main constructions Association Types : Aggregation Car 1..4 1..1 1..1 4 4 1 Engine Brakes Wheel SearingWheel ... Service-Driven Applications
Conceptual Modelling of IS in UML • State-less and stateful DATA • - Use Cases • - Class Diagrams • - Object Diagrams • Object Constraint Language Structural aspects Forall C in …. • Processesand Rules • - Sequence Diagrams • - Collaboration Diagrams • - State Diagrams • Activity Diagrams • Component / deployment diagrams (implementation) Behavioural aspects ... Service-Driven Applications
Airport Flight Passenger Conceptual Modelling of IS in UML View-oriented system modelling Information system partial views Use caseArrival Includes Landing Description The plane is landing. Then the passengers deplane and the luggage is unloaded. If the passenger has luggage then the passenger claims its luggage. . . . . UML diagrams ... Service-Driven Applications
The origins of UML UML : Overview and History UML resulted from the merging of three very popular OOD methods - ---The three-Amigos Jacobson’s Use-Case approach This focused on the external actors interacting with the system and their functional requirements.. A CASE tool called Objectory is available. Booch’s OOD Booch’s method developed originally in 1991 based on OO Diagrams rather complex and CASE tool support essential. The emphasis here was on design and implementation. Rumbaugh’s OMT Object modeling technique supported by OMTool. Very Straightforward approach with an excellent text book. Widely adopted in academia and industry alike. Focus very much on analysis rather than design and implementation. ... Service-Driven Applications
UML : Overview and History . . . What is UML • A Conceptual Modeling • Used to describe asimplified (abstract) view of reality • in order tofacilitate thedesign and then the implementation ofobject-oriented software systems • Conceptual Language • UML is primarilya graphical languagethat follows a precise syntax. • A UNIFIED • As By the start of the 90’s there was a flood of modeling languages, each with itsown strengths and weaknesses. ... Service-Driven Applications
UML : Overview and History . . When is UML • In 1994 the UML effort officially began as a collaborative effort between Booch and Rumbaugh. Jacobson was soon after included in the effort. • The goal of UML: • A comprehensive modeling language (all things to all people) that • Promotion of the communication between all members of the development effort. • Version : UML 1.0 …. UML 2.0 (2003) ... Service-Driven Applications
UML : Overview and History . . What is UML • UML is a language • Conforms tospecific rules. • Allows the creation of (structural, behavioural, and functional)various models. • Does not tell which models need to be created. • UML is a languagefor visualizing • UML is agraphical language. • Pictures facilitate communication (a picture is worth a thousand words) • UML is a language forconstructing and understanding • UML supports both forward and reverse engineering. • UML is a language forsupporting analysis, specification and design • UML is intended primarily forsoftware-intensive information systems ... Service-Driven Applications
UML : Overview and History . . What is UML • Diagrams: • Structural aspects : • Class and object diagrams • Component and deployment (implementation) • OCL (object constraints language)for invariants, pre- and post-conditions. • Behavioural aspects : • Use cases, • Statechart, • Activity diagrams • Sequence diagrams • A set of standardised diagramatic notations for representing different aspects of a (information) system. Containing static structural views, dynamic behavioural views and functional views ... Service-Driven Applications
The Unified Modelling Language UML : Overview and History . . UML is NOT • A design method or process, neither is it a methodology. • There is no provision for project management • specification of deliverables or life cycle or provision • for estimation • Users, developers can uses • - Whatever process and life cycle – RAD they want • - Focus on Prototyping / incremental development • - Focus on waterfall or spiral - they wished and • - Provide their own project management and QA • framework. ... Service-Driven Applications
UML : Overview and History . . Inside UML • Static, structure diagrams • Class and instance diagrams • These depict the components (classes or instances) within the • system, • Their attributes and methods and their relationships with • each other • The class diagram in particular is the most important single • diagram in the design • Plus OCL constraints on invariants pre- and post-conditions • on methods • Component and subsystem diagrams (implementation) • - How classes are grouped to form large assemblies - • reusable components, sub-systems or packages of classes. • Deployment diagrams (implementation) • - How the software components are deployed across a set • of hardware components. ... Service-Driven Applications
UML : Overview and History . . Inside UML • Interaction diagrams • Use-case diagrams • - Show the interface between the system and the outside world • - Identify the actors in the system and their required • functionality. • Sequence diagrams • - Capture the functionality of the system suing the messages • passing between objects. • - Each sequence diagram shows the implementation of one • scenario • Collaboration diagrams • - Based on the instance diagram, it shows how specific • scenarios are implemented by message sequence. • - Similar to sequence diagrams but with more detail ... Service-Driven Applications
UML : Overview and History . . Inside UML • Dynamic behaviour of the system • Activity diagrams • - Similar to Petri-nets, • - Provide a view of the way objects interact and changes • their states in consequence • - The emphasis here is on system functionality as • perceived by users • Statecharts • - Harel Statecharts are developed from finite state • notation • - Illustrate the dynamic behaviour of objects. i.e. the way • in which an object evolves through time • - in response to external events. ... Service-Driven Applications
UML : Overview and History . . UML for IS • Most diagram types are involved, but principally at the conceptual level : • Conceive a use-case diagram • - identify actors • - identify major functional requirements • Conceive an initial Class diagram • - discover principle classes • - represent important relationships • Event sequence diagrams • - Examine possible object interactions • - Determine class protocols • At Implementation model different refinements are to undertake • - combining or splitting classes, - adding or removing • relationships, -defining the implementation of • relationships, - introducing generalisations, interfaces • - Introduce Component, sub-system and deployment models. ... Service-Driven Applications
UML : Use Cases Overview and illustrations A use case ... • Specifies what systemwill be used for, before the defining what system is supposed to do • Describe functionality ofa systemyielding observable results • Details scenarios that describe the interaction/dialog between users of the system and the system itself. Identify who (or what) interacts with the system • Does not indicate how the specified behavior is implemented, only what the abstract behavior is. • Performs a service for someusersof the system. • A user of the system is known as anactor. • An actorcan be a person or another system. • During the conceptual phase • Facilitates communication between the usersand developers of the system. • Facilitates the goal-based understanding of the system ... Service-Driven Applications
UML : Use Cases Basic artifacts Actor Relationship UseCaseName An Actor is consistent set of roles that user plays when interacting with the system (e.g. a user or outsider of the system that interacts with the system) A Use Cases a sequence of actions performed by a system that yields a valuable result for a particular actor A link between the actors and the functions (use-cases). Different relationships are possible. ... Service-Driven Applications