Presentation is loading. Please wait.

Presentation is loading. Please wait.

MODEL REFACTORING Refactorings 1.model refactoring 2.object oriented refactorings Ref1-1.

Similar presentations


Presentation on theme: "MODEL REFACTORING Refactorings 1.model refactoring 2.object oriented refactorings Ref1-1."— Presentation transcript:

1 MODEL REFACTORING Refactorings 1.model refactoring 2.object oriented refactorings Ref1-1

2 H1 – Again Ref1-2

3 My Answer Solution in Java after adding navigability arrows above -- you need to know this info to translate! class Domain { String name; Set starts; Set ends; } class Arrow { String name; Domain startsAt; Domain endsAt; } Ref1-3

4 Mathematics Analogy Ref1-4

5 Big Picture For Today’s Lecture and for this course! Replace a model or model fragment with an equivalent model or model fragment Correct by Construction: if your initial structure is correct, your rewrites are correct, your result is correct Refactorings are or should be equality rewrites a.k.a. behavior preserving Ref1-5 apply identity1 apply identity2

6 Today We Look At Model Refactorings How I grade Start with known correct answer Apply a series of equivalence rewrites of models not numerical expressions To arrive at a semantically equivalent design Ref1-6 apply identity1 apply identity2

7 1 st Interesting Alternative Answer Are these equivalent? Can you refactor the correct bottom into the top diagram What model refactoring or identity do you know that can do this? Ref1-7

8 Remember Normalize? Does this help in answering the question on the previous page? Ref1-8

9 Proof Ref1-9 normalize startsAt normalize endsAt

10 2 nd Interesting Alternative Answer Are these equivalent? Can you refactor the correct bottom into the top diagram What model refactoring or identity might help? not obvious Ref1-10 domain names used

11 “Conflate Associations” Identity Merge two identically “shaped” associations into 1, without losing information Ref1-11 a reference to first this ugly spud

12 Proof Ref1-12 conflate associations

13 3 rd Interesting Alternative Answer Are these equivalent? Can you refactor the correct bottom into the top diagram What model refactoring or identity would help? Ref1-13 domain names used

14 Leverage Last Answer How do we go from: To: Ref1-14 ?

15 Proof Ref1-15 normalize connects

16 4 th Interesting Alternative Answer Are these equivalent? Can you refactor the correct bottom into the top diagram What model refactoring or identity would help? Ref1-16

17 Graphical Refactoring! Not a model refactoring! Does this help? Ref1-17

18 Not Done Yet! How do we go from: To: Ref1-18 ?

19 Proof Ref1-19 graphical equivalence rename

20 Voila! Now you know how I grade… welcome to the land of refactorings… Why is this important to you? you will create your own mental model of how some software works and how it is organized you will likely find the software’s existing design unpleasant to your tastes and understanding you need to translate your mental model to existing model to understand you might eventually refactor the existing model to yours to improve it this is what refactoring is all about Next class – object oriented refactorings! Ref1-20

21 Cultural Enrichment Recall this design (which I build incrementally): Is this description equivalent? Ref1-21

22 What Does This Mean? Recall this design (which I build incrementally): So what does this tell you? see answers in slide comments Ref1-22


Download ppt "MODEL REFACTORING Refactorings 1.model refactoring 2.object oriented refactorings Ref1-1."

Similar presentations


Ads by Google