Hacker News new | ask | show | jobs
by minimaxir 3448 days ago
I do wonder what the parallel equivalent of headline clickbait in code is. Functions with very few LOC? :P
4 comments

    /* You won't believe the one weird trick this function uses to compute inverse square root */
>I do wonder what the parallel equivalent of headline clickbait in code is.

A common example would be business logic code polluting the "View" of MVC.

code reviewer: "Why are you retrieving the sales tax jurisdiction from the database and computing sales tax in the gui form?"

programmer: "Well, the form has the TOTAL amount displayed to the customer so it made sense to me to put that db-dependent code there."

code reviewer: "No, that's what the "Model" code is for. That's the "M" in "MVC".

programmer: "Oh, the model source code is where I update the GUI progress bar because that's where the state variable that keeps track rows processed is stored. "

This one from Torvalds is close to clickbait, at least it made me want to find and read copy_page_range().

"Fork is rather simple, once you get the hang of it, but the memory management can be a bitch. See 'mm/memory.c': 'copy_page_range()'"

https://github.com/torvalds/linux/blob/master/kernel/fork.c#...

I'd say functions and methods with overly generic names, like "process" or "prepare". You won't believe what happens inside!