Are variable names like relative pronouns ants?

Asked 2 years ago, Updated 2 years ago, 428 views

You want to create a variable name that means a labored job.
jobs_worker_already_worked_for

It's a variable name with a noun modified by a relative pronoun called jobs(which) the worker already worked for. Isn't variable name like a relative pronoun very common?
(Maybe it's strange if it's not exactly a completed form now=>jobs(which)theworkerhasalready worked for)

If you want to have a rather complicated meaning, you may have to use a relative pronoun to express the nuance, but is it difficult to understand?

ruby-on-rails english

2022-09-30 22:03

1 Answers

There is no such thing as "this is it."Also, there is no official Ruby coding convention.For your reference, it would be better to refer to the link on the page.
In other languages, Python convention (PEP8) recommends that variable names be word-separated as needed for readability.

Also, as a subjective answer to a question, I don't think it's appropriate to make it look like a relative pronoun.Since it is only a pronoun, the interpretation is left to the reader of the code.In such cases, it would be appropriate to use it as a description of the variable.
In the case of "Worker Worked Work" above, you can shorten it to tasks_already_done_by_the_worker or tasks_completed_by_worker, or use jobs and tasks as objects to connect to _completed> with pool values.


2022-09-30 22:03

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.