Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. class X:
  2. field x1
  3. field x2
  4. field x3
  5. func get_x1:
  6. return x1
  7.  
  8. f(x1, x2):
  9. - we know that we only need x1, x2
  10. - we can use x1 and x2 directly, we don't care about how we get them
  11. - we don't rely on class X getters
  12.  
  13. f(X):
  14. - we don't know which attributes we need, we can use x3 by mistake
  15. - should get attributes (x1, x2), we will write more code
  16. - if f needs more x3 we can get it easily without modifying the signature
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement