وبلاگ بلیان

Programming in Go: Creating Applications for the 21st Century (Developer's Library)

معرفی کتاب «Programming in Go: Creating Applications for the 21st Century (Developer's Library)» نوشتهٔ Mark Summerfield، منتشرشده توسط نشر Addison-Wesley Professional در سال 2012. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.

**Your Hands-On Guide to Go, the Revolutionary New Language Designed for Concurrency, Multicore Hardware, and Programmer Convenience** Today’s most exciting new programming language, Go, is designed from the ground up to help you easily leverage all the power of today’s multicore hardware. With this guide, pioneering Go programmer Mark Summerfield shows how to write code that takes full advantage of Go’s breakthrough features and idioms. Both a tutorial and a language reference, **__Programming in Go__** brings together all the knowledge you need to evaluate Go, think in Go, and write high-performance software with Go. Summerfield presents multiple idiom comparisons showing exactly how Go improves upon older languages, calling special attention to Go’s key innovations. Along the way, he explains everything from the absolute basics through Go’s lock-free channel-based concurrency and its flexible and unusual duck-typing type-safe approach to object-orientation. Throughout, Summerfield’s approach is thoroughly practical. Each chapter offers multiple live code examples designed to encourage experimentation and help you quickly develop mastery. Wherever possible, complete programs and packages are presented to provide realistic use cases, as well as exercises. Coverage includes * Quickly getting and installing Go, and building and running Go programs * Exploring Go’s syntax, features, and extensive standard library * Programming Boolean values, expressions, and numeric types * Creating, comparing, indexing, slicing, and formatting strings * Understanding Go’s highly efficient built-in collection types: slices and maps * Using Go as a procedural programming language * Discovering Go’s unusual and flexible approach to object orientation * Mastering Go’s unique, simple, and natural approach to fine-grained concurrency * Reading and writing binary, text, JSON, and XML files * Importing and using standard library packages, custom packages, and third-party packages * Creating, documenting, unit testing, and benchmarking custom packages Contents 10 Tables 16 Introduction 18 Why Go? 18 The Structure of the Book 21 Acknowledgments 22 Chapter 1. An Overview in Five Examples 24 1.1. Getting Going 24 1.2. Editing, Compiling, and Running 26 1.3. Hello Who? 31 1.4. Big Digits—Two-Dimensional Slices 33 1.5. Stack—Custom Types with Methods 38 1.6. Americanise—Files, Maps, and Closures 46 1.7. Polar to Cartesian—Concurrency 57 1.8. Exercise 65 Chapter 2. Booleans and Numbers 68 2.1. Preliminaries 68 2.1.1. Constants and Variables 70 2.2. Boolean Values and Expressions 73 2.3. Numeric Types 74 2.3.1. Integer Types 76 2.3.2. Floating-Point Types 81 2.4. Example: Statistics 89 2.4.1. Implementing Simple Statistics Functions 90 2.4.2. Implementing a Basic HTTP Server 92 2.5. Exercises 95 Chapter 3. Strings 98 3.1. Literals, Operators, and Escapes 100 3.2. Comparing Strings 103 3.3. Characters and Strings 104 3.4. Indexing and Slicing Strings 107 3.5. String Formatting with the Fmt Package 110 3.5.1. Formatting Booleans 114 3.5.2. Formatting Integers 115 3.5.3. Formatting Characters 116 3.5.4. Formatting Floating-Point Numbers 117 3.5.5. Formatting Strings and Slices 118 3.5.6. Formatting for Debugging 120 3.6. Other String-Related Packages 123 3.6.1. The Strings Package 124 3.6.2. The Strconv Package 130 3.6.3. The Utf8 Package 134 3.6.4. The Unicode Package 135 3.6.5. The Regexp Package 137 3.7. Example: M3u2pls 147 3.8. Exercises 152 Chapter 4. Collection Types 156 4.1. Values, Pointers, and Reference Types 157 4.2. Arrays and Slices 165 4.2.1. Indexing and Slicing Slices 170 4.2.2. Iterating Slices 171 4.2.3. Modifying Slices 173 4.2.4. Sorting and Searching Slices 177 4.3. Maps 181 4.3.1. Creating and Populating Maps 183 4.3.2. Map Lookups 185 4.3.3. Modifying Maps 186 4.3.4. Key-Ordered Map Iteration 187 4.3.5. Map Inversion 187 4.4. Examples 188 4.4.1. Example: Guess Separator 188 4.4.2. Example: Word Frequencies 191 4.5. Exercises 197 Chapter 5. Procedural Programming 202 5.1. Statement Basics 203 5.1.1. Type Conversions 207 5.1.2. Type Assertions 208 5.2. Branching 209 5.2.1. If Statements 209 5.2.2. Switch Statements 212 5.3. Looping with For Statements 220 5.4. Communication and Concurrency Statements 222 5.4.1. Select Statements 226 5.5. Defer, Panic, and Recover 229 5.5.1. Panic and Recover 230 5.6. Custom Functions 236 5.6.1. Function Arguments 237 5.6.2. The init() and main() Functions 241 5.6.3. Closures 242 5.6.4. Recursive Functions 244 5.6.5. Choosing Functions at Runtime 247 5.6.6. Generic Functions 249 5.6.7. Higher Order Functions 255 5.7. Example: Indent Sort 261 5.8. Exercises 267 Chapter 6. Object-Oriented Programming 270 6.1. Key Concepts 271 6.2. Custom Types 273 6.2.1. Adding Methods 275 6.2.2. Validated Types 280 6.3. Interfaces 282 6.3.1. Interface Embedding 287 6.4. Structs 292 6.4.1. Struct Aggregation and Embedding 292 6.5. Examples 299 6.5.1. Example: FuzzyBool—A Single-Valued Custom Type 299 6.5.2. Example: Shapes—A Family of Custom Types 306 6.5.3. Example: Ordered Map—A Generic Collection Type 319 6.6. Exercises 328 Chapter 7. Concurrent Programming 332 7.1. Key Concepts 334 7.2. Examples 339 7.2.1. Example: Filter 339 7.2.2. Example: Concurrent Grep 343 7.2.3. Example: Thread-Safe Map 351 7.2.4. Example: Apache Report 358 7.2.5. Example: Find Duplicates 366 7.3. Exercises 374 Chapter 8. File Handling 378 8.1. Custom Data Files 379 8.1.1. Handling JSON Files 382 8.1.2. Handling XML Files 388 8.1.3. Handling Plain Text Files 394 8.1.4. Handling Go Binary Files 402 8.1.5. Handling Custom Binary Files 404 8.2. Archive Files 414 8.2.1. Creating Zip Archives 414 8.2.2. Creating Optionally Compressed Tarballs 416 8.2.3. Unpacking Zip Archives 418 8.2.4. Unpacking Optionally Compressed Tarballs 420 8.3. Exercises 422 Chapter 9. Packages 424 9.1. Custom Packages 425 9.1.1. Creating Custom Packages 425 9.1.2. Importing Packages 433 9.2. Third-Party Packages 434 9.3. A Brief Survey of Go’s Commands 435 9.4. A Brief Survey of the Go Standard Library 436 9.4.1. Archive and Compression Packages 436 9.4.2. Bytes and String-Related Packages 436 9.4.3. Collection Packages 438 9.4.4. File, Operating System, and Related Packages 440 9.4.5. Graphics-Related Packages 442 9.4.6. Mathematics Packages 442 9.4.7. Miscellaneous Packages 442 9.4.8. Networking Packages 444 9.4.9. The Refiect Package 444 9.5. Exercises 448 Appendix A. Epilogue 452 Appendix B. The Dangers of Software Patents 454 Appendix C. Selected Bibliography 458 Index 460 A 461 B 462 C 463 D 466 E 466 F 468 G 471 H 472 I 472 J 474 K 475 L 475 M 476 N 478 O 479 P 480 Q 481 R 481 S 484 T 488 U 489 V 490 W 491 X 491 Y 492 Z 492 Programming in Go" provides a complete introduction to the Go programming language. Go is the most exciting new mainstream language to appear for at least fifteen years and is the first language aimed squarely at twenty-first century multicore computers---and their programmers. The book covers all of Go's clean and easy to understand syntax and its built-in arrays, maps, slices, and Unicode strings. The book explains Go's unusual and flexible approach to object-orientation that favors efficiency and lighting fast build times, as well as showing how to use Go's goroutines and channels for concurrent programming without the burdens of bookkeeping and memory management that other languages impose. "Programming in Go" will get you started with Go---and provide a valuable reference once you get going.
دانلود کتاب Programming in Go: Creating Applications for the 21st Century (Developer's Library)