SlideShare a Scribd company logo
Unified Modeling Language (UML)
Ramón Voces Merayo
Per què diagrames ?
 La representació gràfica facilita molt
l’enteniment del que volem dir i, a més, en
ho permet dir d’una forma unívoca.
 Si ens fixem el nostre món està ple de
diagrames…
Diagrames I: Mapes
Diagrames II: Arquitectura
Diagrames III: Electrònica/Electricitat
Diagrama IV : Bases de dades
Diagrames UML
 És un llenguatge gràfic que serveix per visualitzar,
especificar i documentar cadascuna de les parts
corresponents al desenvolupament i funcionament del
software.
 De la mateixa forma que per construir un edifici podem
tenir diversos diagrames (de construcció, elèctrics,
d’aire condicionat, de calefacció …), en UML també
tenim múltiples diagrames en funció del que volem
representar:
– Diagrames de classes
– Diagrames de seqüència
– Diagrames de casos d’ús
– …
Com es representa una classe ?
Com es representa una interfície ?
La herència
(generalització/especialització)
L’herència en java
public class vehicles{
....
}
public class vehiclesMotor extends
vehicles {
....
}
public class cotxes extendes
vehiclesMotor {
...
}
La implementació (realització)
La implementació en java
public class vehicles implements Engegable{
....
}
Les associacions I
 Representa una relació estructural entre
classes, és a dir, que una classe està
connectada amb una altra.
Les associacions II
 Les associacions poden indicar una
determinada multiplicitat (mateix concepte de
la cardinalitat dels diagrames E-R de Chen)
Les associacions III
 A més, es pot indicar la navegabilitat, és a
dir, de quina forma es pot accedir d’un
objecte a l’altre.
L’associació en java
public class viatge{
cotxe c;
public viatge ( cotxe c )
{
this.c=c;
}
cotxe getCotxe ()
{
return c;
}
}
Associacions especials: agregacions i
composicions
 Normalment una associació normal es fa sobre dues
classes que són conceptualment al mateix nivell (cap
es més important que l’altre).
 En canvi, sovint ens trobem al davant d’associacions
entre classes que representen un “tot”, amb d’altres
que representen “parts” d’aquest “tot”
 Per exemple:
– Empresa – Departament
– Cotxe – Portes
– Biblioteca – Llibre
– …
Composició
 Una composició és una
associació en què el
cicle de vida de la classe
“part” depèn
absolutament del cicle
de vida de la classe “tot”.
Composició en java
public class Cotxe{
xasis x;
public Cotxe ()
{
x = new xasis();
}
…
}
Agregació
 Una agregació és una
associació en què el cicle
de vida de la classe
“part” és independent del
cicle de vida de la classe
“tot” i fins i tot podrien
tenir una relació
d’agregació amb altres
“tots”
Agregació en java
public class Cotxe{
GPS gps; // gps portàtil
…
public setGPS(GPS gps )
{
this.gps = gps;
}
…
}
Dependència
 Representa una relació entre classes en què
s’estableix una relació proveïdor / client, és a
dir, una (la client) utilitza un servei d’una altra
(la proveïdora).
Dependència en java
public class cotxe{
…
public int temperatura(sensor s)
{
return s.getTemperatura();
}
…
}

More Related Content

Recently uploaded

Implica't+ amb la Carta de la Terra i l'Agenda 2030
Implica't+ amb la Carta de la Terra i l'Agenda 2030Implica't+ amb la Carta de la Terra i l'Agenda 2030
Implica't+ amb la Carta de la Terra i l'Agenda 2030
LLuelles Perera Maria del Mar
 
BOLI VIU. JUNY 2024 REVISTA ESCOLAR PAU VILA
BOLI VIU. JUNY 2024 REVISTA ESCOLAR PAU VILABOLI VIU. JUNY 2024 REVISTA ESCOLAR PAU VILA
BOLI VIU. JUNY 2024 REVISTA ESCOLAR PAU VILA
EMMAMUOZMARTINEZ
 
llengua catalana exercicis catala_web.pdf
llengua catalana exercicis catala_web.pdfllengua catalana exercicis catala_web.pdf
llengua catalana exercicis catala_web.pdf
MireiaForcadaSabat
 
INFORME_LLISTA_ESPERA_OME_LLISTA_ESPERA (2).pdf
INFORME_LLISTA_ESPERA_OME_LLISTA_ESPERA (2).pdfINFORME_LLISTA_ESPERA_OME_LLISTA_ESPERA (2).pdf
INFORME_LLISTA_ESPERA_OME_LLISTA_ESPERA (2).pdf
EscolaRoserCapdevila18
 
INFORME ASSIGNADES CURS 24-25. ROSER CAPDEVILA
INFORME ASSIGNADES CURS 24-25. ROSER CAPDEVILAINFORME ASSIGNADES CURS 24-25. ROSER CAPDEVILA
INFORME ASSIGNADES CURS 24-25. ROSER CAPDEVILA
EscolaRoserCapdevila18
 
INFORME_PREINSCRITES_OME_INFORME_PREINSCRITES_OME.pdf
INFORME_PREINSCRITES_OME_INFORME_PREINSCRITES_OME.pdfINFORME_PREINSCRITES_OME_INFORME_PREINSCRITES_OME.pdf
INFORME_PREINSCRITES_OME_INFORME_PREINSCRITES_OME.pdf
Ernest Lluch
 
INFORME_LLISTA_ESPERA_OME_LLISTA_ESPERA.pdf
INFORME_LLISTA_ESPERA_OME_LLISTA_ESPERA.pdfINFORME_LLISTA_ESPERA_OME_LLISTA_ESPERA.pdf
INFORME_LLISTA_ESPERA_OME_LLISTA_ESPERA.pdf
Ernest Lluch
 

