At the second annual PillarCon, I facilitated a workshop called “Fundamentals of C and Embedded using Mob Programming”. On a Mac, we test-drove toggling a Raspberry Pi’s onboard LED.

Before and after

Before: ACT LED off
Before: ACT LED off
After: ACT LED on
After: ACT LED on

Retrospective

Noteboard: takeaways from Fundamentals of C and Embedded
Noteboard: takeaways from Fundamentals of C and Embedded

Here are the takeaways we wrote down:

  • Could test return type of main()
  • Why wasn’t num_calls 0 to begin with?
  • Maybe provide the mocks in advance (maybe use CMock)
  • Fun idea: fake GPIO device
  • Vim tricks! Cool
  • But maybe use an easier editor for target audience
  • Appropriate amount of effort; need bigger payoff
  • Mob programming supported the learning process/objective

My own thoughts for next time I do this material:

  • Try: providing the mocks in the starting state
  • Keep: providing multi-target Makefile and prebuilt cross compiler
  • Try: using a more discoverable (e.g., non-modal) text editor
  • Keep: being prepared with a test list
  • Try: providing already-written test cases to uncomment one at a time (one of the aspects of James Grenning’s training course I especially loved)
  • Keep: being prepared with corners to cut if time gets short
  • Try: knowing more of the mistakes we might make when cutting corners
  • Keep: mobbing

Participants who already knew some of this stuff liked the mobbing (new to some of them) and appreciated how I structured the material to unfold. Participants who were new to C and/or embedded (my target audience) came away feeling that they needn’t be intimidated by it, and that programming in this context can be as fun and feedbacky as they’re accustomed to.

Play along at home

  1. Install NetBSD 7 on Raspberry Pi
  2. Fetch the NetBSD source tree (or let the Makefile do it for you)
  3. Build the cross compiler and a complete NetBSD for the target system (or let the Makefile do it for you)

Then follow the steps outlined in the README.

Further learning

You’re welcome to use the workshop materials for any purpose, including your own workshop. If you do, I’d love to hear about it. Or if you’d like me to come facilitate it for your company, meetup group, etc., let’s talk.

Posted Sat Feb 18 19:07:16 2017 Tags:

Previously

Give assignments

Since July, when I wrote Part 1, I got married, joined a C-based project, rolled off, joined a new project, and moved house.

One of the recommendations in Part 1 was “take assignments.” The reason I’m finally back for Part 2 is that I’m running a workshop on Saturday. If you’re having trouble making time to learn something, try committing yourself to teach it.

Trust your doubts

I’m supposed to deliver two hours of hands-on “Fundamentals of C and Embedded.” Having worked in C professionally for some weeks — and embedded systems for zero — I certainly don’t know any more than the fundamentals. It could be the case that I know less.

I don’t have to be an expert at C or embedded to deliver what I’ve promised. I do have to be an expert at noticing, of all the things I don’t know, what’s bothering me the most right now. Over and over again.

One question at a time

Even though a Raspberry Pi is a general-purpose computer, in the workshop we’re going to treat it as an embedded system. By that, I mean that even though we could easily develop software directly on the Pi, we’re going to pretend we can’t. Or another way: even though it’s actually reasonably quick and cheap, we’re going to pretend it’s slow and expensive to deploy and test on the “target” system.

As I was preparing the workshop, here’s what I didn’t know that bothered me the most, in order:

  1. Can I write C to drive some visible feature of the Pi? See whether I can get the onboard LED to toggle. Result: it works.
  2. Can I cross-compile some C code? Try adapting Roman Numeral Calculator to optionally target the Pi. Result: it works.
  3. Can I link with one implementation of an interface for the host and another for the target? Yes: the native Mac build prints “gonna toggle the LED” and the Pi build really toggles it.
  4. Can I instruct the Pi build (and not the native Mac build) to depend on that cross compiler, and to rebuild it if it’s missing? Yes (and I’m glad I kept my notes and got it right on the first try).
  5. Can I link with real system calls for the target and custom fakes for the host? Yes, and this supersedes what I learned in (3): with fakes for open(2)/ioctl(2)/close(2), I can get rid of the fake implementation of led_toggle().
  6. Can I now write microtests for led_toggle()? Yes, and in so doing I found and fixed some behavior that didn’t meet my expectations.
  7. Am I now qualified to run a workshop that claims we’ll “test-drive a Raspberry Pi from a Mac”? I believe so.

Conclusion

Am I ready to run the workshop? Not quite. I want to make sure that in our two hours as a mob, test-driving C in Vim, we get the satisfaction of toggling that LED.

How fast we get there depends on how well we test-drive (our company prides itself on this), how well we know C (depends on who shows up), and how well we can deal with Vim (same). It’s possible that our pace won’t be fast enough; I’ll want to have thought about how to speed us up. It’s also possible that we’ll blow right through it; I’ll want to have thought about what more we could do with our time.

I’m still no expert in C or embedded systems, but the state of my knowledge is no longer the bottleneck to delivering a valuable version of this workshop. Wish me luck!

Posted Thu Feb 16 18:56:35 2017 Tags:

My birthday’s next week, which usually grants me license to submit my year-in-review posts a solid month after the deadline (though last year’s came in under the wire).

But I’ve done enough reflecting and resolving in a recent post about slack and batch size for the moment. And my batch sizes this week are necessarily small (though this post maybe takes the idea a bit too far). For the moment, I’m happy to say that several anticipated changes have fallen into place:

  1. Agile in 3 Minutes is back.
  2. I’ve joined a new team.
  3. I’m in Des Moines visiting them in person.
  4. I’ll mostly be working from home.
  5. I get home tomorrow.
  6. Home is New York.

With all this important stuff established, my main goal for my birthday is to restore my daily habit of long, fast walks. I’ve got just enough days between now and then to give myself that gift.

Posted Thu Feb 2 09:28:02 2017 Tags:

I’m spending time on…

Unpacking. Gearing up on a new project. Making lots of small readjustments.

I’m looking forward to…

Getting to know my new team. Flying out to meet them in person. Learning Python. Making myself more useful. Shipping valuable software.

Feeling sufficiently readjusted.

Deepening relationships.

I’m wishing for…

Reestablishing a routine: home, work, exercise, writing.

I’m traveling to…

Early February: Des Moines.

Otherwise: see my speaker page.


What’s this?

It’s a /now page.

nownownow.com is a directory of people with /now pages. I’m listed there.

Posted Fri Jan 27 14:27:41 2017 Tags:

I’m spending time on…

Every other week: writing a new post on this site.

Mornings: Getting to know my new team.

Afternevenings: Packing up the house.

Mealtimes, mostly: Checking a few last items off our Bloomington to-do list.

Tonight: Mother Bear’s Pizza.

I’m looking forward to…

Loading up the car and saying goodbye to this place. I’m happy I came here — I leave healthy and married, with a sweet cat and dog, new and strengthening connections to a community of human-loving technologists, and my head on as straight as it’s been in quite some time — but now that my wife has gotten what she came here for, we’re ready to live near family.

Meeting our friends’ baby en route.

Our new home.

Getting to know my new team (and not just in the mornings). Flying out to meet them in person. Learning Python. Making myself more useful. Shipping valuable software.

I’m wishing for…

Reestablishing a routine: home, work, exercise, writing.

I’m traveling to…

Next week: Suburban New York by way of Pittsburgh.

Early February: Des Moines.

Otherwise: see my speaker page.


What’s this?

It’s a /now page.

nownownow.com is a directory of people with /now pages. I’m listed there.

Posted Thu Jan 19 11:31:24 2017 Tags: