Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Awful coupling, Demeter violation
class A
attr_reader :b
def initialize
@b = B.new
end
end
class B
attr_reader :c
def initialize
@c = C.new
end
end
class C
def name
'Oh God what have I done.'
end
end
a = A.new
a.b.c.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment