Understanding the Odin Programming Language
A downloadable book
Do you want to learn the Odin Programming Language and demystify low-level programming?
Understanding the Odin Programming Language is a book that teaches both basic and advanced concepts. You'll learn about procedures, manual memory management, parametric polymorphism, data-oriented design, and much more.
A programming language is a tool. By understanding your tools, you will become a better craftsperson. Therefore, on top of how to write Odin code, this book also provides explanations of why things work the way they do.
The target audience is anyone with some programming experience. Odin is a simple yet powerful language, making it a great introduction to low-level programming, regardless of your programming background.
Chapters (click to expand)
- Introduction
- Hellope! A tiny program
- Variables and constants
- Some additional basics
- Making new types
- Pointers
- Procedures and scopes
- Fixed-memory containers
- Introduction to manual memory management
- More container types
- Strings
- Implicit context
- Making manual memory management easier
- Parametric polymorphism: Writing generic code
- Bit-related types
- Error handling
- Package system and code organization
- You don't need a build system
- Reflection and Run-Time Type Information (RTTI)
- Data-oriented design
- Making C library bindings (Foreign Function Interface)
- Debuggers
- Odin features you should avoid
- A tour of the core collection
- Libraries for creating video games
- Things I did not cover
- Where to find more Odin resources
- Thanks for reading!
- Appendix A: Handle-based array
- Appendix B: Using only fixed arrays
- Appendix C: gui_dropdown from CAT & ONION
- Appendix D: Box2D and raylib
- About the author
Formats (you get both!):
- HTML: A pretty and portable HTML file, specially suited for computers.
- eBook / EPUB: Specially suited for e-readers and eBook apps.
The book's website: https://odinbook.com/
Discuss the book on my Discord server: https://discord.gg/4FsHgtBmFK
Updated | 6 days ago |
Published | 17 days ago |
Status | Released |
Category | Book |
Rating | Rated 5.0 out of 5 stars (11 total ratings) |
Author | Karl Zylinski |
Genre | Educational |
Tags | book, odin, odinlang, programming |
Links | Homepage |
Purchase
In order to download this book you must purchase it at or above the minimum price of $19.99 USD. You will get access to the following files:
Download demo
Development log
- Version 1.46 days ago
- Version 1.3 and Amazon release10 days ago
- Version 1.2: New section on address sanitizer and lots of small fixes!13 days ago
- Thanks and small update16 days ago
Comments
Log in with itch.io to leave a comment.
Although Odin is rather a simple programming language, there are elements that one could find not so obvious and straightforward. This book helps to dispel misunderstandings and incorrect assumptions about Odin's inner behavior. And, honestly, it's neat to have such condensed source of information on hand, considering modest popularity of the language and lack of literature besides official overview and occasional articles.
That said, I have several nitpicks:
1) I think that not freeing memory in the end of a program is not generally a good advice, since, I believe, there are some OSes that do not free memory once a program is terminated.
2) In chapter 13.2
should be
since you'd get
otherwise.
3) In chapter 18.4
should probably be
4) In chapter 12.4
there is no need to close handle, because
looks like
and calling
may lead to the
error.
Thanks a lot for the kind words and for buying the book!
Thank you for the list of issues. I have fixed 2, 3 and 4.
Regarding 1: There is no modern OS that leaks after shutdown. While there are some really old OSes where this could happen, Odin doesn’t support any of those OSes anyways. However, a good reason to do the deallocation at the end is to keep third-party memory analysis programs, such as Valgrind, happy. I have added a note about that in the book (update coming later today or tomorrow).
After many years coding in C and C++ I decided to switch to Odin. I've watched a couple of your videos on YouTube and decided to buy a book. Enjoying it so far. Thank you very much!
Its definitely better to buy this book to learn Odin than trying to search for brief pieces of information on this language on the internet.
Thoroughly enjoying the book so far! Very approachable and informative.
Hey Karl, the book is fantastic, I have learned so much about this language even in the space of a few days. One observation I wanted to ask, in section 10.2.5 you illustrate an application for maps by building a set, and say that Odin doesn't have any special support for sets, but I thought bit sets were exactly that?
https://odin-lang.org/docs/overview/#bit-sets
It even supports "overloading" of operators so you can do unions and such. Is there a fundamental difference here? Thanks again for such a great book!
EDIT: D'oh, my bad, your set example using a map allows sets of arbitrary type whereas bitsets are more limited. Never mind!
Thank you! It’s great that you inform me about this confusion, because I should really make sure to stress the difference between them. After all, they both contain the word “set”. I’ll add fixing this to my TODO list.
The updated version (https://zylinski.itch.io/odinbook/devlog/848116/version-12-new-section-on-address-sanitizer-and-lots-of-small-fixes ) has fixed this.
Read three pages and zero cats. Disappointed.Well-written, easy to read and even to understand (sometimes). I like it a lot.
Thanks 😻
As far as I’ve read, the book is great , well structured and well written. It’s a must have for all the Odin programmers, ans perhaps for all the programmers who want to discover the great coding language that Odin Is.
Thank you! Happy that you like it
I've just barely started it and I'm already loving it! Everything is organized clearly and beautifully, explanations are easy to follow with nice illustrations that help a lot!
Thank you 💖
Such a well-written and beautifully-designed book on Odin! Thank you for your hard work!
Thanks for the kind words!