UML : Dependency relationship

UMLผมไม่ได้ Update Blog มาเดือนกว่าละ เพราะตอนนี้อยู่ในช่วงของเปิดเทอม หลายๆอย่างเลยยังอีรุงตุงนัง อยู่มากพอสมควร มาวันนีก็เอาเลยละกันครับ ช่วงหนึ่งเดือนที่ผ่านมามีหลายอย่างที่ต้องเริ่มศึกษาใหม่ หนึ่งในนั้นก็คือ UML (Unified Modeling Language) เพราะว่าต้องเอาไอ้เจ้า UML นี้มาออกแบบระบบนั่นเอง ซึ่งตัวผมเองนั้นไม่เคยแตะมันมาก่อนเลยก็ว่าได้ ใกล้เคียงสุดที่ก็น่าจะเป็นวิชา System Analysis ตอนเรียนสมัยปี 2 โน้น มาเริ่มกันเลยดีกว่า

สิ่งสำคัญที่สุดอย่างหนึ่งใน UML ก็คือเรื่อง Relation ระหว่าง Class … อ่ะแน่นอนว่า ถ้าพูดถึงเรื่อง Class ก็คงจะหนีไม่พ้นเรื่องแนวคิด แบบ OOP (จาวาลอย..ขึ้นมาทันที) ชั่งมันเอาไว้ก่อน กลับมาที่ UML ครับ วันนี้ผมคงเริ่มที่ Relation ที่เรียกว่า "Dependency"

Dependency is a relationship in which one element, the client, uses or depends on another element, the supplier. You can use dependency relationships in class diagrams, component diagrams, deployment diagrams, and use-case diagrams to indicate that a change to the supplier might require a change to the client. — IBM

Dependency ก็คือการที่มี element ใดไปอาศัยขอใช้งานร่วมงานร่วมกับ element อื่น เมื่อ element ที่เราไปเกาะเค้าอยู่มีการเปลี่ยนแปลงอะไรบางอย่าง เราก็จะถูกเปลี่ยนตามนั่นเอง

ตัวอย่างภาพประกอบพร้อมสัญลักษณ์

ตัวอย่าง

"A Cart class depends on a Product class " เพราะว่า Cart class นั้นมีความจำเป็นที่จะต้องนำ Product class เอามาใช้งานภายใน class ของตัวเอง พูดง่ายๆ ถ้าไม่มี Product Class ไอ้เจ้า Cart Class ก็ไม่มีความหมายอะไร

จะเห็นได้ว่าหาก Product มีการเปลี่ยนแปลงใดๆ Cart ก็จำเป็นต้องเอาสิ่งที่มีการเปลี่ยนแปลงนั้น..ใช้ตามไปด้วย

Reference : IBM

Related Posts

This entry was posted in UML and tagged . Bookmark the permalink.

One Response to UML : Dependency relationship

  1. Pingback: UML : Association relationship | STORY of AODDY.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">