Skip to content

Instantly share code, notes, and snippets.

@flazz
Created August 6, 2012 18:57
Show Gist options
  • Select an option

  • Save flazz/3277543 to your computer and use it in GitHub Desktop.

Select an option

Save flazz/3277543 to your computer and use it in GitHub Desktop.
class SomeClass
def initialize a, b, c
@a, @b, @c = a, b, c
end
def some_method
@b.work_with @a.something
@c.do_something @a.something_else
end
end
class SomeClassPrime
def self.make a, b, c
new a.something b, c, a.something_else
end
def initialize x, b, c, y
@x, @b, @c @y = x, b, c, y
end
def some_method
@b.work_with @x
@c.do_something @y
end
end
@flazz
Copy link
Author

flazz commented Aug 6, 2012

in SomeClass it doesn't need @A, it needs some data in @A. In the refactoring SomeClassPrime it uses make as glue, it could have some error checking in it.

SomeClass looks more simpler than SomeClassPrime. but instances of the latter are simpler than the instances of former.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment