Closed sheerun closed 11 years ago
:+1:
for me is less readable, but I know what is your point.
I prefer use self to indicate what is tmp variable and what is not. e.g
def balance?
old_balance = ... # some calculations
new_balance = ... # some calculations
self.amount > old_balance
....
end
Omit self
when it is absolutely not needed and when it would make code less readable.
I think @jcieslar's exmaple is a good example when self improves readability (apart of the fact, that I would move old_balance
and new_balance
to separate methods ;))
@sheerun PR
I understand sometimes using self is necessary:
but for reads it usually can be omitted, what makes code more readable.
An example:
vs