Skip to content

rokath/rokath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

66 Commits
 
 

Repository files navigation

Hi there 👋

Embedded Programming is my passion

  • Still sticking with C (liking function pointer arrays) in micro-controllers.

My favorite PC language is Go

Why?

  • Go is open source, sponsored, professionally developed and used by Google.
  • Go is a multi-purpose language.
  • Go is object oriented.
    • Go uses composition instead of inheritance - programs get cleaner this way.
  • In Go interfaces are implicit - they need no explicit declaration.
    • This allows clean and simple APIs in your code without unneeded dependencies.
  • Go is easy to learn, to use and gives quick programming success.
  • Go is a compiled language, therefore checks a lot before building the code.
    • You get most errors at compile-time and not at run-time as with scripting languages (like Python). The Go compiler itself is fast. It allows script like usage of Go as well.
    • The Go program execution is fast.
      • Could be about half speed of a well written C program - not relevant for normal use cases. To get an equivalent "well written C programm" takes much longer than getting the Go program for a specific task.
  • Go is a managed language making memory leaks impossible.
    • No explicit memory allocation and free.
  • Go supports slices, a very light array management struct.
  • Go has pointers but no pointer arithmetic, making code more reliable this way.
  • Go is designed to use multi-core machines and single-core ones and allows easy multi-threading and inter-process communication.
    • Concurrent programming using Go rotines and channels allow efficient program structures.
    • Parallel execution allows to use the full multicore power of modern systems easyly.
    • Concurrency is not Parallelism by Rob Pike
  • The auto-formatting as languge part is very comfortable.
    • This allows a bunch of helper tools.
  • A testing environment comes with the language. Fuzzying is supported.
    • Simply create my_test.go files inside your Go package and run go test ./... in the project root.
  • You get a stand-alone runnable without libraries dependencies.
    • No missing library anymore.
    • No install ... before running an executable.
  • Many platforms are supprted, also mobile development.
  • Go has an integrated documentation System.
    • Just add comments to your functions.
  • Easy Visibility control: Packages export UppercaseFunction and hide lowerCaseFunction.
  • Go can use C/C++-code and vice versa, but crossing the border takes time, so avoid that in loops.
  • Compatibility: Legacy Go code runs on new Go versions.
  • Go has generics now.

Disadvantages?

  • Not made for small microcontrollers.
  • Not well suited for fast hard real-time applications on sub-millisecond level because of the stop-the-world garbage collector.
    • BUT: The GC gets better and better with new Go versions AND avoiding that Go uses the heap heavily, avoids GC at all.

More Information

Some Details

Examples

Learning

What I use Go for?

  • The Trice tool is written in Go.
  • Test tools stimulating embedded devices under test.

Releases

No releases published

Packages

No packages published