Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
"You should name a variable using the same care with which you name a first-born child.” — Robert C. Martin
-
@Anchor sorry mate, trade secrets.
No well writing an enum for a schedule type. We have start of month and middle of month.
And then we also have monthly and one-off payments. So the name schedule type was already taken by this. -
@zlice true that. There's only one other guy working on this with me and both of us have a good mutual understanding of the coding standards and so far, we have been able to keep them to a good enough level. Lucky about that!
-
Ditto. What I usually run into is spend hours/days to name a class/enum/etc, think "Ahhh...perfect", then in a code review (within a few minutes) "Why did you name the class Foo? Would make make more sense if you called it Bar?"
Thought bubble over my head: "YEEEESSSS! Where were you 3 days ago!!!"
What comes out the pie hole: "Oh, yea, that might make it easier to understand. Let me work that into the next change set. Thanks" -
-
@A4Abhiraj The first or mid month enum looks like a StartDayOfMonth unsigned byte or a startTime datetime to me. And monthly or one-off looks like PaymentIntervalMonthly and PaymentIntervalPrepaid to me. But i also might have completely misinterpreted what you are trying to implement...
-
aadilp12842yI love it when there's a long discussion in a pull request about the naming of a class/enum. Epic way to kill time and still be doing actual work.
-
JsonBoa30142yI once had a coworker that named his methods and variables, I kid you not, after the fucking Jira ticket that required their creation.
And that is why we had a fuckload of "fix_pd39851" and similarly stupid sounding terms in our codebase. -
hjk10156962y@A4Abhiraj either they should be tied to a different namespace (package/class) so you can have a nice consistent name in different context; or you can add the context to the name (less preferable as it implies usage info although that can be fine for now) PaymentSchedule and XSchedule.
Also try to avoid over generic words like type unless you need to differentiate (like both XType and XValue). If you have a clash with setting the schedule and these schedule options I would say call them ScheduleOption but not ScheduleType.
Hope this makes sense and helps you in the process. -
The 3 hardest things in computer science are
1) naming variables, functions, etc.
2) off-by-one errors -
voodoo145602yI've found that many times is easy if the problem at the domain level is clearly defined. After that many questions are answered automatically. And that's because the code is solving a problem of the domain, then it's not just variable names but domain terms.
-
When I can't come up with a name for a variable/function, I just name it "temp" or something like it, then use the variable and continue with the code... Most of the time, a good name will pop in my head while using it contextually.
Related Rants
-
vergil32Who, after switching to Linux, started naming their files and folders without spaces?
-
fsociety0013In all honesty, if there was a course on giving variables good, informative and not completely stupid names......
-
Cas97Just finished writing a script with all the classes and variables named after the characters from Sherlock Hol...
Why is naming stuff so difficult? 🤬😡
Spent the last hour thinking of an appropriate name for an enum
rant
developer problems
naming