Architecture

รีวิวคอร์ส: Testable Architecture Design (skooldio)

รีวิวคอร์ส Testable Architecture Design จาก Skooldio - เรียนรู้การออกแบบระบบที่ทดสอบได้ง่าย รู้จุดที่บั๊กได้ไว (Learn how to design testable and maintainable systems)

ทำไมเขียน test มันยากจัง นี่คือคำถามสมัยแอดพึ่งเขียน test ใหม่ ๆ งมว่าจะเขียนออกมายังไงให้ดี ถ้าเจอคอร์สนี้สมัยทำงานใหม่ ๆ คงไม่เสียเวลางมเอง 55

เห็น skooldio ออกคอร์สมาใหม่เลยกดมาเรียนเลย ไม่ดองแล้ว 😅

💸💸 ราคาคอร์สปกติ 1,990 บาท แต่แอดซื้อมาช่วงเปิดตัวเลยเหลือ 990 บาท

ใครสอน? เหมาะกับใคร? ควรรู้อะไรมาก่อน?

คอร์สนี้ใครสอน?

  • พี่คริสเป็น Technical Lead Innovation Studio Southeast Asia ที่ ThoughtWorks

พี่คริสจะพาเราไปรู้จัก testable architecture ซึ่งไม่ใช่เรื่องใหม่อะไร เชื่อว่าหลายคนคงรู้จัก clean architecture, hexagonal architecture อยู่แล้ว แต่เรารู้ไหมว่า principle ที่อยู่ข้างใน architecture เหล่านี้คืออะไร และถ้าไม่มีของพวกนี้เกิดขึ้นมาก่อน เราจะทำให้ software testable ได้ยังไง? คอร์สนี้มีคำตอบ

โดยทั้งคอร์สจะใช้ตัวอย่างเป็น typescript เขียนแบบ OOP แต่เราสามารถไป apply กับภาษาอื่นได้ เพราะพี่คริสสอนแบบไม่ได้ใช้ syntaxic sugar ของ ภาษา typescript

ถ้าคุณกำลังหา course ที่สอน testing ในมุมของ quality assurance หรือ QA อาจจะไม่ได้ตอบโจทย์ตรงนั้น

ไม่ได้สอน E2E จะเน้นในเรื่องการฝั่ง integration และ unit ที่เกี่ยวข้องกับ developer ซะมากกว่า

คนเรียนควรจะรู้อะไรมาก่อน

  • มีความรู้เรื่องการเขียนโปรแกรม และ OOP มาก่อน
  • พอรู้ว่าจะเขียน test ยังไงได้บ้าง ไม่ได้เริ่มเขียนสอนเขียน test จาก 0
  • จะดีมากถ้าอ่านภาษา js/ts ได้ (optional)

เหมาะกับคนที่ทำงานเขียนโค้ดทุกระดับ junior - senior

  • junior ช่วยให้ เปิดมุมมองการเขียน testable architecture ว่าเขียนไปทำไม เขียนยังไง
  • senior ได้ทบทวนและกลับไป reflect ว่า สิ่งที่เราทำอยู่เป็น testable architecture แล้วหรือยัง + story และวิธีการที่จะเอาไปแชร์ต่อกับคนในทีม

สิ่งที่ได้กลับไป

  • เอา principle ของการออกแบบไปใช้กับ software ที่เราเขียนอยู่ได้
  • ในคอร์สจะไม่ได้เน้นเรื่อง framework แต่เป็นหลักการว่าถ้าไม่มี framework เราจะออกแบบโปรแกรมให้สามารถทดสอบ และรู้ว่าจุดที่พังอยู่ตรงไหนได้ ยังไงก็ตามเราสามารถนำไปประยุกต์กับเครื่องมือที่มี framework ได้เช่นเดียวกัน
  • ขึ้น API ตาม testable architecture ที่แบ่ง well-defined unit ได้
  • ในบางบทเรียนจะมีการบ้านให้ฝึกคิด ลงมือเขียน unit test & integration test จริง ๆ ซึ่งอาจจะใช้เวลาหลายชั่วโมง

บทเรียนมีอะไรบ้าง?

แม้จะเห็นว่าเวลาเรียนทั้งคอร์สจะบอกว่า 4 ชั่วโมง กับอีก 33 นาที ถ้าเรียนจริง เราจะใช้เวลามากกว่านั้นจากการลงมือทำ (การบ้าน) ซึ่งเวลาส่วนนั้นก็ขึ้นอยู่กับแต่ละคน

เนื้อหาที่เรียนจะแบ่งออกเป็น 4 บท

  1. Foundations of Testing and Architecture — 32 mins
    • อธิบายเรื่องนิยาม testable architecture
    • different perspective of testing from Dev and QA
  2. Designing a Testable System (The Poker Hand Case Study) — 1 hr 18 mins = 78
    • breakdown unit & sub-units
    • การบ้านเขียน unit test ให้กับ poker hand : reader, printer, compare hand
  3. Testing Strategies and Implementation — 45 mins
    • test pyramid
    • balance ensuring quality & efficiency
    • answering why startup choose test ice-cream cone over test pyramid
  4. Building the Real-World Poker App — 1 hr 58 mins = 118
    • การ test กับ MVC architecture (Model-View-Controller)
    • concept of test double & dependency injection
    • การบ้าน controller test
    • การบ้าน data layer test (เลือกได้ว่าจะเขียนแบบ database usage หรือ database unit integration)
    • การบ้าน model & data layer test (เลือกได้ว่าจะเขียนแบบ database usage หรือ database unit integration)
    • view layer test + integration
    • unit design guideline
    • bonus: อธิบาย concept Inversion of Control (IoC) Container ว่าทำไมคลาสนี้ถึงไม่ต้องใช้เรื่องนี้

Essence of testable architecture

ทำครบ 3 ข้อนี้ก็ถือว่าเป็น testable architecture แล้ว 😀

  1. Divided system into multiple components
  2. Each components have well-defined specification
  3. Each components can be tested individually

Essence of testable architectureEssence of testable architecture

Key Takeaway

  • แตกปัญหาเป็นส่วนย่อย
  • กลับมามอง domain concept
  • แบ่ง 3rd party ให้มี unit
  • Sizing ไม่เล็ก ไม่ใหญ่ ดูจาก feedback ของตัวเอง และคนในทีม
  • Unit ที่มี clear spec แล้วมาต่อกัน ❤️ นี่คือ testable architecture
  • นึกเรื่อง testable architecture ไม่ออกนึกถึง Metaphor adapter ของ macbook ที่ต้องทดสอบแยกกัน
  • Unit ควร design เพื่อใช้งานต่อได้ในอนาคต สามารถนำมาใช้ซ้ำได้
  • วางแผนกับ QA เพราะว่าเรายังควรมี automated test แต่ต้องวางแผนร่วมกัน เพื่อ balance ensuring Quality และ Efficiency

ถ้าอ่านจบแล้วอยากไปเรียน ก็ไปซื้อกันที่ link ด้านล่าง

Testable Architecture Design Course

Enjoyed this post?

Get the latest bite-sized content delivered to your inbox.

We respect your privacy. Unsubscribe at any time.

Contents