Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linting and RuboCop: Paragraph 'Convention time again' needs a little love #28821

Open
2 of 3 tasks
ruben-vl opened this issue Sep 20, 2024 · 3 comments
Open
2 of 3 tasks

Comments

@ruben-vl
Copy link
Contributor

ruben-vl commented Sep 20, 2024

Checks

Describe your suggestion

There are some issues with the first paragraph under 'Convention time again':

  • "variables are things like do_something(with_thing, another_thing)
    • I think this is wrong and an example of a method
  • "Why there exists a preference for getting rid of if statements"
    • I don't know where this comes from, don't remember it from an earlier lesson, so maybe a reference to some source would be useful
  • Typo in "some languages prefer loops while other+s prefer iterative approaches"
    • Also confusing what is meant exactly with 'iterative approaches'. Is this a reference to enumerables (each, map...)? Because loops are inherently an iterative approach as far as I understand (e.g. compared to recursion).

Path

Ruby / Rails

Lesson Url

https://www.theodinproject.com/lessons/ruby-linting-and-rubocop

(Optional) Discord Name

ruben-vl

(Optional) Additional Comments

Seems like an easy first contribution. Will volunteer after the weekend if no-one else is open to be assigned.

@ruben-vl ruben-vl changed the title Linting and RuboCop: Paragraph 'Convention time again' Linting and RuboCop: Paragraph 'Convention time again' needs a little love Sep 20, 2024
@scheals
Copy link
Contributor

scheals commented Sep 20, 2024

For the first one, it probably is just not-so-fortunate omission:

You have already been exposed to some of the conventions in HTML, CSS, JS and Ruby. This is why JS has its variables written likeThis while Ruby’s are like_this, why functions are verbs and variables are things like do_something(with_thing, another_thing).

"functions are verbs" -> do_something(), "variables are things" -> with_thing ; another_thing

So perhaps something like:

why functions are verbs and variables are things resulting in our function definitions looking like this: do_something(with_thing, another_thing).

should work a lot better. Now thinking about this, I wonder whether "functions" should be changed to "methods" but I think my idea was to bring it as close to what-has-been with JS as possible.

Why there exists a preference for getting rid of if statements
I don't know where this comes from, don't remember it from an earlier lesson, so maybe a reference to some source would be useful

You're right. This might be me coming from a different place. I'm pretty sure that at that point I read enough nasty nested if statements or "smart" ternaries to find them confusing but I did search for a short while and nothing in the curriculum seems to mention that. So the style guide is the first time someone might actually find this as guidance coming from TOP.

There's a spectre of polymorphism hiding behind this statement as well but before Chess, the benefits of polymorphism will probably be unknown to most. They were to me for sure!

Typo in "some languages prefer loops while other+s prefer iterative approaches"
Also confusing what is meant exactly with 'iterative approaches'. Is this a reference to enumerables (each, map...)? Because loops are inherently an iterative approach as far as I understand (e.g. compared to recursion).

Yeah this most likely should say iterative methods or something like that. It is indeed a reference to things like enumerables. Relevant Ruby Style guide bit.

@SumonGFC
Copy link
Contributor

I like these:

  1. "...why function names are verbs and variable names are nouns..."
  2. "...why there is a preference for ternary operators instead of if/else blocks for simple conditional statements..."
  3. "...why some languages prefer loops while others prefer iterators..."

Tangential:
It seems odd that this section of the lesson doesn't formally reference/hyperlink the Ruby Style Guide. if I recall correctly, the style guide is linked earlier in the course, but I don't remember where. Since Rubocop enforces many of the guidelines in the style guide, it would be nice to have a link to it that is within this section (or somewhere around the beginning of the lesson) so that learners can browse through it a bit.

@shirschfield
Copy link

Happy to submit a PR for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants