1כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
להנדסה תוכנה מערכות תיכוןאישי פרוייקט ופיתוח
Software Design
2כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
1פרק
הקדמה
3כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
הקורס של מקומו
System Analysisניתוח מערכות • Software Design תיכון תוכנה • Programmingתכנות •
4כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
הקורס של מקומו
Our course
Jonah’s course
5כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
?) טוב ) תיכון מהו
אפיון המערכת על בסיס הדרישות•התמודדות יעילה עם דרישות משתנות•ארגון מסגרת ומבנה לקידוד•
6כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Open Close Principle (OCP)
מענה לתת ניתן פיה שעל האסטרטגיהמשתנות לדרישות
"תוכנה צריכה להיות פתוחה להרחבה וסגורה לשינויים"
Bernard Meyer
- ניתן יהיה להוסיף התנהגות חדשה למערכתפתוחה להרחבה :
. בלי לגעת בקוד שכבר כתבתסגורה לשינויים :
('אפילו לא לעשות קומפילציה מחדש וכד)
7כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
( " (1חיזוק"זה טובתיכון
מפרדי חכם יותר להיות
8כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
( " (2חיזוק"תמיד מעודכן להיות עליך
9כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
( " (3חיזוק"ברצינות עצמך את לקחת עליך
10כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
נושאים רשימת• Open Closed Principle
• Principles of Class Design– Liskov Substitution Principle (LSP)
– Dependency Inversion Principle (DIP)
– Interface Segregation Principle (ISP)
• Principles of Package Design– Acyclic Dependency Principle (ADP)
• Case Study with Design Patterns
• Model Driven Development – Real Time Object Oriented Design
– Executable Models (Rhapsody)
• Small Project Development– Extreme Programming, Test-first Programming, Refactoring, 7 Habits
11כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
פרוייקט בנייתRhapsodyבזיקה ל-
12כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
פרוייקט מרכיבי
•Component•Object Model Diagram•Packages
13כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
פרוייקט
Component
Executable
Name
Scope
14כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
פרוייקט Component
Configurations
Current configuration
15כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Initial Instanceאתחול מופעים -
פרוייקט Component
Configurations
16כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Settings
Instrumentation
Environment
פרוייקט Component
Configurations
17כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Unified Modeling Language
UML Rhapsodyבזיקה ל-
כלי תיאור המאפשר לתאר וללוות פיתוח של תוכנה לשלביה(ואף כלי למימוש תוכנית)
18כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Object Model Diagram (OMD)
ייצוג ויזואלי סטטי של אובייקטים/מחלקות ויחסים בניהם
19כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
OMD
ב- Packageייצוג UML
20כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
OMD
UML ב- Classייצוג
21כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
OMDClass
UML ב- Classייצוג חלקי ה-
Name
Attributes
Operation
22כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
OMDClass
קשרים בין אובייקטים Object Relationships
• Association– Directed– Bi-Directional
• Aggregation– Directed– Bi-Directional
• Composition– Directed– Bi-Directional
23כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Telephone
Dialer:Dialer1
OMDClass
קשרים בין אובייקטים Object Relationships
• Dependency
• Inheritance
• Composite
• Multiplicity
24כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
OMDClass קשרים בין מחלקות
Inheritance ירושה -
+deviceId : OMString
+detect():void-isButtonStateON():bool+Button(OMString aDeviceId)
Button
<<Abstract>>
+buttonState : tButtonState
-isButtonStateON():bool+ButtonImplementation(OMString aDeviceId)
ButtonImplementation
Inheritance :source file
25כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
OMDClass קשרים בין מחלקות
Associations - Directional
Association Role Name
Multiplicity
Directed :source files
26כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
OMDClass קשרים בין מחלקות
Associations - Bi-Directional
Button Dialer
itsDialer
1itsButton1
Bi-Directional :source files
27כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Button Dialer
itsDialer
1
OMDClass קשרים בין מחלקות
Aggregation
Directed or Bi-Directional
Button Dialer
itsDialer
1
itsButton
1
28כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Button Dialer
itsDialer
1
OMDClass קשרים בין מחלקות
Composition
Directional
Telephone Dialer
itsTelephone itsDialer
1 1
Bi-Directional
29כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
OMDClass קשרים בין מחלקות
Composite
Telephone
itsDialer:Dialer1
Composite -Directed: source files
Composite : Bi-Directional
30כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Multiplicityריבוי
31כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Containersמיכלים/
•Container מיכל הוא מושג מופשט של / אחסון וניהול ריבוי אלמנטים.
32כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Relations Rhapsodyטבלה המציגה כיצד
Containerמממש
Multiplicity Property Container Type Implementation
0..1 or 1 scalar Pointer
m..n, n or * Unordered OMCollection
n Static Array Array Array of Pointers
m..n, n or * ordered Ordered OMList
Qualifier Qualified OMMap
33כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Container
OMCollection
34כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Container
OMList
35כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Container
OMMap
36כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
לפרק 1נספח
Rhapsodyדוגמאות מימוש לפי
37כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
)Attribute(הגדרת מאפיינים המחלקה דרך
38כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
)Attribute(הגדרת מאפיינים המאפיינים דרך
39כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
)Operations(הגדרת פעולות המחלקה דרך
40כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
)Operations(הגדרת פעולות הפעולה דרך
41כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Button Dialer
itsDialer
1itsButton1
Bi-Directional Association/Aggregation :source files
// file Button.h#ifndef Button_H #define Button_H Dialer;class Button } public : Button(); ~Button(); Dialer* getItsDialer() const; void setItsDialer(Dialer* p_Dialer(); void __setItsDialer(Dialer* p_Dialer); void _setItsDialer(Dialer* p_Dialer); void _clearItsDialer();protected : void cleanUpRelations(); Dialer* itsDialer;{;#endif
// file Button.cpp#include Button.h#include Dialer.hButton::Button() { itsDialer = NULL; //#[ operation Button() setItsDialer(new Dialer); //#]}Button::~Button() { cleanUpRelations();}Dialer* Button::getItsDialer() const { return itsDialer;}void Button::setItsDialer(Dialer* p_Dialer) { if(p_Dialer != NULL) { p_Dialer->_setItsButton(this); } _setItsDialer(p_Dialer);} //etc….
42כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Directed Association/Aggregation :source files
Button Dialer
itsDialer
1
// file Button.h#ifndef Button_H #define Button_H class Dialer;class Button } public : Button(); ~Button(); Dialer* getItsDialer() const; void setItsDialer(Dialer* p_Dialer();protected : void cleanUpRelations(); Dialer* itsDialer;{;#endif
// file Button.cpp#include Button.h#include Dialer.hButton::Button() { itsDialer = NULL;}Button::~Button() { cleanUpRelations();}Dialer* Button::getItsDialer() const { return itsDialer;}void Button::setItsDialer(Dialer* p_Dialer) { itsDialer = p_Dialer;}
void Button::cleanUpRelations() { if(itsDialer != NULL) { itsDialer = NULL; }}
43כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Composite Or Composition (directed): Source Files DialerTelephone
11
itsDialeritsTelephone
Telephone
itsDialer:Dialer1
// Telephone.h #ifndef Telephone_H #define Telephone_H #include "Dialer.h"class Telephone {public : Telephone(); ~Telephone();public : Dialer* getItsDialer() const;protected : Dialer itsDialer;};#endif
// Telephone.cpp #include "Telephone.h"Telephone::Telephone() {}Telephone::~Telephone() {}Dialer* Telephone::getItsDialer() const { return (Dialer*) &itsDialer;}
// Dialer.h #ifndef Dialer_H #define Dialer_Hclass Dialer {public : Dialer(); ~Dialer();};#endif
// Dialer.cpp#include "Dialer.h"// Dialer.cpp Dialer::Dialer() {}Dialer::~Dialer() {}
44כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
Telephone Dialer
itsTelephone itsDialer
1 1Telephone
itsDialer:Dialer1
Composite Or Composition (bi-directional): Source Files
// Telephone.h, //Telephone.cpp Bi-directionalכמו ב-
// Dialer.h #ifndef Dialer_H #define Dialer_Hclass Telephoneclass Dialer {public : Dialer(); ~Dialer(); Telephone * getItsTelephone() const; void setItsTelephone (Telephone * p_Telephone);protected :Telephone * itsTelephone;};#endif
// Dialer.cpp #include "Dialer.h"Dialer::Dialer() {}Dialer::~Dialer() {}void Dialer::setItsTelephone(Telephone * p_Telephone) {void Dialer::_setItsTelephone(Telephone* p_Telephone) { __setItsTelephone(p_Telephone);}
45כל הזכויות שמורות תיכון תוכנה ד"ר ר' גלנט / י' לויאןJCT אביב תשס"ה
+deviceId : OMString
+detect():void-isButtonStateON():bool+Button(OMString aDeviceId)
Button
<<Abstract>>
+buttonState : tButtonState
-isButtonStateON():bool+ButtonImplementation(OMString aDeviceId)
ButtonImplementation
Inheritance : source file
//file Button.h#ifndef Button_H #define Button_H #include "Inheritance.h"class Button {public : Button(const OMString& aDeviceId); Button(); virtual ~Button(); void detect();private : virtual bool isButtonStateON()=0;
public : OMString getDeviceId() const; void setDeviceId(OMString p_deviceId);protected : OMString deviceId; };#endif //file Button.cpp---------------------#include Button.hButton::Button(const OMString& aDeviceId) : deviceId(aDeviceId) {}
//file ButtonImplementation.h#ifndef ButtonImplementation_H #define ButtonImplementation_H
#include "Inheritance.h"#include "Button.h"
class ButtonImplementation : public Button} public :
ButtonImplementation(const OMString& aDeviceId);
// etc ...;{
#endif
//file ButtonImplementation.cpp---------------------
#include ButtonImplementation.hButtonImplementation::ButtonImplementation(con
st OMString& aDeviceId) : Button(aDeviceId) }{//etc...