Enrico Vicario - AA 13/14
SW Engineering
Software Engineering - A.A. 13/14
Elements of Object Oriented Analysis
Enrico Vicario
Dipartimento di Ingegneria dell'Informazione
Laboratorio Scienza e Tecnologia del Software
Università di Firenze
[email protected], www.dsi.unifi.it/~vicario
1/97
Enrico Vicario - AA 13/14
SW Engineering
Problem of Object Oriented Analysis
Object oriented analysis is about
characterizing some conceptual domain
in terms of classes, objects, and relationships
often is an early step in the process of buiding a SW application
but can also serve per-se, to characterize some conceptual domain
In both cases, a model has a pragmatic aim
UML class diagrams provide an effective and practical notation
.. but the real problem
is how to identify objets and classes to represent,
and their attributes and operations,
and their relationships
much about identifying and allocating responsibilities,
according to principles of cohesion and decoupling
If ll this is to build some SW
a subsequent problem is also
how to manage the transition from conceptual to implementation models
… which somehow conditions the way how concepts are initialy identified
2/97
Enrico Vicario - AA 13/14
SW Engineering
The Object Modeling Technique process
Starts with an initial Problem Statement
should be provided by the del customer,
yet, sometimes is suggested by the provider (in despair)
Informal, incomplete, expressed in natural language
.. from which an Analysis Model is elicitated
A concise and non-ambiguous representation of esential concepts
Something that can be discussed and that provides answers
Replaces the problem statement
Requires understanding of the problem statement, and abstractions
The Analysis Models is composed by 3 orthogonal views
the Object model: decsribes the static structure and organization of classes
the Dynamic model: functions performed, how the state can evolve
the Functional model: the algorithms used for data processing
3/97
Enrico Vicario - AA 13/14
SW Engineering
A brief aside on SW engineering, before and after OMT
SW Requirements Specification
(see later about SRS - Mil-STD-498 - 1994 )
Fucntional Requirements: is about what a system is to do
Architectural Requirements: is about the structure of the solution
Quality requirements: is about qualities in the function and structure
(see later abaout ISO9126)
Separation of functional, structural and quality perspectives is crucial
a way to attain orthogonal decomposition of complexity
The first focus shall be on functional requirements
Architectural and quality requirements have not self-concreteness
Fuctional and structural perspectives have different relevance
in different stage and for different roles
The functional perspective is natural to users and customers,
and prevails in the analysis stage
the structural perspective is for developers,
and prevails in the design stage
(about rights and duties of developers and customers)
4/97
Enrico Vicario - AA 13/14
SW Engineering
Example: a problem statement (1/2)
X è un sistema di gestione integrato delle attività di fruizione, di gestione front-office e
back-office di una rete cittadina di biblio+media+teche che conservano volumi, riviste,
audio e video in un a varietà di media diversi.
X incide sul servizio di prestito fornito dal Comune migliorandone l'usabilità e l'efficacia
per gli utenti. Gli utenti possono consultare il catalogo attraverso il web da loro
postazioni private oppure da una o più postazioni dislocate presso ciascuna sede. Il
servizio prevede anche la possibilità di ricevere assistenza nell'accesso al sistema da
parte del personale che opera presso le sedi. Ciascun oggetto nel catalogo è associato
ad una descrizione specializzata in base alla natura dell'oggetto, al suo medium e alla
sua specifica categoria.
La consultazione del catalogo include funzioni di ricerca per titolo o autore,
completamento, ordinamento e filtraggio secondo una varietà di criteri basati su
tipologia di oggetto, medium, classificazione tematica, sede di conservazione. Essa
permette di verificare la disponibilità dell'oggetto cercato e identificarne la locazione
presso una o più biblioteche della rete.
Gli utenti registrati presso una delle sedi e titolari di una tessera di iscrizione possono
compilare la richiesta di prestito, che include la verifica del corretto stato di uso del
prestito da parte dell'utente. Essi possono anche proporre l'acquisizione di nuovi oggetti
e rilasciare propri commenti e classificazioni folksonomiche esposti in modo anonimo
circa gli oggetti che hanno consultato. Tali informazioni possono essere tenute in conto
come elemento di filtraggio a scelta dell'utente. Un utente non registrato può richiedere
la registrazione via Web ma deve comunque poi averla autenticata attraverso
identificazione presso una delle sedi.
(CONTINUA)
5/97
Enrico Vicario - AA 13/14
SW Engineering
Example: a problem statement (2/2)
X mira anche ad incidere sull'efficienza ed il costo di erogazione del servizio fornendo
interfacce efficaci agli operatori di front-office e abilitando la condivisione delle attività di
back-office. In particolare X mira ridurre il costo di dislocazione e manutenzione di HW
e SW presso le diverse sedi attraverso una architettura web-based, nella quale
l'archivio centrale e il server sono dislocati presso una unica sede con funzione di
coordinamento.
Gli operatori di front-office supervisionano il funzionamento "fisico" delle diverse sedi
secondo le modalità consuete di una biblioteca e assistono o sostituiscono gli utenti
nell'accesso al sistema informativo. Il sistema offre all'operatore le funzioni di
registrazione di un utente con assegnamento di una tessera personale con
numerazione univoca, registrazione di un prestito e registrazione di un rientro.
Gli operatori di back-office sono supportati dal sistema nella analisi statistica dello stato
dei prestiti, la verifica dei ritardi e l'inoltro di solleciti, la gestione di nuove acquisizioni e
il mantenimento di un elenco di fornitori.
Il sistema deve inizialmente operare su una rete di 8 biblioteche prevedendo un carico
di utenza nell'ordine di 16000 accessi al giorno, avendo però la capacità di scalare fino
a 32 nodi e 64000 accessi attraverso il potenziamento del nodo centrale e delle
interconnessioni delle sedi. Il tempo di risposta nell'accesso ad una voce del catalogo
da parte di un generico utente web deve rimanere contenuto al disotto di 10 secondi,
fatto salvo il ritardo sul lato utente. Il tempo di accesso nell'accesso al catalogo
effettuato dall'interno di una delle sedi non deve eccedere i 2 secondi.
Tutte le interfacce devono soddisfare i requisiti di accessibilità al livello di AA.
Il sistema gestisce in modo sicuro la autenticazione dei diversi ruoli e garantisce il
mantenimento di un log delle operazioni con caratteristiche di non-revocabilità.
6/97
Enrico Vicario - AA 13/14
SW Engineering
7/97
Discover Objects and functions - 1/2
Enrico Vicario - AA 13/14
SW Engineering
8/97
Discover Objects and functions - 2/2
Capture classes in a class diagram
Enrico Vicario - AA 13/14
SW Engineering
Objects and classes are
conveniently represented
by a class diagram
PersonaleBackOffice
Rete
Personale
Sede
SedeCentrale
PersonaleFrontOffice
CD
… with accompanying text
Catalogo
… la rete ha più sedi
fra cui una centrale.
Ciascuna sede
Tessera
conserva degli articoli,
che sono la concreta
realizzazione
di uno stesso prodotto …
Utente
ArticoloConservato
Carta
MicroFilm
Prestito
Volume
Sollecito
Rivista
Commento
Articolo
Audio
Video
Provides a non-ambiguous basis for discussion
Descrizione
… l'articolo è localizzato nella rete o in una sede?
La Descrizione è riferita all'opera o anche all'oggetto fisico conservato?
9/97
Some elements of method for the identification of objects and classes
Enrico Vicario - AA 13/14
SW Engineering
Core elements
Classes
• Avoid hierarchical classification, easy to add but stiff to let evolve
Associations
• also characterized by names and cardinality
Attributes
• Just a few, with no aim of completenes,
often representing concepts that will later be delegated to outer classes
Operations emerge much later in the process of analysis and design
More related to specification than to conceptual analysis
Closely coupled with use-cases (see later)
Much more difficult to identify and allocate
Identification of objects and classes is a task for the analyst
Not for the customer,
who remains responsible for interpreting the model,
criticizing, and validating
10/97
Enrico Vicario - AA 13/14
SW Engineering
identification of objects and classes
An object
is provided with a state (attributes),
and with operations that elaborate on the state
It is something that we need to have represented
A class
Is the type of one or more objects
Some classes have a single instance (e.g. il Catalogo)
Some have many (e.g. un Articolo)
A nominalistic approach
An object is usually a noun (sostantivo)
Also an attribute is a noun
A Method is a predicate, and the object is its direct object
(complemento oggetto)
11/97
Enrico Vicario - AA 13/14
SW Engineering
A checklist to identify objects and classes
Possible Objects (and Classes)
Physical or tangible objects: un Articolo, …
A descriptor of some object: la Descrizione di un Articolo,…
A location: una Sede, …
A transaction that shall be recorded: un Sollecito, un Prestito,…
A detail or a part of a transaction: la Tessera usata in un Prestito
The role of some people: Utente, PersonaleFrontOffice, …
A container: Catalogo, Rete, …
Something contained: Sede, ArticoloConservato, …
An abstract object: Prestito, Articolo
An organizational unit: Sede, …
An event: Restituzione (not in the model)
A process: la gestione dei Solleciti
A rule or policy: una Regola per la generazione di Solleciti
An index: Catalogo
A record: ArticoloConservato, …
A document: Tessera, Commento, …
useful to begin …
12/97
Enrico Vicario - AA 13/14
SW Engineering
Some false objects
Attribute
A value referred to an object: la collocazione di un ArticoloConservato
Yet, this could become an autonomous object
if developed to assume complexity and state:
e.g. Tessera could have initially been an attribute of Utente
Functoid
A function encapsulated into a class
• AlgoritmoRicerca, ha un metodo run(), non ha attributi (stato)
A vague abstraction, often missing a sharp definition
“servizio di prestito”
may become an object if I'm able to give it a specification,
and I'm interested in representing its concept (e.g. la carta dei servizi)
A concept pertaining to the implementation
Algoritmo, funzione, CPU, …
13/97
Enrico Vicario - AA 13/14
SW Engineering
Questions and remarks (out of order)
Is the Catalogo an object?
Does the Catalogo has a state?
Can this state be read or modified through some operation?
The number of active Prestito for a Utente at a certain time
is an object, or an attribute, or a value that can be computed?
if the value is logged, then becomes an object (storicizzazione)
Othewise, it is more probably an attribute or even just a value
Do not mess reality and infromation about reality
Utente can be something in the reality, or its descriptor in some application
Both views can be relevant for the model, depending on the aim
(conceptual or specification model)
Operations are allocated to the objects that they modify
In the reality, registration of a Prestito is performed by Personale,
but, the action modifies the state of the Utente (or its Tessera);
So, the operation is allocated to Utente (or its Tessera)
14/97
Enrico Vicario - AA 13/14
SW Engineering
Star UML
Open source, easy to use and quite complete
but for Windows only, and not advanced since long time
http://staruml.sourceforge.net/en/
Visual Paradigm
Java Based and thus cross platform
Community Edition freely distributed
http://www.visual-paradigm.com/
Argo UML
Open Source, Java Based and thus cross platform
http://argouml.tigris.org/
15/97
Tools
Enrico Vicario - AA 13/14
SW Engineering
Responsabilità
L’identificazione delle responsabilità e loro allocazione,
è il vero cuore della analisi OO
riguardare gli oggetti come entità
capaci di assumere responsabilità
anche collaborando con altre entità
Tipicamente codificato nel design
Responsibility Driven Design (RDD)
General Responsibility Assignment Software Patterns (GRASP)
Applicabile anche in analisi
Resposnabilità di fare e conoscere
effettuare una azione (creare un oggetto, eseguire un calcolo,...)
delegare una azione (provocare una azione in altri oggetti)
conoscere i propri dati privati
conoscere oggetti correlati
conoscere cose che può derivare o calcolare
16/97
Enrico Vicario - AA 13/14
SW Engineering
References
Martin Fowler, “UML Distilled: a brief guide to the standard object
modeling language”, third edition (Addison Wesley).
Rumbaugh, J., Blaha, M., Premerlani, W., Eddy, F., Lorensen, W.,
Object-Oriented Modeling and Design, Prentice-Hall, 1991.
Martin Fowler, “Analysis Patterns, reusable object models”, Addison
Wesley 1997.
17/97
Scarica

ElementsOfOOAnalysis - Dipartimento di Ingegneria dell`Informazione