01/10/2018, 10:22

Quora: Những comment bá đạo trong code

Vào quora xem có bài này vui vui share cho mọi người cùng đọc
Chuẩn bị lết xác lên công ti/ trường học/… và chào đón một tuần mới không mấy vui vẻ gì
Comment code nên text hơi mờ

#Chủ đề: What are the best comments in a code?
##Nirmal Mevada

// Dear maintainer:
// 
// Once you are done trying to 'optimize' this routine,
// and have realized what a terrible mistake that was,
// please increment the following counter as a warning
// to the next guy:
// 
// total_hours_wasted_here = 42
//
/**
* For the brave souls who get this far: You are the chosen ones,
* the valiant knights of programming who toil away, without rest,
* fixing our most awful code. To you, true saviors, kings of men,
* I say this: never gonna give you up, never gonna let you down,
* never gonna run around and desert you. Never gonna make you cry,
* never gonna say goodbye. Never gonna tell a lie and hurt you.
*/
//When I wrote this, only God and I understood what I was doing
//Now, God only knows
stop(); // Hammertime!
// Autogenerated, do not edit. All changes will be undone.
// sometimes I believe compiler ignores all my comments
// I dedicate all this code, all my work, to my wife, Darlene, who will 
// have to support me and our three children and the dog once it gets 
// released into the public.
#define TRUE FALSE 
//Happy debugging suckers
long long ago; /* in a galaxy far far away */
/////////////////////////////////////// this is a well commented line

// I don't know why I need this, but it stops the people being upside-down
 
x = -x;
// I am not sure if we need this, but too scared to delete. 
// I am not responsible of this code.
// They made me write it, against my will.
last = first; /* Biblical reference */

LOL

//define ProjectManager
//A person who thinks nine women can deliver a baby in ONE month
//you       vs.  the guy she tells you not to worry about
//O(n^2)    -                O(1)
//solution to every error:- sudo rm -rf/
/* Roses are Red
*  Violets are Blue
*  I use Linux
*  What about you?*/
// set break point here - you'll never reach it
// HACK ! COPY/PASTE this and look for another job
//this used to be a comment
//If harambe had been white they would have never killed
/*I can’t divide with zero, so I have to divide with something very similar result = * number / 0.00000000000001.*/
/* If this code works, it was written by Paul DiLascia. If not, I don’t  know who wrote it.
*/
stepOff(); //bitch
//Mr. Compiler, please do not read this.
long time; /* just seems that way */
//uncomment the following line if the program manager changes her mind again this week

In a GIGANTIC 800 line ‘switch’ statement, somewhere in the middle:

// Joe is sorry

A few hundred lines later…

// Harry is sorry too

Not quite a comment but a goto label

ICantBelieveImUsingAGoto:
virgin = 0;     /* you're not a virgin anymore, sweety */
long time; /* know C */

##Shaikh Tahmidur:
Updating…

Kili viết 12:36 ngày 01/10/2018

Rickroll nữa =)))))
đau cả bụng

Dark.Hades viết 12:36 ngày 01/10/2018

Mới đi làm về, không có gì làm nên post part 2:


Shaikh Tahmidur:

/* And now ladies and gentleman, the chord from HELL! */
public boolean isDirty(){
  //why do you always go out and 
  return dirty;
}
// this routine is intentionally poorly documented for security purposes
//Times New Roman? What was wrong wjth the old Romans?

At the top of a particularly convoluted and completely uncommented code

* Congratulation! You are reading the README file of a software package you just
 downloaded!  
 You are now officially an *advanced* software installer . *
// Sorry you have to see this mess.
#define TRUE FALSE
// Happy debugging!
// explanation omitted as an exercise for the reader   
/*
                                                 ,  ,
                                               / \/ \
                                              (/ //_ \_
     .-._                                      \||  .  \
      \  '-._                            _,:__.-"/---\_ \
 ______/___  '.    .--------------------'~-'--.)__( , )\ \
`'--.___  _\  /    |             Here        ,'    \)|\ `\|
     /_.-' _\ \ _:,_          Be Dragons           " ||   (
   .'__ _.' \'-/,`-~`                                |/
       '. ___.> /=,|  Abandon hope all ye who enter  |
        / .-'/_ )  '---------------------------------'
        )'  ( /(/
             \\ "
              '=='
 
This horrible monstrosity takes a medicare monstrosity and mangles it
into a data structure that can easily be used to create a medicare feed.
It's bloated, confusing, and pretty awful by necessity(for the most part).
*/
* // Dirty hardcoded value but decided by the management. 
//guess what we'e using to save the game?
//that's right
//we're using cookies
//yeah I went there
//we storin dis for 5 years, people
//mmh stale cookies
/* I have no idea why this function works, but it does,
 * so it's probably best to leave it alone unless you
 * know how/why it works */
// convert to freedom units because THIS IS AMERICA!

// You cannot understand this

This seemed to keep the idiots off my code:

/**
 * Auto-generated code. Do not modify.
 */
Bài liên quan
0