Recently uploaded (7)

Implica't+ amb la Carta de la Terra i l'Agenda 2030
Implica't+ amb la Carta de la Terra i l'Agenda 2030Implica't+ amb la Carta de la Terra i l'Agenda 2030
Implica't+ amb la Carta de la Terra i l'Agenda 2030
 
BOLI VIU. JUNY 2024 REVISTA ESCOLAR PAU VILA
BOLI VIU. JUNY 2024 REVISTA ESCOLAR PAU VILABOLI VIU. JUNY 2024 REVISTA ESCOLAR PAU VILA
BOLI VIU. JUNY 2024 REVISTA ESCOLAR PAU VILA
 
llengua catalana exercicis catala_web.pdf
llengua catalana exercicis catala_web.pdfllengua catalana exercicis catala_web.pdf
llengua catalana exercicis catala_web.pdf
 
INFORME_LLISTA_ESPERA_OME_LLISTA_ESPERA (2).pdf
INFORME_LLISTA_ESPERA_OME_LLISTA_ESPERA (2).pdfINFORME_LLISTA_ESPERA_OME_LLISTA_ESPERA (2).pdf
INFORME_LLISTA_ESPERA_OME_LLISTA_ESPERA (2).pdf
 
INFORME ASSIGNADES CURS 24-25. ROSER CAPDEVILA
INFORME ASSIGNADES CURS 24-25. ROSER CAPDEVILAINFORME ASSIGNADES CURS 24-25. ROSER CAPDEVILA
INFORME ASSIGNADES CURS 24-25. ROSER CAPDEVILA
 
INFORME_PREINSCRITES_OME_INFORME_PREINSCRITES_OME.pdf
INFORME_PREINSCRITES_OME_INFORME_PREINSCRITES_OME.pdfINFORME_PREINSCRITES_OME_INFORME_PREINSCRITES_OME.pdf
INFORME_PREINSCRITES_OME_INFORME_PREINSCRITES_OME.pdf
 
INFORME_LLISTA_ESPERA_OME_LLISTA_ESPERA.pdf
INFORME_LLISTA_ESPERA_OME_LLISTA_ESPERA.pdfINFORME_LLISTA_ESPERA_OME_LLISTA_ESPERA.pdf
INFORME_LLISTA_ESPERA_OME_LLISTA_ESPERA.pdf
 

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
Christy Abraham Joy
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
Vit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
MindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Unified modeling language (uml)

  • 1. Unified Modeling Language (UML) Ramón Voces Merayo
  • 2. Per què diagrames ?  La representació gràfica facilita molt l’enteniment del que volem dir i, a més, en ho permet dir d’una forma unívoca.  Si ens fixem el nostre món està ple de diagrames…
  • 6. Diagrama IV : Bases de dades
  • 7. Diagrames UML  És un llenguatge gràfic que serveix per visualitzar, especificar i documentar cadascuna de les parts corresponents al desenvolupament i funcionament del software.  De la mateixa forma que per construir un edifici podem tenir diversos diagrames (de construcció, elèctrics, d’aire condicionat, de calefacció …), en UML també tenim múltiples diagrames en funció del que volem representar: – Diagrames de classes – Diagrames de seqüència – Diagrames de casos d’ús – …
  • 8. Com es representa una classe ?
  • 9. Com es representa una interfície ?
  • 11. L’herència en java public class vehicles{ .... } public class vehiclesMotor extends vehicles { .... } public class cotxes extendes vehiclesMotor { ... }
  • 13. La implementació en java public class vehicles implements Engegable{ .... }
  • 14. Les associacions I  Representa una relació estructural entre classes, és a dir, que una classe està connectada amb una altra.
  • 15. Les associacions II  Les associacions poden indicar una determinada multiplicitat (mateix concepte de la cardinalitat dels diagrames E-R de Chen)
  • 16. Les associacions III  A més, es pot indicar la navegabilitat, és a dir, de quina forma es pot accedir d’un objecte a l’altre.
  • 17. L’associació en java public class viatge{ cotxe c; public viatge ( cotxe c ) { this.c=c; } cotxe getCotxe () { return c; } }
  • 18. Associacions especials: agregacions i composicions  Normalment una associació normal es fa sobre dues classes que són conceptualment al mateix nivell (cap es més important que l’altre).  En canvi, sovint ens trobem al davant d’associacions entre classes que representen un “tot”, amb d’altres que representen “parts” d’aquest “tot”  Per exemple: – Empresa – Departament – Cotxe – Portes – Biblioteca – Llibre – …
  • 19. Composició  Una composició és una associació en què el cicle de vida de la classe “part” depèn absolutament del cicle de vida de la classe “tot”.
  • 20. Composició en java public class Cotxe{ xasis x; public Cotxe () { x = new xasis(); } … }
  • 21. Agregació  Una agregació és una associació en què el cicle de vida de la classe “part” és independent del cicle de vida de la classe “tot” i fins i tot podrien tenir una relació d’agregació amb altres “tots”
  • 22. Agregació en java public class Cotxe{ GPS gps; // gps portàtil … public setGPS(GPS gps ) { this.gps = gps; } … }
  • 23. Dependència  Representa una relació entre classes en què s’estableix una relació proveïdor / client, és a dir, una (la client) utilitza un servei d’una altra (la proveïdora).
  • 24. Dependència en java public class cotxe{ … public int temperatura(sensor s) { return s.getTemperatura(); } … }