มาทำความเข้าใจแนวคิดของ C++ และ Go ก่อนเรียนรู้ความแตกต่างระหว่างกัน
Go
เป็นภาษาโปรแกรมมิ่งโอเพนซอร์สที่พัฒนาโดยพนักงาน Google มีเจตนาเป็นภาษาที่คอมไพล์รวดเร็ว มีการเก็บขยะ (garbage collected) แบบ strongly typed และรองรับการเขียนโปรแกรมแบบ concurrent โดยตรง
นักพัฒนาเดิม Rob Pike, Robert Griesemer และ Ken Thompson เริ่มต้นในปี 2007 ได้รับอนุญาตภายใต้ BSD license ในระบบขนาดใหญ่รองรับ static typing และ scalability
คุณสมบัติ
- Language Design
- Powerful standard library
- Package Management
- Static Typing
- Testing Support
- C-inspired syntax
- Compiled
- Safe and open source
ข้อดี
- Security friendly
- Supported by Google
- Ease to use
- Excellent documentation
- Do more with less
ข้อเสีย
- Development takes more effort
- Young language
- Less versatile
- Takes more time for building large ecosystem
- Consumes more computational resources
C++
ทำหน้าที่เป็นโครงสร้างพื้นฐานของโปรแกรมมากมาย งานคำนวณ และภาษาโปรแกรมมิ่งอื่นๆ เป็นภาษา procedural, functional และ multi-paradigm เปิดตัวปี 1985 โดยโปรแกรมเมอร์ชาวเดนमार्क Bjarne Stroustrup เป็นภาษา object-oriented และ general-purpose อนุญาต multiple inheritance
คุณสมบัติ
- Speed
- Popular and simple to use
- Object oriented programming
- Platform independence
- Case sensitive
- Compiler based
- High level programming language
- Dynamic memory allocation
- Existence of Libraries
ข้อดี
- Multi-paradigm
- Compatibility with C
- Portability
- Object oriented
- Memory management
- Low level manipulation
- Scalability
- Large community support
ข้อเสีย
- Security issues
- Use of pointers
- Absence of Built-in threads
- Absence of Garbage collector
ความแตกต่างหลัก
| Go | C++ |
|---|---|
| ภาษาโอเพนซอร์สพัฒนาโดยพนักงาน Google | ภาษา object-oriented general-purpose |
| นักพัฒนาเดิมเริ่มต้นปี 2007 | เปิดตัวปี 1985 โดย Bjarne Stroustrup |
| ไม่รองรับ multiple inheritance | รองรับ multiple inheritance |
| คอมไพเลอร์ไม่มี optimization | มี SIMD optimizations ระหว่างคอมไพล์ |
| ไม่รองรับ class-based declarations | รองรับ classes |
| BSD license | Open source project 2.0 |
| Static และ strong typing | Static typing |
| ไม่มี polymorphism | มี polymorphism |
| มี logical operators | ใช้ true, false, bool |
| ไม่มี template libraries | มี Standard Template Library |
| ไม่รองรับ implicit type conversion | รองรับ implicit type conversion |
| ไม่รองรับ const/volatile qualifiers | รองรับ const และ volatile qualifiers |
| ไม่รองรับ inheritance | รองรับ inheritance |
| ไม่ใช้ while/do-while ใช้ for แทน | มี while และ do-while |