Wpis z mikrobloga

Jakby ktoś nie czytał to polecam One Compile Man, fanfic One Punch Man'a.

Genos placed a hand on the back of his neck and rubbed nervously. "I've gone over it a dozen times and tried every means of debugging I can think of. The syntax is perfect. There are no mismatched parentheses or out-of-order operations or anything like that. I've quadruple-checked the algorithm's correctness, too, and yet, I keep getting some kind of weird nondeterministic bug that never shows up quite in the same place twice. It makes no sense. I've run it through GDB and Valgrind multiple times, I've traced the stack, I've done everything I can think of. What am I not seeing?"

Saitama scrolled through the code with a neutral expression, nodding to himself as he noted different functions and their purposes. He reached the end of the file and paused. "Hmmm," he murmured to himself.

"That's just the main function, I can show you the rest-" Genos began, but Saitama cut him off.

"No, I see the problem. It's very subtle. You've done good work, Genos, and the algorithm is fine in theory, but in practice there's a problem with the way the operating system interacts with your code. It'll take too long to explain; I'll just fix it myself." Then Saitama scrolled up, clicked somewhere in the main function, and started typing.

Genos watched, at first with fascination, then dawning horror, then finally aghastment. "Um," he said. "Is that... are you... are you writing frickin' inline assembly?"

"Yeah," said Saitama, sounding bored. "Otherwise you'd have to refactor a lot of this. It's the most efficient solution. Anyway, that should about do it." He finished typing and clicked "Build and Run" before Genos could object. Despite the inline assembly, the compiler ran smoothly and without error. Then the test cases ran, each one passing flawlessly, and also somehow about 10% faster than they used to be.

Genos gaped. "It's never passed all the test cases before! How the hell-" Saitama started swiveling back to his desk, but Genos stopped him. "Wait, Saitama, I need to ask you one more question... seriously, what is your secret? How are you this good at coding, that you can just glance at someone else's C++ for thirty seconds, inject some raw assembly, and fix everything instantly? That you can write a 'generalized exception handler' in one shot and have it fix all your exceptions from then on? No one is that good! How do you do it?"

"If I tell you, will you stop bugging me? I kind of need to keep working on this app for King."

"Absolutely. But, please, tell me your secret!"

"Okay then." Saitama exhaled, then inhaled sharply. "Online code tutorials! Do as many as you can, then do them again! Read 'The C++ Programming Language'! Read the Linux Manual! One chapter of CLRS, every day! Do every exercise! Answer StackOverflow questions! Contribute to open source projects! Sometimes it's hard, even grueling, but you have to fight through it! Never give up! Only then can you become a Strong Coder."

Genos stared, open-mouthed, speechless. "That's...that's...THAT'S JUST ORDINARY CODER STUFF! Everyone here has done that! It's not even that hard once you get used to it! That doesn't explain half of the things you've done! I didn't take this internship to hear jokes, Saitama. Fine, don't tell me." He jerked his laptop away and stormed back to his desk.

"But," whispered Saitama, "that's honestly all I did."


--------------

"Thanks! Um, alright, so," said the intern. "It's just, you're one of the greatest coders in the world, and I've always wanted to work with you, and - sorry, fangirling out right now, sorry, but, ah, I was having this problem where my GUI is glitching - see, there it goes! - and I used the debugger and everything, and I can't find a problem, and I was wondering how someone like you would approach this and if you think you know what I might be doing wrong..."

King held up his hand. In a deep, gravelly voice, full of gravitas, he said, "Try refactoring the GUI compiler in javascript." Then he abruptly turned around, walked back to his office where Saitama was waiting, and closed the door.

The intern stared after him for a moment, contemplating what she had just heard. This was one of those famous King koans, wasn't it? Try refactoring the GUI compiler in javascript. It made no literal sense, of course, but you had to hunt for the deeper meaning. Like all great sages, King made you earn new wisdom. So she thought, and she pondered, and she thought some more; she reframed the problem in ten different ways; and eventually, she was enlightened. "Aha!" she said to herself. "The problem was never in the GUI code itself, but in my underlying thread model! Refactoring in javascript was a metaphor to get me to look past a superficial answer, the way javascript only superficially sounds like java but is actually very different! Wow, King truly is a genius."


--------

"Oh," replied Saitama. "It was probably detected and stopped by my neural network army."

"Yeah. I have an army of neural networks that monitors all my computers at all times. They're pretty smart at this point, I think. Detecting that intrusion would have been easy for them."

"Army of neural networks." Genos couldn't process this, so he repeated it again. "Army of neural networks... army of neural networks... ON WHAT COMPUTING CLUSTER, SAITAMA! ON WHAT COMPUTING CLUSTER!?! BECAUSE I WOULD HAVE NOTICED IF THAT MUCH COMPUTE TIME WAS BEING USED ON OUR SERVERS."


"Yeah, I mean, there are some networks cached on my computer for fast initial detection, but the bulk of the analysis happens on AWS. That's one of the reasons why I wanted the internet back."

"That... must cost you a fortune!"

"Actually, no," said Saitama. "A while back I put a script on AWS that predicts the stock market in real time and does unsupervised high-frequency trading, then re-invests the profits back into AWS. Since then I've never wanted for AWS server time. Anyway, after that I added a script that auto-generates neural networks and trains them, and then I kind of just let it do its thing. Haven't actually checked on it in a while - I wonder what it's been up to? Let's see..."

"Hmmm. Okay. Looks like the networks made a lot of money, then just decided that it was more efficient in the long run to purchase Amazon, so they pressured the board of directors into allowing the acquisition... huh. I guess I own Amazon now. Cool."


#programowanie #heheszki #anime