註釋,今晚我不關心程式碼,我只想你
阿新 • • 發佈:2021-03-02
## 一
世上本沒有註釋,垃圾程式碼寫多了,也便有了註釋。
註釋彷彿是依賴於程式碼存在的。
你會要求程式碼乾淨,整潔,優雅,雖然你自己都做不到這三點。
但是從來沒聽過你要求註釋要押韻,要是七言絕句,要形散而神不散。
編譯器,都會把註釋忽略掉。
甚至有人說好的程式碼即是註釋,你看,其實連人都不需要註釋。
即便面試吹逼,你也不會說自己喜歡寫註釋。
怎麼了,是註釋不配嗎?
你明明忘了,剛開始學程式碼時,你能看懂的只有註釋啊!
我職業生涯最大的挑戰,不是看不懂程式碼,而且看不懂註釋。
尤其註釋只有六個字:“別動,後果自負”。
在單個函式超過一千行屎山程式碼和一天開發兩天上線的傻X需求之前,能拯救我的只有註釋。
沒有註釋,我只能罵娘。
但我不會罵娘,因為我會要求自己乾淨,整齊,優雅。
所以,即便是註釋,我也要認真寫,用中英日德法語寫,重構著寫,甚至用設計模式寫。
而今天,和大家分享一些有趣的註釋。
## 二
> 也可參考 https://github.com/Blankj/awesome-comment
```java
/***
* .::::.
* .::::::::.
* ::::::::::: FUCK YOU
* ..:::::::::::'
* '::::::::::::'
* .::::::::::
* '::::::::::::::..
* ..::::::::::::.
* ``::::::::::::::::
* ::::``:::::::::' .:::.
* ::::' ':::::' .::::::::.
* .::::' :::: .:::::::'::::.
* .:::' ::::: .:::::::::' ':::::.
* .::' :::::.:::::::::' ':::::.
* .::' ::::::::::::::' ``::::.
* ...::: ::::::::::::' ``::.
* ```` ':. ':::::::::' ::::..
* '.:::::' ':'````..
*/
```
```java
/***
* http://www.freebuf.com/
* _.._ ,------------.
* ,' `. ( We want you! )
* / __) __` \ `-,----------'
* ( (`-`(-') ) _.-'
* /) \ = / (
* /' |--' . \
* ( ,---| `-.)__`
* )( `-.,--' _`-.
* '/,' ( Uu",
* (_ , `/,-' )
* `.__, : `-'/ /`--'
* | `--' |
* ` `-._ /
* \ (
* /\ . \. freebuf
* / |` \ ,-\
* / \| .) / \
* ( ,'|\ ,' :
* | \,`.`--"/ }
* `,' \ |,' /
* / "-._ `-/ |
* "-. "-.,'| ;
* / _/["---'""]
* : / |"- '
* ' | /
* ` |
*/
```
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948223-27.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948236-26.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948247-25.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948261-23.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948255-24.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948265-22.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948294-18.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948286-19.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948272-21.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948304-16.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948312-15.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948332-14.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948337-13.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948342-12.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948364-8.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948281-20.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948296-17.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948353-10.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948347-11.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948368-7.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948357-9.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948371-6.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948374-5.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948380-1.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948399-4.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948405-28.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948401-3.png)
![](https://gitee.com/hanqier/picture/raw/master/2021-3-2/1614650948377-2.png)
## 三
熱衷於寫註釋的我,終於也快要放棄了。。。
![](https://gitee.com/hanqier/picture/raw/master/2021-3-1/1614605369233-image.png)
> 今晚我不關心註釋,只關心你是否關注我
>
> 一個戲精碼農的公眾號
> ![特立獨行的分享](https://gitee.com/hanqier/picture/raw/master/2021-2-25/1614223169855-image.png)