- Feature Articles
- CodeSOD
- Error'd
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Edit Admin
When the only tool you have is a hammer ... everything gets damaged.
Edit Admin
Slightly disappointed. When I saw this
I was expecting that at some time shortly after this person started, the team no longer had any regular jobs that ran in the mornings.
Edit Admin
And that he does not do it consistently!
Edit Admin
I waited 3 minutes to post this
Edit Admin
Y'all are gonna hate me, but I always test boolean variables as "if (okay)" and "if (okay == false)". Sometimes the exclamation point is hard to see, but at least I'm consistent.
Admin
I'll do one better. In TS I convert to boolean by using Boolean(test) not !!test. For the same reason, the double exclamation marks is hard to see and may be confused with a single excalamation mark
Edit Admin
Have you considered a career as a lawyer instead?
Edit Admin
In Python, the exclamation mark is a not and hard_to_see != False
Admin
I am going to hate you, because it can be written clearer as
if okayandif !okay.Edit Admin
My first thought looking at this code was that given there are three boolean variables, and different logic to run based on different combinations of values, it may improve readability in this case to say "if (bool1 = true and bool2 = true and bool3 = false) {} else if (bool1 = false and bool2 = true and bool3 = true). {}..." etc. That way you can see at a glance which specific combination is being treated by each block of code. But then I saw the "if not hub_1_ready and not hub_2_ready and job_ran_later == False:" and can only shake my head and walk away.
Edit Admin
Not in every programming language.