UML. Design Principles.

Similar documents
So#ware Engineering GRASP Pa1erns. Klaus Ostermann

The conceptual view. by Gerrit Muller University of Southeast Norway-NISE

Transactions on Information and Communications Technologies vol 18, 1998 WIT Press, ISSN

Comp 11 Lectures. Mike Shah. July 12, Tufts University. Mike Shah (Tufts University) Comp 11 Lectures July 12, / 33

The File Geodatabase API. Craig Gillgrass Lance Shipman

Information System Design IT60105

FACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING OBJECT ORIENTED PROGRAMMING DATE 07/2014 SESSION 8:00-10:00

Bentley Map Advancing GIS for the World s Infrastructure

Factory method - Increasing the reusability at the cost of understandability

Flexible Support for Spatial Decision- Making

The Standard Infrastructure

Geodatabase: Best Practices. Robert LeClair, Senior Instructor

Geodatabase Best Practices. Dave Crawford Erik Hoel

Enabling ENVI. ArcGIS for Server

Design and implementation of a new meteorology geographic information system

The Swedish National Geodata Strategy and the Geodata Project

Geosciences Data Digitize and Materialize, Standardization Based on Logical Inter- Domain Relationships GeoDMS

ArcGIS Enterprise: What s New. Philip Heede Shannon Kalisky Melanie Summers Sam Williamson

Information System Decomposition Quality

A BASE SYSTEM FOR MICRO TRAFFIC SIMULATION USING THE GEOGRAPHICAL INFORMATION DATABASE

Flexible Support for Spatial Decision-Making

Aitso: an artificial immune systems tool for spatial optimization

Introduction to Portal for ArcGIS. Hao LEE November 12, 2015

Information System Desig

GIS for spatial decision making

4D information management system for road maintenance using GIS

An object-oriented design process. Weather system description. Layered architecture. Process stages. System context and models of use

Entropy as a Measure of Object-Oriented Design Quality

Introduction to Portal for ArcGIS

Searching. Sorting. Lambdas

Training Path FNT IT Infrastruktur Management

Smart Data Collection and Real-time Digital Cartography

GIS Supports to Economic and Social Development

Compiling Techniques

Performing Advanced Cartography with Esri Production Mapping

Live Formulations of International Association for the properties of Water and Steam (IAPWS)

Overview of Geospatial Open Source Software which is Robust, Feature Rich and Standards Compliant

Chapter 1. GIS Fundamentals

GIS Solution For Electric Utilities With Integration With Distribution Management System

Global Geospatial Information Management Country Report Finland. Submitted by Director General Jarmo Ratia, National Land Survey

Chapter 2: Object Oriented Analysis. 1.0 Building Domain/Conceptual Models

NCU EE -- DSP VLSI Design. Tsung-Han Tsai 1

More on Methods and Encapsulation

gvsig: Open Source Solutions in spatial technologies

86 Part 4 SUMMARY INTRODUCTION

Research on Object-Oriented Geographical Data Model in GIS

Verification and Validation. CS1538: Introduction to Simulations

Esri UC2013. Technical Workshop.

Linking local multimedia models in a spatially-distributed system

Framework for on an open 3D urban analysis platform based on OGC Web Services

ArchaeoKM: Managing Archaeological data through Archaeological Knowledge

Performing Map Cartography. using Esri Production Mapping

GENERALIZATION IN THE NEW GENERATION OF GIS. Dan Lee ESRI, Inc. 380 New York Street Redlands, CA USA Fax:

Geological information for Europe : Towards a pan-european Geological Data Infrastructure

Canadian Board of Examiners for Professional Surveyors Core Syllabus Item C 5: GEOSPATIAL INFORMATION SYSTEMS

AN OBJECT-ORIENTED DATA MODEL FOR DIGITAL CARTOGRAPHIC OBJECT

STEAMEST: A Software Tool for Estimation of Physical Properties of Water and Steam

Management of Geological Information for Mining Sector Development and Investment Attraction Examples from Uganda and Tanzania

FACULTY OF SCIENCE ACADEMY OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING OBJECT ORIENTED PROGRAMMING DATE 09/06/2014 SESSION 8:30-10:30

The integration of land change modeling framework FUTURES into GRASS GIS 7

Understanding Geographic Information System GIS

EMMA : ECDC Mapping and Multilayer Analysis A GIS enterprise solution to EU agency. Sharing experience and learning from the others

Collaborative NLP-aided ontology modelling

NEC PerforCache. Influence on M-Series Disk Array Behavior and Performance. Version 1.0

Portal for ArcGIS: An Introduction

Administering your Enterprise Geodatabase using Python. Jill Penney

Texts 1. Required Worboys, M. and Duckham, M. (2004) GIS: A Computing Perspective. Other readings see course schedule.

CHAPTER 22 GEOGRAPHIC INFORMATION SYSTEMS

Bentley Map Advancing GIS for the World s Infrastructure

Standardization of Quantum Cryptography in China

