DEV Community

Cover image for Low-Level Programming with Odin Lang - Perfect for Beginners
Patrick O'Dacre
Patrick O'Dacre

Posted on

Low-Level Programming with Odin Lang - Perfect for Beginners

If you've ever been interested in lower-level programming, but have been a bit intimidated by the complexity of Rust or C++, then I highly encourage you to give Odin a try.

From the website ::

Odin is a general-purpose programming language with distinct typing built for high performance, modern systems and data-oriented programming.

Odin is the C alternative for the Joy of Programming.

Why an alternative to C?

Several languages have put themselves forward as an alternative to C -- Rust, Zig, Nim.

But why?

As great as C is, some would argue that it has some rough edges that don't fit as well as they could with modern systems.

I'll leave that to you to decide.

But I will say that as a newer language designed with modern systems in mind, Odin may offer you the perfect tool to familiarize yourself with lower level programming while avoiding some of the cruft that may come with an older language like C.

An Approachable Low-Level Language

Odin has been designed to be as simple and approachable as possible.

Simplicity and readability matter. A lot.

As much as you may want to learn something like Rust, its learning curve poses a significant barrier to many -- especially to those learning in their limited free time.

And with as many fans as Rust has, there are many that would argue its design and complexity are unnecessary, or at least aren't worth the benefits it promises to deliver.

If you feel like you're missing out because you don't use Rust or C++, don't. These languages offer A way to program at a lower level, not THE way.

If you like the simplicity and readability of Go, you'll love Odin.

Go is touted as a very simple and readable language. I would agree.

Much of Odin's syntax will remind you of Go.

package main

import "fmt"

func swap(x, y string) (string, string) {
    return y, x

func main() {
    fmt.Println("Hello, World")

    a, b := swap("hello", "world")

    fmt.Println(a, b)

Enter fullscreen mode Exit fullscreen mode

package main

import "core:fmt"

swap :: proc(x, y : string) -> (string, string) {
    return y, x

main :: proc() {
    fmt.println("Hello, World")

    a, b := swap("hello", "world")

    fmt.println(a, b)

Enter fullscreen mode Exit fullscreen mode

As with Go, Odin offers a sane number of ways to do something; you won't be overwhelmed with dozens of options always wondering which is the "best" one. This makes memorizing the language much easier.

If you like the productivity and fun of JavaScript, you'll love Odin.

JavaScript is often the first language people chose when learning to program because you can get started very quickly; it takes no time at all to write some code and see results. This short feedback loop makes playing with JavaScript fun. And fun is an important ingredient when programming.

With Odin, all you need is the compiler and a text editor.

You'll be free from complex build systems, linters, and borrow-checkers.

You can get familiar with the language by completing small coding challenges, writing a console program, or by making a game -- my program of choice.

If you'd like to learn Odin by programming small games from scratch, check out my YouTube channel.

If you like the low-level power of C, C++, or Rust, you'll love Odin.

Odin is an excellent choice if you want to get more familiar with how computers work.

"Higher level" languages like JavaScript, Python, or PHP keep you from getting as close to the hardware as you may like.

As with C, C++ or Rust, Odin does not use garbage collection. This means you get every opportunity to learn how to manage your own memory. This may sound difficult, but with a modern language like Odin it's much easier to learn than most realize.

Even if you're new to programming, getting started with a language like Odin will make you a stronger programmer in the long run.

Why choose Odin over C, C++, or Rust?

  • You may find Odin easier to learn than C. And because it is designed with more modern systems in mind, you will likely find it nicer to program with.
  • C++ is notorious for being unnecessarily complex and overburdened by a lot of bad programming styles. Put another way, the majority of the C++ code you'll find in the wild will make your programming journey harder than it needs to be.
  • Rust is loved by many people but not everyone. The learning curve is high, and it forces you to program in a very specific way -- and not necessarily the best way. It is opinionated, and there are many accomplished programmers who disagree with those opinions. The Rust toolchain is fantastic, and the learning resources are plentiful, but if you prefer a little more freedom with your programming you may find Odin a better fit.


If you'd like to learn more about Odin, here are some links to get you started.

Top comments (1)

chikega profile image

EmberGen - a fluid/fire/smoke simulator was written in Odin - impressive.