Skip to content

Instantly share code, notes, and snippets.

@mrkplt
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrkplt/7fb65807e60e9ce8aec2 to your computer and use it in GitHub Desktop.
Save mrkplt/7fb65807e60e9ce8aec2 to your computer and use it in GitHub Desktop.
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