Làm Quen Với Lập Trình Go
Một khóa học giới thiệu thực hành, thân thiện với người mới về ngôn ngữ lập trình Go. Khóa học được cấu trúc thành các bài học nhỏ, dễ tiếp cận với chủ đề khám phá không gian, bao gồm lập trình mệnh lệnh, kiểu dữ liệu, hàm, phương thức, tập hợp, trạng thái và đồng thời hóa.
Tổng quan khóa học
📚 Tóm tắt Nội dung
Một hướng dẫn thực hành thân thiện với người mới bắt đầu về ngôn ngữ lập trình Go. Khóa học được thiết kế thành các bài học nhỏ, dễ tiếp thu với chủ đề khám phá không gian, bao gồm lập trình mệnh lệnh, kiểu dữ liệu, hàm, phương thức, tập hợp dữ liệu, trạng thái và đồng thời hóa.
Khám phá niềm vui lập trình với Go thông qua những bài học nhỏ và bảy dự án tổng kết mang tính vũ trụ.
Tác giả: Nathan Youngman, Roger Peppé
Lời cảm ơn: Jennifer Stout, Marina Michaels, Matthew Merkes, Joel Kotarski, Aleksandar Dragosavljević, Renée French, Olga Shalakhina, Erick Zelaya, April Milne, Monica Kamsvaag.
🎯 Mục tiêu Học tập
- Định nghĩa ngôn ngữ lập trình Go và các trường hợp sử dụng chính của nó.
- Giải thích vai trò của trình biên dịch Go và lợi thế của nó so với các trình thông dịch.
- Điều hướng Go Playground để viết, biên dịch và chạy mã nguồn.
- Cấu trúc đúng mã Go bằng phong cách "một cặp dấu ngoặc duy nhất" bắt buộc để tránh lỗi cú pháp.
- Quản lý dữ liệu bằng nhiều kỹ thuật khai báo biến và toán tử gán số học.
- Tạo số ngẫu nhiên giả và triển khai logic điều kiện bằng nhánh và toán tử logic.
- Khai báo và định dạng biến dấu phẩy động bằng
float32vàfloat64với độ rộng và độ chính xác cụ thể. - Nhận diện và giảm thiểu lỗi do sai sót dấu phẩy động và hiện tượng tràn số nguyên.
- Sử dụng gói
bigvà hằng không có kiểu để xử lý các con số vượt quá giới hạn bit chuẩn. - Định nghĩa và gọi hàm bằng tham số, đối số và cú pháp tham số linh hoạt (variadic).
Bài học 共 8 课时 · 预计 24.0h
Bài học
Lesson
This lesson introduces Go as a high-performance, open-source language designed for cloud-native infrastructure and large-scale software engineering. Students will explore Go's core pillars of simplicity, efficiency, and reliability, and learn how its compiler facilitates error detection and maintainable code for complex distributed systems.
This lesson introduces the fundamentals of imperative programming in Go, focusing on the mandatory main package and func main() entry point. Students will also learn the importance of Go’s "One True Brace Style" and how the compiler's automatic semicolon insertion rules dictate specific syntax requirements.
This lesson explores the limitations of binary floating-point arithmetic in Go, explaining why decimal fractions like 0.1 cannot be represented precisely due to base-2 conversion errors. Students will learn to navigate the trade-offs between float32 and float64, emphasizing the importance of avoiding floating-point types for financial calculations and using appropriate precision for scientific data.
This lesson explores the principles of modularity in Go, focusing on how functions, abstraction, and the DRY (Don't Repeat Yourself) principle improve code maintainability and reduce complexity. Students will learn to define clear module boundaries and interfaces to build robust, scalable software systems.
This lesson introduces arrays in Go as fixed-length, type-specific collections used to manage bulk data efficiently. Students will learn how to use composite literals for initialization, navigate zero-based indices, and understand the importance of memory safety to avoid runtime panics.
This lesson introduces Go structures (structs) as a method for grouping disparate data types into cohesive, atomic units for better organization. Students will learn to define and manipulate these structures to manage complex telemetry data, such as Martian habitat coordinates and rover status, more effectively than with individual variables.
This lesson explores the concept of indirection in Go, focusing on how pointers store memory addresses to manage shared data efficiently. Students will learn to use the address operator (&) and dereference operator (*) to manipulate data, while applying these concepts to build performant, shared-state structures like a Sudoku validator.
This lesson explores concurrency in Go, focusing on using goroutines to manage independent tasks and synchronization tools like mutexes and select statements. Students will learn how to handle non-deterministic execution and implement robust worker patterns for multi-agent systems.