Skip to content
HomeVideosBooksBlogs
AllTop postsTopics
Podcasts
HistoryListsWatch laterLiked videosFollowing

The videos, books, blogs and podcasts Hacker News keeps recommending, all in one place.

VideosBooksBlogsPodcastsAboutPrivacySettings

Data from Hacker News, HackerTube, HackerBooks, HackerBlogs and Open Library. Credits · Not affiliated with Y Combinator.

HomeVideosBooksBlogsPodcasts
Ctrl K
    B

    Barr Group

    barrgroup.com · Company blog · on HN since 2015

    Barr Group, an embedded systems consultancy, publishes articles on state machines, embedded C, coding standards and firmware design.

    Visit blogHN submissions
    Hardware & ElectronicsProgrammingSystems & Performance
    What HN says

    HN commenters cite it for embedded C coding standards and state machine material, including Michael Barr's work. One links a post on AI agents finishing a novel.

    Stats for nerds
    19HN people shared it
    13linked in comments
    155story points
    Mar 2026last shared
    2015people per year2026

    Top posts on HN

    1. 1
      Introduction to Hierarchical State Machines
      1 person · 134 points · first shared 2017 · 12 comments on HN
    2. 2
      Introduction to Hierarchical State Machines (HSMs) (2016)
      4 people · 5 points · first shared 2020 · Discussion on HN
    3. 3
      The Best Books about Embedded Systems Design
      1 person · 3 points · first shared 2015 · Discussion on HN
    4. 4
      CRC Implementation Code in C/C++
      1 person · 3 points · first shared 2018 · Discussion on HN
    5. 5
      Can Carmakers Break Free from Google with ‘Automotive Grade Linux’?
      1 person · 2 points · first shared 2017 · Discussion on HN
    6. 6
      How Network Processors Work
      1 person · 2 points · first shared 2023 · Discussion on HN
    7. 7
      Killer Apps – Embedded Software's Greatest Hit Jobs [pdf]
      1 person · 2 points · first shared 2023 · Discussion on HN
    8. 8
      State Machines for Event Driven Systems (2016)
      2 people · 1 points · first shared 2020 · Discussion on HN
    9. 9
      BARR-C:2018 embedded C coding standard, harmonized with MISRA C 2012
      1 person · 1 points · first shared 2018 · Discussion on HN
    10. 10
      Mutexes and Semaphores Demystified
      1 person · 1 points · first shared 2017 · Discussion on HN

    What HN people wrote when they linked it

    • JohnHaugelandApr 2021

      > I'm mostly concerned about visualization

      Almost all of the finite state machines use the same underlying graphing tool, "GraphViz," to do their rendering. It sounds like you might want that.

      There is an emscripten transcompile for the web called viz.js.

      .

      > if you have actions/guards that don't appear on the visualization

      Actions do appear on the visualization. I'm still not sure what you mean by guards.

      .

      > imilarly, by recursion I meant putting states inside states (from a behavior perspective you would call them compound states); Both PlantUML and XState supports that. Parallel states [1] are compound states with multiple distinct regions

      It looks like one of XState or PlantUML tried to rename Heirarchical Orthogonal State Regions, and the other copied the first one.

      .

      What you're calling "recursion" is called a Heirarchical State Machine. It appears that XState uses the regular name for these:

      https://xstate.js.org/docs/guides/hierarchical.html

      External reference:

      https://barrgroup.com/embedded-systems/how-to/introduction-hierarchical-state-machines

      .

      What you're calling Parallel States is properly called an Orthogonal Region. It's problematic to call these parallel for exactly the following statement, where you suggest that this "doesn't necessarily imply threading;" this wrong name that XState and PlantUML has used has confused you.

      *All state machines are by definition single threaded single context. This may not and will never be implemented…

    • RossBencinaApr 2020

      To these links I would also add Miro Samek's book "Practical UML Statecharts in C/C++," which covers details of implementing (hierarchical) statecharts. The book includes a chapter that analyses different ways of encoding extended state machines (Miro concludes a function pointer, with one event handler function per state is the best for C/C++. I don't think this is the encoding that the linked Rust article uses). A simple algorithm for implementing HSMs is described. A large portion of the book is devoted to what you might call "UML Statecharts -- The Good Parts," the parts of the UML statecharts spec that are easy to implement in a real-time setting, and idioms/patterns to achieve similar results as the parts of the spec that are not easy to implement.

      Some of Miro's online writings:

      https://barrgroup.com/embedded-systems/how-to/state-machines-event-driven-systems
      https://barrgroup.com/embedded-systems/how-to/introduction-hierarchical-state-machines

      https://www.drdobbs.com/who-moved-my-state/184401643

      [Edit: clarity]

    • FirmwareBurnerNov 2023

      Might I suggest better alternatives as more pleasant alternatives to the stuffy MISRA C book:

      - "Embedded C Coding Standard" by Michael Barr[1], CTO and co-founder of Barr Group, the guy who inspected the ECU code and testified in Toyota's unintended acceleration lawsuit. Good stuff.

      - "Embedded System development Coding Reference guide" written by the Software Reliability Enhancement Center of Japan [2], which covers and expands on MISRA C and more. It's a joy in examples, explanations and eye-pleasing aesthetic. I love it.

      [1] https://barrgroup.com/sites/default/files/barr_c_coding_standard_2018.pdf

      [2] https://www.ipa.go.jp/publish/qv6pgp00000011mh-att/000065271.pdf

    • teleclimberMar 2017

      Thanks for the reply. My comment was in reference to the Visual Basic Calculator program described here: (perhaps "VBScript" was not accurate)

      https://barrgroup.com/Embedded-Systems/How-To/State-Machines-Event-Driven-Systems

      That VB calculator is shown as an example of "The Problem" with event driven programming, but I just see it as an example of why poorly designed programs are hard to reason about and buggy.

      I did not see the coffeescript / Python calculator.

    • sokoloffMay 2021

      That was done via Airworthiness Directive (a mandatory prod patch for aviation), not by original engineering design intent. Similar story with the Patriot missile defense battery.

      * - https://www.federalregister.gov/documents/2020/03/23/2020-06092/airworthiness-directives-the-boeing-company-airplanes

      * - https://barrgroup.com/sites/default/files/case-study-patriot-missile-defects.pdf

    • HorizonXPMar 2017

      You're correct. (https://barrgroup.com/Embedded-Systems/How-To/C-Volatile-Keyword)

      But again, you're telling the compiler that you know what you're doing, and to not perform its normal optimization. I'm not well-versed in compiler design, but I think that's the tradeoff you have to make between trusting the user's design choices, or not.

    Related

    Embedded Gurusembeddedgurus.com45 people

    Are we shooting ourselves in the foot with stack overflows?

    Embedded Gurus
    Publication · last shared 2024
    Secrets of Consultingsecretsofconsulting.blogspot.com19 people

    Should I learn C++ or Python?

    Secrets of Consulting
    Personal · last shared 2025
    MSRC Blogmsrc.microsoft.com240 people

    SolarWinds hackers were able to access Microsoft source code

    MSRC Blog
    Company · last shared 2026
    John Regehrblog.regehr.org401 people

    Teaching C

    John Regehr
    Personal · last shared 2026
    The Morning Paperblog.acolyer.org606 people

    Local-first software: you own your data, in spite of the cloud

    The Morning Paper
    Personal · last shared 2026
    Paul Khuongpvk.ca106 people

    SBCL: The Ultimate Assembly Code Breadboard

    Paul Khuong
    Personal · last shared 2026
    Interrupt (Memfault)interrupt.memfault.com51 people

    From zero to main(): How to write a bootloader from scratch

    Interrupt (Memfault)
    Company · last shared 2026
    Our Machineryourmachinery.com36 people

    Virtual Memory Tricks

    Our Machinery
    Company · last shared 2022