Timeline for Naming conventions for set/unset method parameter
Current License: CC BY-SA 4.0
Post Revisions
13 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 10, 2020 at 21:02 | comment | added | Luke Griffiths |
@Gulzar the reason locked is better than lock is because the former is an adjective and the latter is a verb or noun. In English adjectives are used to represent state, such as "this door is locked" or "this engine is running". However if OP actually wants to "indicate the action" then an argument named action, whose value can be 'lock' or 'unlock', would be appropriate. As it is, the boolean isLocked describes the target state of the action, not the action itself.
|
|
| Jul 7, 2020 at 7:14 | comment | added | AjayGohil | isLocked is the naming convention for boolean methods and variables used by Sun for the Java core packages. Using the is prefix solves a common problem of choosing bad boolean names like status or flag.t fit, and the programmer is forced to chose more meaningful names. | |
| Jul 6, 2020 at 15:18 | comment | added | user949300 | @Gulzar "lock" would be fine. Just don't like the leading "is" cause that implies the current, existing state. | |
| Jul 6, 2020 at 10:02 | comment | added | Gulzar |
@user949300 forget the is. why do you think locked is better than lock?
|
|
| Jul 5, 2020 at 19:24 | comment | added | user949300 | I font the "is" prefix confusing. Would just use "locked" or, possible, "newLockState" | |
| Jul 5, 2020 at 18:57 | answer | added | Pedro Rodrigues | timeline score: 0 | |
| Jul 5, 2020 at 17:39 | vote | accept | Gulzar | ||
| Jul 5, 2020 at 17:05 | comment | added | Christophe | While the ultimate choice of the name is opinion-based, there are objective arguments for guiding the choice between the two alternatives, and well known objective principles that could support the decision-making (i.e. "intention-revealing naming" promoted by clean code). This seems IMHO sufficient to consider the question as being in scope. | |
| Jul 5, 2020 at 14:01 | history | edited | Christophe | CC BY-SA 4.0 |
added 125 characters in body
|
| Jul 5, 2020 at 13:10 | history | edited | Christophe |
edited tags
|
|
| Jul 5, 2020 at 11:44 | answer | added | Christophe | timeline score: 2 | |
| Jul 5, 2020 at 11:12 | review | Close votes | |||
| Jul 22, 2020 at 3:04 | |||||
| Jul 5, 2020 at 10:49 | history | asked | Gulzar | CC BY-SA 4.0 |