Created
November 29, 2012 18:28
-
-
Save MarceloCajueiro/4170956 to your computer and use it in GitHub Desktop.
Violação de Demeter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
def do_things(b) | |
b.c.do_things #violação de demeter | |
end | |
end | |
class B | |
attr_reader c | |
end | |
class C | |
def do_things | |
end | |
end | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
def do_things(b, intermediario) | |
intermediario.do_things(b.c) #sem violação | |
end | |
end | |
class Intermediario | |
def do_things(c) | |
c.do_things | |
end | |
end | |
class B | |
attr_writer :c | |
end | |
class C | |
def do_things | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A | |
def do_things(b) | |
b.c_do_things #sem violação | |
end | |
end | |
class B | |
attr_writer :c | |
def c_do_things | |
c.do_things | |
end | |
end | |
class C | |
def do_things | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment