เขียนโปรแกรมไม่ใช่ "เฉพาะ geeks" จริงๆ ก็ไม่เคย แต่คนเยอะขึ้นมาหัดโค้ด (ใส่หลักสูตรมัธยม) อยากเป็น programmer กลมกลืน -> ต้องเรียนหลายภาษา และใช้ได้
โชคดีมี 5 คำถามถามตัวเองตอนเริ่มเรียนภาษาใหม่ บทความนี้ตอบและให้ลูกธนูใหม่
1. ฉันจะ Define Data ในโปรแกรมยังไง?
คำตอบทุกข้อสำคัญ แต่ define data เป็นคำถามแรก ไม่มี data -> โปรแกรมไร้ประโยชน์
เคล็ดลับ: ดู "core" ของภาษา Java, Dart, Rust หลายตัว build on C -> curly braces, semicolons, type definitions
เข้าใจภาษาหนึ่ง -> ข้อมูลบางส่วน crossover ได้ อยากรู้ว่า strongly typed ไหม -> เข้าใจ types ที่มีและการ define
2. ฉันจะ Store Data และจัดการมันยังไง?
ก่อนหน้านี้: คำสั่งเก็บข้อมูลอธิบายแต่ละกลุ่มยังไง? หลายภาษา: "arrays" และ "hash tables" Python: "lists" และ "dictionaries" (ชัดเจนกว่า)
รู้ nomenclature -> สร้าง arrays/hash tables ได้ หลายภาษา: square brackets = arrays, curly braces = hash tables
Python list:
my_list = ['item1', 'item2', 'item3']
Python dict:
my_dict = {'first': 'item1', 'second': 'item2', 'third': 'item3'}
JavaScript, Swift และอื่นๆ crossover เกือบหมด
3. ฉันจะ Loop Code และใส่ Logic ยังไง?
Define + Store ได้ -> อยากให้รันจนเสร็จงาน (เช่น random number generator, custom field checker วน hash table username/password)
2 loops ต้องเรียน:
- For loops: มี end ชัดเจน (iterator จบ range) ใช้วน arrays/storage
- While loops: ไม่มี end อาจ loop ตลอด/แตกโปรแกรม ใช้ run game ได้ แต่ไม่ค่อยเหมาะ churn numeric data
ขณะเรียน loops -> พิจารณา "If statements" เขียนยังไง Logic สำคัญ แต่ติดตาม format ภาษาแม่
4. ฉันจะสร้าง "Suites" ของโค้ดยังไง?
จนที่นี่: define/store/loop/logic ได้ -> เขียน scripts เล็ก run command line ได้ แต่ functions และ classes จัดระเบียบโค้ด + reusable snippets
Elements นี้ inconsistent ระหว่างภาษา JavaScript explicit:
function myFunction(p1, p2) { return p1 * p2; }
Python ใช้ def:
def my_function(p1, p2): return p1 * p2
OOP (Object-Oriented Programming) ต้องเข้าใจถ้าใช้ในภาษาหลัก แต่ไม่ได้ translate ทุกครั้ง -> หาผู้เชี่ยวชาญ
5. ถ้าติด จะหาช่วยเหลือที่ไหน?
ตอนนี้เขียนโปรแกรม simple ได้ในภาษาที่ต้องการ "grok" อาจ research aspects บางอย่าง แต่ยังไมรู้ช่วยเหลือที่ดีที่สุดอยู่ไหน
Programmer หลายคนไป Stack Overflow: network デカい user หลากหลาย แต่ notorious: ไม่ friendly กับ beginner/"inarticulate" programmers -> หา forum ที่ welcome dumb questions
ทรัพยากรยอดเยี่ยม: Learn X In Y Minutes cheat sheets ทุกภาษา print ได้ -> ดีตอนเรียนภาษาใหม่
สรุป
การศึกษาหลักสูตรใส่ coding -> skill คุ้มค่า "Multilingual" programmer -> core skills ดีขึ้น + โอกาสงานดีขึ้น
อยากเรียนภาษาโปรแกรมฟรี -> อ่านโพสต์เก่าของเรา ลองเรียนภาษาอื่นไหม? ผลยังไง? แชร์ในคอมเมนต์!