hotsh / rstat.us

Simple microblogging network based on the ostatus protocol.
http://rstat.us/
Other
722 stars 215 forks source link

Cleanup #715

Closed carols10cents closed 11 years ago

carols10cents commented 11 years ago

These are the commits from @gavinlaking's pull request having to do with generic cleanup. Gavin, I kept you as the author of these commits even though I made some modifications-- I'd love if you had some time to look this over to make sure I captured your intent accurately :heart: :heart: :heart:

carols10cents commented 11 years ago

I personally find trailing conditionals to be less than clear... but I'm on the fence about the ternary operator.

@wilkie, how would you feel about:

def display_name
  if name.present?
    name
  else
    username
  end
end
wilkie commented 11 years ago

Isn't that the original code? :P

You don't like trailing conditionals? Is that a common opinion?

I don't mind the longhand form... the ternary ops are just short for the sake of being short. What do you think is more readable? I want an opinion of why. Readability is what we should promote.

steveklabnik commented 11 years ago

You don't like trailing conditionals? Is that a common opinion?

It's a minority opinion, but it's a large-ish minority.

Rubyists almost never use ?: unless it's very short. I'm fine in this case, but I wouldn't prefer it over if/else either.

carols10cents commented 11 years ago

Haha yes that's the original code. @gavinlaking proposed the change, I'm fine with the original ;)

I personally find trailing conditionals to be like giving instructions and THEN saying "oh but you dont have to do any of this in your case"-- you've just wasted the reader's time and brainpower. it feels like the wrong order to me. That impacts readability in my mind. But I'm willing to be the overruled minority :)

wilkie commented 11 years ago

I agree with you: I don't mind the original either. I find it tremendously easier to read. I don't mind the trailing conditionals because I've grown to look for them. But I like them less. I write verbose code, and I don't feel there is anything wrong with that. :)

carols10cents commented 11 years ago

Rereview time!!!