Created
August 6, 2012 18:57
-
-
Save flazz/3277543 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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 |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.