comment-00

จากคำถามใน Quora.com เรื่อง
What is the best comment in source code that you have ever encountered ?
ว่าด้วยเรื่องการ comment ใน source code ที่ดี
มันเป็นคำถามที่ดีมาก ๆ
รวมทั้งคำตอบต่าง ๆ ก็น่าสนใจ
แต่ก็มีบางคำตอบที่ฮา ๆ เยอะเช่นกัน
มาดูกันหน่อยสิ

เริ่มด้วย comment ที่เหมือนจะฮา แต่คิดว่าไม่ฮา !!

code เหล่านี้ต้องไม่เคยผ่านการทำ code review แน่ ๆ
บริษัทที่จ้าง developer คนนี้ไม่น่าจะพอใจนะ

The company pays no bonus - forget about it dude. Don't come! I'm ready to leave!
This project contains huge amount of bugs. You won't stay long! Bye! Best luck!

comment-01

ถ้าเจอ code แบบนี้ไม่น่าจะชอบกันนะ !!

IF TIMEDIFF >=5
  SAY "THE SYSTEM IS FUCKED, PLEASE BEAR WITH US"
  SLEEP(10)
ENDIF

ถ้าเจอแบบนี้จะกล้าแก้ไขไหม ?

//When I wrote this, only God and I understood what I was doing
//Now, God only knows

/* You are not expected to understand this */

//
// 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
//

ถ้าเจอ comment แบบนี้ ก็เอาที่สบายใจกันนะ

if (counts < 0xFF567812 )   // Programmer1 - WTF is this magic number bullshit
                // Programmer2 - I have no fucking clue.  I've been trying to figure it out for years.
                // Programmer1 - We should figure this out and comment it
                // Programmer3 - Did we ever figure this out?
                // Programmer2 - No

หรือเจอ code แบบนี้จะทำการ comment หรือปรับปรุงกันดีนะ ?

comment-06

ขยันกันไปถึงไหนนะ สำหรับการเขียน comment

กลุ่มต่อมาคือสร้างสรรค์มาก ๆ

สงสัยว่า Developer น่าจะมีเวลาว่างกันมาก ๆ
ตัวอย่างที่น่าสนใจมาก ๆ คือ Just Crawl It ของ NIKE

comment-03

ต่อมาคือ พยายามสูงมาก ๆ

comment-04

Geek เท่านั้นถึงจะเข้าใจ

comment-09

ประกาศจ้างงานกันแบบนี้เลย !!

comment-05

อันนี้น่ากลัวมาก ๆ

comment-08

ปิดท้ายด้วย comment นี้ล่ะกัน สาธุ !!

comment-07

วันนี้ Developer ทำการเขียน comment กันอย่างไรบ้าง ?
Developer เป็นคนตลกนะ ว่าไหม ?