Your Virtual Workforce. On Demand. Worldwide. COMPANY PRESENTATION. clickworker GmbH 2017

Appendix B Microsoft Office Specialist exam objectives maps

Activities, Fragments and Intents

GIS Based Transit Information System for Metropolitan Cities in India

Trivadis Integration Blueprint V0.1

C L O U D S E C U R I T Y A L L I A N C E : W H E R E W E A R E & W H E R E W E A R E G O I N G

Bentley Map V8i (SELECTseries 3)

Web GIS Deployment for Administrators. Vanessa Ramirez Solution Engineer, Natural Resources, Esri

Demand forecasting. Mehmet Yurdal May White paper

Leveraging Your Geo-spatial Data Investments with Quantum GIS: an Open Source Geographic Information System

YYT-C3002 Application Programming in Engineering GIS I. Anas Altartouri Otaniemi

Building an Enterprise GIS for Chicago s Water Reclamation District

TERMS OF REFERENCE FOR PROVIDING THE CONSULTANCY SERVICES OF

THE SPATIAL DATA SERVER BASED ON OPEN GIS STANDARDS IN HETEROGENEOUS DISTRIBUTED ENVIRONMENT

Pysynphot: A Python Re Implementation of a Legacy App in Astronomy

Recursion. Computational complexity

THE IMPLEMENTATION OF OBJECT-ORIENTED TIN-BASED SUBSYSTEMS FOR GIS

Corporate. Information. Railway Infrastructure Administrator. Year indracompany.com

Data Aggregation with InfraWorks and ArcGIS for Visualization, Analysis, and Planning

Qualitative Spatio-Temporal Reasoning & Spatial Database Design

Army Installation Geospatial Information and Services (IGI&S) Program Overview

Volume Editor. Hans Weghorn Faculty of Mechatronics BA-University of Cooperative Education, Stuttgart Germany

Predicting the Reliability of Component-Based Software Architectures

The Geodetic Infrastructure Management Via Web-Based Mapping Technology in Morocco

Traffic Simulation Toolbox User s Manual

Document Title. Estimating the Value of Partner Contributions to Flood Mapping Projects. Blue Book

On Applying Point-Interval Logic to Criminal Forensics

Software Architecture. CSC 440: Software Engineering Slide #1

2007 IEEE. Personal use of this material is permitted. However, permission to reprint/republish this material for advertising or promotional purposes

Labs: Chelsea Ackroyd Office Location: FMAB 005 Office Hours: M 08:45 11:45 AM or by appointment

Transcription:

.. Babes-Bolyai University arthur@cs.ubbcluj.ro November 20, 2018

Overview 1 2 3

Diagrams Unified Modeling Language () - a standardized general-purpose modeling language in the field of object-oriented software engineering. includes a set of graphic notation techniques to create visual models of object-oriented software.

Class Diagrams Class diagrams - describe the structure of a system by showing the system s classes, their attributes, and the relationships between them.

Class Diagrams c l a s s R a t i o n a l : d e f i n i t ( s e l f, a, b ) : I n i t i a l i z e a r a t i o n a l number a, b i n t e g e r s s e l f. n r = [ a, b ] d e f getdenominator ( s e l f ) : Denominator g e t t e r r e t u r n s e l f. n r [ 1 ] d e f getnominator ( s e l f ) : Nominator g e t t e r r e t u r n s e l f. n r [ 0 ]

Class Diagrams In the diagram classes are represented using boxes which contain three parts: Upper part holds the name of the class Middle part contains the attributes of the class Bottom part contains the methods or operations

Relationships A relationship is a general term covering the specific types of logical connections found on class diagrams. A Link is the basic relationship among objects. It is represented as a line connecting two or more object boxes.

Associations Binary associations (with two ends) are normally represented as a line, with each end connected to a class box. An association can be named, and the ends of an association can be annotated with role names, ownership indicators, multiplicity, visibility, and other properties. Association can be Bi-directional as well as uni-directional.

Aggregation Aggregation - an association that represents a part-whole or part-of relationship.

Aggregation Aggregation - an association that represents a part-whole or part-of relationship. c l a s s Car : d e f i n i t ( s e l f, eng, c o l ) : I n i t i a l i z e a c a r eng engine, c o l s t r i n g, i. e w h i t e s e l f. e n g = eng s e l f. c o l o r = c o l c l a s s Engine : d e f i n i t ( s e l f, cap, t y p e ) : I n i t i a l i z e the e n g i n e cap p o s i t i v e i n t e g e r, t y p e s t r i n g s e l f. c a p a c i t y = cap s e l f. t y p e = t y p e

Dependency, Package Dependency - a relationship in which one element, the client, uses or depends on another element, the supplier Create instances Have a method parameter Use an object in a method

Dependency, Package

principles Create software: Easy to understand, modify, maintain, test Classes - abstract, encapsulate, hide implementation, easy to test, easy to reuse General scope: managing dependency Single responsibility Separation of concerns

