code_junkie

Worst Abstraction Inversion

Nov 12th, 2011
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. var selectedTextBox = (TextBox)sender,
  2. if (IsAdmin)
  3. {
  4. selectedTextBox.Enabled = true;
  5. selectedTextBox.Text = superSecretPassword;
  6. }
  7. else
  8. {
  9. selectedTextBox.Clear();
  10. }
  11.  
  12. Cast<TextBox>(sender).
  13. WithIf(IsAdmin,
  14. With(selectedTextBox => selectedTextBox.Enabled = true).
  15. With(selectedTextBox => selectedTextBox.Text = superSecretPassword),
  16. With(selectedTextBox => selectedTextBox.Clear());
  17.  
  18. interface foo {
  19. int bar();
  20. }
  21.  
  22. class myClass1 implements foo {
  23. // No member variables.
  24.  
  25. int bar() {
  26. // Implementation
  27. }
  28.  
  29. // No other methods.
  30. }
  31.  
  32. class myClass2 implements foo {
  33. // No member variables.
  34.  
  35. int bar() {
  36. // Implementation
  37. }
  38.  
  39. // No other methods.
  40. }
Add Comment
Please, Sign In to add comment