מהי מחלקה?
מחלקה מייצגת קבוצת עצמים בעלי מבנה והתנהגות משותפים
מהם מאפייני המחלקה?
אספקט דינמי:
פרוטוקול
התנהגות
אספקט סטטי:
מבנה - הצהרה על השדות
מדוע מצב וזהות אינם חלק מאבסטרקציית המחלקה?
מצב וזהות נקבעים בזמן ריצה.
מחלקה כן יכולה לקבוע את המצב של שדות קבועים וניתן להגיד שסינגלטון מאפשר למחלקה לממש זהות
מהם 5 חלקי המחלקה?
Forge: creation requirements
- Signatures of accessible constructors
Mill: creation process
- Constructor bodies
Protocol: communication patterns
- Signatures of accessible fields and methods
Behavior: communication effect
- Method bodies
Structure: underlying means to achieve behavior
- Memory layout and contents of an object
האם בשפות דינמיות (למשל, סקוויק) יש
forge, protocol?
לא. בשפות דינמיות הטיפוס לא ידוע בזמן קומפילציה ולכן אין פרוטוקול כי לא ידוע אילו הודעות האובייקט יודע לקבל.
no forge in squeak because objects are created via new which is just another message.
behavior and mill exist because the implementation is there.
מהם 3 תפקידי המחלקה?
what are the two principles of reflection?
2. every class has an object that represents it