Layered architecture Layer - a logical structuring mechanism for the elements that make up your software solution A multilayered software architecture is using different layers for allocating the responsibilities of an application. A layer is a group of classes (or modules) that have the same set of module dependencies to other modules and are reusable in similar circumstances.

Layered architecture Layers our programs will use... User Interface Layer (aka View Layer, UI layer or Presentation layer) Application Layer (aka Service Layer or Layer) Domain layer (Business Layer, Business logic Layer or Model Layer) Infrastructure Layer (data access or other persistence, logging, network I/O e.g. sending emails, and other kind of technical services)

General Responsibility Assignment Software Patterns (or ) consists of guidelines for assigning responsibility to classes and objects in object oriented design.

- attempts to keep objects focused, manageable and understandable. High cohesion means that the responsibilities of a given element are strongly related and highly focused. Breaking programs into classes and subsystems is an example of activities that increase the cohesive properties of a system. Low cohesion is a situation in which an element has too many unrelated responsibilities. Elements with low cohesion often suffer from being hard to comprehend, hard to reuse, hard to maintain and adverse to change

dictates how to assign responsibilities to support: Low dependency between classes; Low impact in a class of changes in other classes; High reuse potential

Forms of coupling: TypeX has an attribute (field) that refers to a TypeY instance, or TypeY itself. TypeX has a method which references an instance of TypeY, or TypeY itself, by any means. (parameter, local variable, return value, method invocation) TypeX is a direct or indirect subclass of TypeY.

Assign a responsibility to the class that has the information necessary to fulfill the responsibility. is a principle used to determine where to delegate responsibilities. These responsibilities include methods, computed fields and so on. Assign responsibilities by looking at a given responsibility, determine the information needed to fulfil it, and then figure out where that information is stored. leads to placing responsibility on the class with the most information to fulfil it

Point of Sale application

Point of Sale application

Point of Sale application 1 Maintain encapsulation of information 2 Promotes low coupling 3 Promotes highly cohesive classes 4 Can cause a class to become excessively complex

Creation of objects is one of the most common activities in an object - oriented system. Which class is responsible for creating objects is a fundamental property of the relationship between objects of particular classes.

pattern is responsible for creating an object of the class. In general, a class B should be responsible for creating instances of class A if one, or preferably more, of the following apply: Instances of B contains or compositely aggregates instances of A Instances of B record instances of A Instances of B closely use instances of A Instances of B have the initializing information for instances of A and pass it on creation.

How responsibilities should be assigned in such a fashion that the current or future variations in the system do not cause major problems with system operation and/or revision? Create new classes to encapsulate such variations. The protected variations pattern protects elements from the variations on other elements (objects, systems, subsystems) by wrapping the focus of instability to a separate class. (with an interface and using polymorphism to create various implementations of this interface).

Task: Validate student, possible validation designs: Class member function in Student that returns true/false Static function returning the list of errors Separate class that encapsulate the validation algorithm Validator class The protected variations pattern protects elements from variations on other elements (objects) by wrapping the focus of instability to a separate class

Demo Validate student - ex19 studentvalidator.py

When an expert violates high cohesion and low coupling Assign a highly cohesive set of responsibilities to an artificial class that does not represent anything in the problem domain, in order to support high cohesion, low coupling, and reuse - a class that does not represent a concept in the problem domain is specially made up to achieve low coupling, high cohesion

Problem: Store Student (in memory, file or database) pattern - Student is the expert to perform this operation What about when changing the store (e.g from file to database)

- Problem: Store Student (in memory, file or database) pattern - Student is the expert to perform this operation. But putting this responsibility into the Student class will result in low cohesion, poor reuse Solution -

Pattern A repository represents all objects of a certain type as a conceptual set. Objects of the appropriate type are added and removed, and the machinery behind the REPOSITORY inserts them or deletes them from persistent storage.

Pattern Demo Student repository - ex20 student.py

Decouple the event source(s) from the objects that actually handle the events. is defined as the first object beyond the UI layer that receives and coordinates ( controls ) a system operation. The controller should delegate to other objects the work that needs to be done; it coordinates or controls the activity. It should not do much work itself. encapsulate knowledge about the current state of a use case presentation layer decoupled from problem domain

Task: create controller Demo Student controller - ex21 student.py

Application coordinator Dependency injection - a design pattern in object-oriented computer programming whose purpose is to reduce the coupling between software components. Frequently an object uses (depends on) work produced by another part of the system. With DI, the object does not need to know in advance about how the other part of the system works. Instead, the programmer provides (injects) the relevant system component in advance along with a contract that it will behave in a certain way

Assemble everything v a l i d a t o r = S t u d e n t V a l i d a t o r ( ) #I n j e c t the v a l i d a t o r i n t o the repo repo = InMemory ( v a l i d a t o r ) #I n j e c t r e p o s i t o r y i n t o c o n t r o l l e r c t r l = S t u d e n t C o n t r o l l e r ( repo ) u i = C o n s o l e ( c t r l ) u i. showui ( )