Công nghệ phần mềm P11

Chia sẻ: Hoang Nhan | Ngày: | Loại File: PDF | Số trang:32

0
103
lượt xem
47
download

Công nghệ phần mềm P11

Mô tả tài liệu
  Download Vui lòng tải xuống để xem tài liệu đầy đủ
Lưu

Nội dung Text: Công nghệ phần mềm P11

  1. Phaân tích vaø Thieát keá Höôùng ñoái töôïng duøng UML Module 12: Thieát keá Subsystem PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 1
  2. Muïc tieâu: w Tìm hieâu muïc ñích cuûa böôùc thieát keá Subsystem vaø vò trí cuûa coâng ñoaïn naøy trong qui trình w Ñònh nghóa caùc haønh vi ñöôc moâ taû trong interfaces cuûa subsystem döôùi daïng collaboration cuûa caùc class chöa beân trong w Laäp söu lieäu veà caáu truùc beân trong cuûa subsystem w Xaùc ñònh caùc phuï thuoäc caøo caùc phaàn töû beân ngoaøi subsystem PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 2
  3. Vò trí cuûa Thieát keá Subsystem Architectural Analysis Architectural Describe Review the Architecture Describe Architecture Reviewer Architect Design Concurrency Distribution Subsystem Design Use-Case Analysis Review the Use-Case Design Design Designer Design Reviewer Class Design PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 3
  4. Toång quan veà thieát keá Subsystem Design Subsystems and Interfaces Design Subsystems and Interfaces (updated) Subsystem Design Use-Case Realization Use-Case Realization (updated) Design Design Classes Guidelines PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 4
  5. Nhaéc laïi: Subsystems vaø Interfaces w Subsystem laø söï “keát hôïp” giöõa package vaø class w Hieän thöïc hoùa 1 hoaëc nhieàu interfaces ñònh nghóa haønh vi cuûa noù Interface Subsystem Name Interface Realization (Canonical form) Subsystem Subsystem Name PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Interface Döông Anh Ñöùc Realization (Elided form) 5
  6. Subsystem Guidelines w Muïc tieâu § Giaûm thieåu keát noái A § Coù tính cô ñoäng, töông thích plug-and-play § Caùch ly caùc thay ñoåi § Tieán hoùa ñoäc laäp w Nhöõng ñeà nghò B § Ñöøng khaûo saùt chi tieát, chæ interfaces § Chæ phuï thuoäc vaøo interfaces khaùc C Chìa khoùa laø abstraction vaø encapsulation PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 6
  7. Nhaéc laïi: Caùc qui öôùc moâ hình hoùa CourseCatalogSystem ICourseCatalogSystem package class Interfaces start with an “I” CourseCatalogSystem CourseCatalogSystem ICourseCatalogSystem PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 7
  8. Caùc böôùc thieát keá Subsystem w Phaân boá caùc haønh vi cuûa Subsystemcho caùc phaàn töû cuûa noù w Laäp söu lieäu veà caùc phaàn töû cuûa Subsystem w Moâ taû caùc phuï thuoäc cuûa Subsystem w Checkpoints PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 8
  9. Caùc böôùc thieát keá Subsystem w Phaân boá caùc haønh vi cuûa Subsystemcho caùc phaàn töû cuûa noù w Laäp söu lieäu veà caùc phaàn töû cuûa Subsystem w Moâ taû caùc phuï thuoäc cuûa Subsystem w Checkpoints PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 9
  10. Caùc nhieäm vuï cuûa Subsystem w Caùc interface operation xaùc ñònh nhieäm vuï cuûa Subsystem w Interface operations ñöôïc hieän thöïc hoùa bôûi § Internal class operations § Internal subsystem operations ICourseCatalogSystem getCourseOfferings() CourseCatalogSystem subsystem responsibility PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 10
  11. Phaân boá nhieäm vuï cuûa Subsystem w Xaùc ñònh caùc phaân töû thieát keá môùi, hoaëc duøng laïi caùi coù saün, (chaúng haïn, caùc class hay subsystem) w Gaùn traùch nhieäm cuûa subsystem cho caùc phaàn töû cuûa noù w Tích hôïp caùc cô cheá khaû duïng (persistence, distribution, …) w Laäp söu lieäu veà collaboration giöõa caùc phaàn töû thieát keá trong “interface realizations” § Moät hay nhieàu interaction diagrams/interface operation § Class diagram(s) chöùa caùc quan heä caàn thieát w Tham khaûo laïi phaàn thieát keá kieán truùc § Chænh subsystem boundaries vaø caùc phuï thuoäc, neáu caàn PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 11
  12. Qui öôùc: Subsystem Interaction Diagrams Subsystem Client Subsystem Proxy Design Element 1 Design Element 2 performResponsibility( ) Op1() subsystem responsibility Op2() Internal subsystem Op3() interactions Op4() Khoâng hieån thò Subsystem interface PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 12
  13. Ví duï: CourseCatalogSystem Subsystem subsystem interface : RegisterFor : Registration : ICourseCatalog : Schedule : Student : Student CoursesForm Controller System 1: // create schedule( ) 2: // get course offerings( ) Student wishes to create a new 3: getCourseOfferings(Semester) schedule 4: // display course offerings( ) A list of the available subsystem responsibility course offerings for this semester are displayed A blank schedule 5: // display blank schedule( ) Legacy RDBMS Database Access is displayed for the students to select offerings 6: // select 4 primary and 2 alternate offerings( ) 7: // create schedule with offerings( ) 8: // create with offerings( ) 9: // add schedule(Schedule) At this, point the Submit Schedule subflow is executed. PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 13
  14. Tích hôïp cô cheá kieán truùc: Persistency w Baûng aùnh xaï Analysis-Class vôùi caùc cô cheá kieán truùc coù töø phaân tích Use-Case Analysis Class Analysis Mechanism(s) Student Persistency, Security OODBMS Schedule Persistency, Security Persistency CourseOffering Persistency, Legacy Interface RDBMS Course Persistency, Legacy Interface Persistency RegistrationController Distribution OODBMS Persistency ñaõ khaûo saùt trong Use-Case Design PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 14
  15. Nhaéc laïi: Caùc böôùc tích hôïp JDBC w Cung caáp khaû naêng truy suaát ñeán thö vieän caùc class caàn ñeå caøi ñaët JDBC √ § Cung caáp java.sql package w Taïo caùc DBClass caàn thieát § Moät DBClass/moät persistent class § Course Offering persistent class => DBCourseOffering √ - Done (coøn tieáp) PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 15
  16. Nhaéc laïi: Caùc böôùc tích hôïp JDBC (tt.) w Tích hôïp caùc DBClass vaøo thieát keá § Gaùn cho caùc package/layer • DBCourseOffering ñaët vaøo CourseCatalogSystem subsystem § Theâm caùc quan heä vôùi persistency clients • Persistency clients laø CourseCatalogSystem subsystem clients w Taïo/Hieäu chænh caùc interaction diagram moâ taû: § Vieäc khôûi taïo Database § Truy xuaát ñeán Persistent class: Create, Read, Update, Delete PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 16
  17. Ví duï: Local CourseCatalogSystem Subsystem Interaction CourseCatalog : : : Connection : Statement : : : ResultSet : Course Catalog System Client CourseCatalogSystem DBCourseOfferring CourseOfferingListCourseOffering 1. getCourseOfferings(Semester) Retrieve all available course offerings for the current semester Subsystem Proxy 1.1. read(string) 1.1.1. createStatement( ) sql statement is passed in specifying the search criteria -- 1.1.2. executeQuery(String) course offerings in the current semester 1.1.2.1. // executeQuery( ) Create a list to hold all retrieved course offerings 1.1.3. new( ) RDBMS Repeat these operations for each element returned from the Read executeQuery() command. 1.1.4. new( ) The CourseOfferingList is loaded with the data retrieved from the 2. getString( ) database. The getData and setData 3. setData( ) operations are called for each attribute in the each retrieved 4. add(CourseOffering) class instance. Add the retrieved course offering to the list to be returned PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 17
  18. Ví duï: Billing System Subsystem subsystem interface : : : : : Schedule : Student. : : Registrar CloseRegistrationForm CloseRegistrationController ICourseCatalogSystem CourseOffering IBillingSystem 1. // close registration( ) 1.1. // is registration open?( ) Retrieve a list of course offerings for the current 2. // close registration( ) semester Close 2.1. getCourseOfferings(Semester) registration for each course Repeat twice this is If the maximum number of offering for simplicity; selected primary courses have realistically, an 2.2. // close registration( ) not been committed, select indefinite number of alternate course offerings). iterations could occur) 2.3. // level( ) Finally commit or 2.4. // close( ) Currently assuming tuition based on cancel the course offering once all number of offerings taken and certain leveling has occurred attributes of students. If different offerings get different prices this will change slightly. 2.5. getTuition( ) Send student and tuition to the Billing System, which will do the actual billing to the 2.6. submitBill(Student, double) student for the schedule. subsystem responsibility PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 18
  19. Ví duï: Local BillingSystem Subsystem Interaction Subsystem Proxy Billing System : : : Student. : : Billing System Client BillingSystem StudentBillingTransaction BillingSystemInterface 1. submitBill(Student, double) Retrieve the information that must 1.1. create(Student, double) be included on the bill 1.1.1. // get contact info( ) 1.2. submit(StudentBillingTransaction) 1.2.1. // open connection( ) 1.2.2. // process transaction( ) 1.2.3. // close connection( ) PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 19
  20. Caùc böôùc thieát keá Subsystem w Phaân boá caùc haønh vi cuûa Subsystemcho caùc phaàn töû cuûa noù w Laäp söu lieäu veà caùc phaàn töû cuûa Subsystem w Moâ taû caùc phuï thuoäc cuûa Subsystem w Checkpoints PT & TK Höôùng ñoái töôïng – Thieát keá kieán truùc Döông Anh Ñöùc 20
Đồng bộ tài khoản