COMP2007-Unified modelling language Flashcards
UML Diagrams
Class diagrams
- describe classes & their relationships
Inreraction diagrams
- show behaviour of sys in terms of how objects interact
State and activity diagrams
- show how systems behave internally
Component and deployment diagrams
- show how sys components are arranged logically & physically
UML
Standard graphical language for modelling oo sw
Not a methodology, assists in dev
UML Class diagrams
Classes
- represent the types of data themselves
Associations
- linkages btwn instances of classes
Attributes
- simple data found in classes & their instances
Operations
- represent the functions performed by classes & instances
Generalisations
- group classes into inheritance hierarchies
UML Code
------------ | Student | public class ------------ Student | + name | { | + ID | public int ======== name; Public int ID; }
Design process affects
Development rime
Software quality
Ease of maintenance
UML models help during different stages and with different purposes
Sys analysis model
- during analysis ph to learn bout domain
Sys arch model
- high level abstract classes representing sys arch and interfaces
Detailed des model
- refine analysis model till material in form that can be implemented by programmers
Dinding classes + developing class diagrams
Identify classes
Add associations and attributes
Find generalisations
List main responsibilities of each class
Decide on specific operations
Iterate till model ok
Identifying generalisations & interfaces
Find generalisations
- bottom up-group similar to create super class
-top down- look for more general classes 1st, specialise them if needed
Create an interface io super class If Classes dissimilar except few common operations 1 or more already have own superclass Diff implementations of same class might b available
Coupling & cohesion
Coupling
Coupling - number of dependencies between two systems
Loosely coupled systems -> independent; modification to one has little effect on another
Low coupling is good; reduce impact of changes
Coupling & cohesion
Cohesion
Cohesion refers to dependencies within a module’s internal elements
High cohesion means that the module is focused in purpose, understandable, manageable
Low coupling good
High cohesion good
Coupling
Measure of how strongly classes interact
A has an attribute of B
A inherits from B
A calls on the service of a B object
A has a method which references B
Disadvantages of high coupling
Change in one class ripples to others
Difficult to understand class in isolation
Difficult to reuse class because dependabt class must also be used
Cohesion
Measure of how strongly related and focused the responsibilities of single classes are
It is decreased when; Responsibilities (operations) of a class have little in common
Operations do many varied activities, often using varied data.
Disadvantages of weak cohesion
Difficult to understand
Difficult to maintain as constantly affected by changes
Difficult to reuse as most applications wont need a random set of operations attached to a class