Live data from Hacker News

Code Golf at Google

blog.zmxv.com

21–30 of 38 posts

Re: Code Golf at Google

#21
post #2

> http://go/codegolf How does this work, some sort of TLD magic? (That shouldn't be possible, right?) Is it just routed within Google's internal network?

When you're on a corp device, your DNS search path includes google.com. It's not magic at all, it's over here: http://goto.google.com/

(You're going to see a login page that you can't authenticate to)

Re: Code Golf at Google

#22
post #2

> http://go/codegolf How does this work, some sort of TLD magic? (That shouldn't be possible, right?) Is it just routed within Google's internal network?

It works the same as any other corporate network: either custom DNS resolution on the machine (i.e. /etc/hosts), DNS resolution in the internal network, or DNS resolution on the VPN. Or, more likely, a mix of the 3. To get to go links, you've got to be connected to Google's network (either physically, or through VPN). It's essentially the same as accessing a computer on your LAN with its host name (in which case, the…

Fascinating but totally incorrect analysis. All anyone needs to get to go/ is to put corp.google.com in their resolver search paths. Of course, such people will also need a google.com login to actually be redirected to the destination.

Re: Code Golf at Google

#23

Fun fact: there has been a problem with Googlers calculating hash functions that pass all the test cases for certain questions.

If you think about it the right way, that's what everyone is doing: calculating a hash from the problem statement into stream of symbols with certain constraints.

So the problem here is not calculating hash functions per se, but over-fitting the solution to those test cases.

Re: Code Golf at Google

#24
I'm trying to run the c++ version, but it won't compile because the loop variables in the range for loops do not have declarations.

Re: Code Golf at Google

#27
I watched the wolf of wall street recently. I see some of the solutions to these code golf exercises as similar to the bankers who beat their chests and celebrate their masculinity in selling penny stocks to gullible investors.These code golf exercises seem like the software developer equivalent: "look at how brilliant and superior I am that I can obfusicate code into something no-one understands in only 2 lines".

My concern here is that this Code Golf mentality infects the normal day-to-day coding at Google. Just because an implementation can spawn a few lines it doesn't make it a good implementation. What about clean code, maintainability, automated testing, self documenting code...

I pity the codebase I would have to maintain from one of these code golfers.

Re: Code Golf at Google

#28
post #7

i think the sad pattern I see in a lot of these code golf implementations is the solution score is based on Lines of Code, which we already agree is a POOR representation of either complexity or simplicity. I think it would be far more interesting to measure number of instructions to complete the objective. Though I suspect the folks familiar with assembly would run circles, perhaps you could segment by solution lang…

The reason lines of code is a poor way to score solutions is that you should be counting characters! :-)

My favorite Perl golf challenge is something I got from Boston Perl Mongers many years ago:

You have the numbers 1 to 9 (in order), and in between each number you can insert a plus, a multiply, or nothing. Your program should print all expressions that evaluate to 2002. For instance it should print the solution

    1*23+45*6*7+89
(and one other)

I have a command-line solution in 80 characters, including the `perl ` at the beginning. It works on 5.10 and 5.16. I think there was a better solution back in the 5.8 days, but my notes are unclear.

Re: Code Golf at Google

#29

I watched the wolf of wall street recently. I see some of the solutions to these code golf exercises as similar to the bankers who beat their chests and celebrate their masculinity in selling penny stocks to gullible investors.These code golf exercises seem like the software developer equivalent: "look at how brilliant and superior I am that I can obfusicate code into something no-one understands in only 2 lines". My…

My concern here is

If people write a haiku

They might never stop.

Re: Code Golf at Google

#30

I watched the wolf of wall street recently. I see some of the solutions to these code golf exercises as similar to the bankers who beat their chests and celebrate their masculinity in selling penny stocks to gullible investors.These code golf exercises seem like the software developer equivalent: "look at how brilliant and superior I am that I can obfusicate code into something no-one understands in only 2 lines". My…

Nice how many off-handed insults you've managed to pack into such small space, based on no data at all except extrapolating from your own prejudices. It's almost like some kind of HN comment golf.

A playful programming competition is really not at all comparable to cheating innocent people out of their money. Like, seriously. People are generally able to behave appropriately in situations with different expectations. There's no reason to think that it's not equally applicable to using the appropriate programming style for the project. It's like you're looking at somebody walking on the street in jeans and a T-shirt, and complaining that they're not properly dressed for the opera. And no code gets committed without a code review at Google anyway.

Finally, code golf is rarely about obfuscation; obfuscation just for its own sake isn't compatible with minimizing code length. Once you e.g. know the basic Perl golf tricks, the code can be surprisingly readable since it really just contains the core of the algorithm.

Post reply on HN