89 points · by onatm · 12y ago · 73 comments
You should be able to commit all you want all night long, but should not be able to push.
if (nr = 0x56) ...
That took and entire day to find and made me religiously avoid lvalue assigments in expressions by doing: if (0x56 == nr) ...It's also mostly useless because your compiler should warn you about your first construct (and tell you to add a layer of parens if that's what you really want to do).
I realize I'm being a bit irrational with this whole thing but for some reason code like this drives me nuts (that and people not putting space around arithmetical operators and such: int a=2*4+foo(1,2,3)).
"But why don't you use better languages, then?" Because in many cases (low-level resource-constrained systems programming), it's much, much easier to deal with these weird gotchas than to attempt to get exotic [1] languages such as Python, Ruby, Java, and sometimes even C++ (heap? who needs a heap??), to work. Even in cases where you're able to get these languages to work easily, you're just forcing yourself to become intimately familiar with the internals of some language with which you'll ultimately wind up wrestling [2]. Normally the point of such languages is to abstract away the system. This is the exact opposite of what you need in these environments.
"But it annoys me when people use literal lvalues where they don't need to." Ah, but this is the rub of forming a habit.
1: I'm mostly sarcastic in my use of the word "exotic" here. Don't go crazy, now. ;-)
2: Though to totally contradict myself, I will say that both Rust and Go look very, very interesting here.
Anyho, it really depends on what your -W level is set to. It's good practice to use "-Wall"
Also when you're drunk, the warnings result in "ahh who cares" :)
[0] http://www.codinghorror.com/blog/2012/07/new-programming-jar...
When completely sober, i think to much and i overengineer (overthink) stuff... Programming is just slower...
(Think DDD-like programming)
1 beer is enough to get very concentrated... Just don't overdue it (and don't make a habbit of it).
I only do it when i need to get things done, when time is limited... Never had serious bugs (Windows ME like) though :-P
It happens once in the 2 months and mostly it's for 2-3 days in the weekend (non-stop), with some light kind of music (Enya or concentration like mp3's) and headphones.
Yeah, i'm a nerd then :P
Why is this hatred and stereotyping in the comments of a front page Hacker News article?
Is it particularly uncommon for someone that both drinks and is passionate about programming to write code drunk? Someone incorporated an arduino breathalyzer into a source control tool with some jokey features.
What's so stupid or frathouse-ish about that? It's not super-duper strait laced and serious, but neither is life.
Also, I learned that someone's made a breathalyzer attachment for the Arduino (should have been obvious, in retrospect). YMMV, but it was a good use of my 60 seconds.
They can be a little tricky, but I'm sure you'll get the hang of them if you try.
That's why you install this cool thingy that doesn't let you commit when drunk. Sadly, it's not as easy with cars and drunk drivers...
I know, I'll externalize and automate my impulse control! > Don't commit when you're drunk
That's a valid premise for whatever you do in life, not only Git.Trying to run `git psuh` too many times in an hour could get you a cooldown period so you can either sober up or wake up.
And yes, he wasn't directly sober at the time.
I was moderately amused when I got woken up about 3 AM and got to spend a few hours trying to revert the "re-indexing" ...
I think integration with ssh-key management to prevent people logging onto production systems when drunk would be a good idea for this project, don't be surprised if there is a pull request from me in the future ...
Period.