Screen Shot 2558-04-26 at 12.34.31 PM
ในหนังสือเกี่ยวกับ programming และในโลกของ internet
เห็นว่ามี quote ต่างๆ ที่น่าสนใจมากมาย
เลยลองเอาสิ่งที่ชอบเป็นการส่วนตัวมารวบรวมไว้ดีกว่า
มาดูว่ามีอะไรกันบ้าง
จะเน้นในเรื่องของ Software development กันไปเลย

จากหนังสือ Working Effectively with Legacy Code

ผู้เขียนคือ Michael Features
โดยในหนังสือเล่มนี้มี quote ที่น่าสนใจมากมายดังนี้

“Legacy code is code without tests”

Legacy code คือ code ที่ไม่มีชุดของ test นั่นเอง
คุณล่ะเป็นคนสร้าง Legacy code ที่มีแต่คนไม่ต้องการขึ้นมาหรือเปลาส

“Programming is the art of doing one thing at a time”

การ programming คือการทำเพียงสิ่งเดียวในขณะหนึ่งๆ
คุณล่ะทำงานพร้อมกันหลายอย่างในเวลาเดียวกันอยู๋หรือเปล่า

“Remember, code is your house, and you have to live in it.”

พึงระลึกไว้ว่า
code ที่คุณสร้างขึ้นมานั้นเปรียบเสมือนบ้านของคุณ
และคุณต้องพักอาศัยอยู่ในนั้น
ดังนั้น คุณทำให้มันดี ทำให้มันสะ ทำให้มันน่าอยู่กันหรือเปล่านะ

“Tests that take too long to run end up not being run.”

ชุดของ test ที่มันใช้เวลาการทำงานนานๆ
สุดท้ายก็จะไม่มีการใช้งานในที่สุด
ลองกลับไปมองสิว่า test ของคุณมันทำงานช้าหรือเร็วอย่างไร ?
เรื่อง feedback loop ล้วนๆ นะครับ

“The fact remains: Good design is testable, and design that isn’t testable is bad.”

ระบบที่ออกแบบที่ดี คือ ระบบที่สามารถทดสอบได้ง่าย
ดังนั้นระบบที่คุณออกแบบมากันนั้น
สามารถทดสอบได้ไหมนะ ?

จากหนังสือ Clean Code

ผู้เขียนคือ Robert C. Martin

“It is not enough for code to work.”

code ที่มันทำงานได้ยังคงไม่พอนะ
มันต้องอ่านง่าย เข้าใจง่าย และ ดูแลรักษาง่ายด้วย

“Truth can only be found in one place: the code.”

code คือ สิ่งที่เดียวที่พูดความจริง เกี่ยวกับระบบที่คุณสร้างขึ้นมา

“A long descriptive name is better than a long descriptive comment. Use”

การตั้งชื่อยาวๆ เพื่ออธิบายความหมาย
มันย่อมดีกว่า comment ที่ยาวๆ นะครับ

“When you see commented-out code, delete it!”

เมื่อคุณเห็นว่า code มัน comment ไว้
ก็ให้ลบมันทิ้งไปซะ
จะเก็บไว้ทำซากอะไร

“You should be able to run all the unit tests with just one command.”

Unit test ของระบบควร run ด้วยเพียงคำสั่งเดียวเท่านั้นนะ

“Duplication may be the root of all evil in software. Many principles and practices have been created for the purpose of controlling or eliminating it.”

Duplication หรือ ความซ้ำซ้อน
มันคือจุดเริ่มต้นแห่งความเจ็บปวดในโลกการพัฒนา software
ดังนั้นจึงเกิด principle และ practice ต่างๆ ขึ้นมา
มีเป้าหมายเพื่อควบคุม และ ลบสิ่งที่ซ้ำซ้อนทิ้งไป
หรือให้น้อยที่สุดเท่าที่จะทำได้

มาดู Quote ต่างๆ ใน internet หน่อยสิ

“It’s hard enough to find an error in your code when you’re looking for it; it’s even harder when you’ve assumed your code is error-free”
— Steve McConnell –

เป็น quote ที่ผมชอบมากๆ
ถ้าหา error ใน code มันยาก
แสดงว่า มันก็ยากที่คุณจะบอกได้ว่า code ของคุณไม่มี bug นะ

Brooks Law: “Adding manpower to a late software project makes it later!”

เป็นกฎสุด classic แต่ในวงการพัฒนา software มักจะทำตรงข้ามเสมอ !!
นั่นก็คือ
เพิ่มคนเข้าไปใน project ที่มันล่าช้าอยู๋แล้ว
มันก็ไม่ได้ทำให้อะไรดีขึ้น !!

The best way to get a project done faster is to start sooner
–Jim Highsmith

ทางที่ดีที่สุดสำหรับการพัฒนา project ให้เสร็จเร็วกว่า ก็คือ
เริ่มต้นลงมือทำให้เร็วกว่า

Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
–Martin Fowler

ใครๆ ก็เขียน code ให้ computer เข้าใจได้
แต่ programmer ที่ดีนั้น ต้องเขียน code เพื่อให้คนเข้าใจนะ

“Rules of Optimization:
Rule 1: Don’t do it.
Rule 2 (for experts only): Don’t do it yet. ”
— Michael A. Jackson

กฎสำหรับการ Optimization ง่ายๆ เลยก็คือ
1. อย่าทำ
2. อย่าเพิ่งทำตอนนี้
ซึ่งจะมีความหมายเดียวกับ

Premature optimization is the root of all evil in programming.
–C.A.R. Hoare

Before software can be reusable it first has to be usable.
–Ralph Johnson

ก่อนที่จะคิดถึงการ reuse ให้ระบบมันใช้งานได้ดี มีประโยชน์ก่อนไหม

A good way to stay flexible is to write less code.
–Pragmatic Programmer

เขาบอกไว้ว่า
แนวทางสำหรับการสร้าง software ให้มันยืดหยุ่นก็คือ
การเขียน code ให้น้อยๆ เข้าไว้

ขอปิดท้ายด้วย Quote จากคุณ Linus Torvalds คือ Programming is Fun !!

ซึ่งผมคิดว่ามันคือ สิ่งที่ควรเป็นไป
ถ้าไม่สนุกแล้วจะทำไปทำไม
เสียเวลาเปล่าๆ หรือไม่ ?

Screen Shot 2558-04-26 at 12.28.22 PM

แล้วคุณล่ะมี quote แจ่มๆ และ น่าสนใจมาแบ่งปันกันบ้างไหมครับ !!

Tags: