Developers are never satisfied with something they’ve written. There’s a perpetual urge to throw it out and rewrite software using whatever new and shiny technology has caught our fancy. I have been at this business long enough to recognize this as a trap. Fortunately, I have a tool that will let me do partial rewrites. This lets me take the advantages of shiny new technology and apply them to strategic areas.
In spite of the reputation of programmers as anti-social loners, I adore pair programming. Some of that is because programming can be lonely. Mostly, I spend a lot less time feeling stupid when I am paired. It feels good to be less stupid.
I was running an impromptu workshop yesterday and hit upon an excellent way to manage dependencies in a Makefile. This mechanism downloads dependencies and keeps them updated with nothing more than standard make and git.
Object Relational Managers like Hibernate or Entity Framework simplify life for developers who use databases. Unfortunately they also make it easy to do things that will cause us problems down the road, that won’t show up until the application has been in production for a while.
Using Spring Boot and Hibernate, we’ll work through examples as a group of how to use native SQL with Hibernate to remove those bottlenecks.
Completed Circuit Board Get introduced to the exciting world of electronics and embedded technology with a two hour workshop on building a Haunted Pumpkin.
You will:
Get experience soldering electronics Incorporating electronics with physical objects When & How We’ll meet via a private video link at 10am on Saturday, October 17. You’ll receive an email invitation with the proper link and calendar entry.
If that time doesn’t work for you, contact me via email to arrange an alternate time.
I have been working with a client who, by corporate mandate, uses Simulink and automated code generation for all of their embedded software. Part of my mandate is to speed the path to project completion.
For this client, the single biggest speed blocker is validation of the code against software requirements. After each feature is completed, an exhaustive review of of software requirements is undertaken and the work validated against it.
Glowing-eyed goblins infest the planters at night. These glowing eyes can peek out from bushes, potted plants, the wheel wells of parked cars, or anyplace else that’s just a little hidden. It will give your yard a cheerfully haunted look for Halloween. The lights should be bright enough that they’re visible peering out from shadowy bushes even during daylight hours. Hide a few low to the ground near a walkway.
I’ve been experimenting with booze-filled gummies for a while now, and I’ve been asked by several people to share my recipe. We’re all stuck and home and living with a lot of stress, so a comfort food like finger jello goes a long way to improving happiness.
Tools First, let’s start with the molds. You need silicone molds of some sort to hold and form the gelatin. The gummies we’re making are significantly stiffer than the finger jello you might have known as a child, so cutting up a sheet pan into squares isn’t going to be a good time.
A lot of people are discovering what it’s like to work remote suddenly, or they’re about to. It’s possible that this experience has sucked. I worked for over a year on mixed remote and collocated teams, and there were some important lessons we learned. My team used extremem programming practices, which are intensely collaborative, including pair programming and test first code. Here are some of the things we learned.
Tools The Microphone Is Everything.
One of the most confusing parts of setting your workstation up for embedded testing is just what tools you’ll need and how to install them. Fortunately the number of tools you’ll need is minimal. You need:
A compiler that builds native binaries for your workstation operating system. Unless you want a very hard time, its command line should be compatible with the UNIX cc command line. Gcc and clang both conform to this interface, and they are available for most common workstation operating systems.
In tech we love to tell ourselves that we operate on merit. It’s nice to tell ourselves that we work at a place that only hires the best. Out of everyone else who tried to get my job, I was the best. And that is true, I was the best of the people who applied for my job. The problem is that the best way to lie is to use the truth to do it.
I was really happy to see all the people who cam out and wanted to hear about C programming at CodeMash. It’s wonderful to find a place with so many people who share my same obscure fascination.
Books I neglected to put a bibliography into my slides, so let me address that here.
Learning C The gold standard is The C Programming Language, but the prices offered on Amazon on ridiculously high.
In my talk Team Health for Fun and Profit I strongly advocate for working reasonable hours. The 40 hour work week was paid for in blood, and we ignore it at our peril. A person in the audience pointed out that it’s common in the tech industry for somebody who only puts in their 40 to be perceived as a “clock puncher.” Somebody with no passion for the business, not as dedicated to the goal as everyone else.
I’ve been drinking the Test First kool-aide for years. So when I write embedded code for an Arduino, I want to test that code before pushing it to my lovingly hand-wired circuit. C doesn’t get a lot of love in the testing world, which is a shame. It’s probably easier to write automated tests for C than any other language.
One of my favorite tools for light weight testing is Unity from Throw the Switch.
Imposter syndrome, that feeling that you’re really not good enough to be where you are, that you’re going to be discovered and kicked out, is a women’s issue. No Real Man™ would ever admit to being an imposter. Fortunately, after 20 years as a developer, I was able to woman up and admit that I too had imposter syndrome.
That admission was one of the most freeing things I have done in my life.
One of my favorite things about C++ is that it works exceptionally well cross platform. This is entirely to the work of library authors who put a lot of effort into putting a common interface on common tasks, each with a different implementation. The proposed filesystem library in C++ 17, based on the excellent boost filesystem library, in one of my favorite bits. Unfortunately it’s not entirely obvious how to use it without some deep digging.
I’m a big believer in Test Driven Development. That’s the model where you write a failing test, then you write just enough code to make the test pass, but no more. It sounds counter-intuitive,but experience has shown that I get a finished, deliverable product a lot faster, and I’m less likely to find bugs. Even more importantly, my customers are less likely to find bugs.
Setting up a Makefile to support test driven development adds some additional challenges to what I’ve shown in my earlier articles.
I’ve cobbled this recipe together from various sources, starting with my grandmother’s pie crust recipe, and adding in things I learned from my mother and reading cooking magazines.
Tools This recipe requires a kitchen scale capable of measuring in grams. It’s important to keep the ratios of liquids to solids correct, or you’ll have a bad time. Learn from my pain.
Stage 1 Ingredient grams Cumulative grams Flour 180 Salt 1 181 Lard 102 283 Measure the ingredients into a bowl on the scale, looking for the cumulative balance total on your scale for each step.
One problem a lot of people run into is the need to test code that uses APIs they don’t control. This came up tonight during a discussion on mocking at the Pillar Technology Plugged In event in Ann Arbor. The system in question was a remote service, but I encountered it recently with UNIX system calls. Fortunately there’s a simple solution.
If you wrap the APIs in a class, you can mock that class.
If you have even a moderately complex application, writing tests can be a real pain. You either wind up writing complex, fragile tests, or you skip it altogether. There is a third path: fake out all of the parts that you aren’t testing in this test. You can examine the fake parts to see what has been done with them, and you can make them respond however you want to your program.
If you read my earlier article [OMG WTF Makefiles]({% post_url _posts/2017-11-01-omg-wtf-makefiles %}), there was a lot of information to take in. And Makefiles built that way can get pretty overwhelming to keep up pretty quickly. In fact, unless I’m forced to use BSD Make, I use GNU Make and take advantage of some nice shortcuts. I’ll show you how to keep your Makefile building simple.
Simple Dependency Management I hate having to update the Makefile every time I add a new class to the project.
If, like many developers, you haven’t written a line of C or C++ since you left school, but suddenly find yourself needing to write in those languages, this article is for you. Or maybe you’re in school, but you need to write a moderately complex program (more than one file). This article is also for you.
My Instructor Never Covered This It’s almost a given that your programming education didn’t include information on creating Makefiles.
At Prairie.Code() I provided an example embedded project to demonstrate test driven development as part of an Arduino workshop. The example I gave used the Unity testing framework, but there are several others and they’re worth exploring.
Unity http://www.throwtheswitch.org/unity
I love Unity for its compactness, and how easy it is to use. It’s small enough to include the complete source in your project without bloating it. The examples in my presentations were all written with Unity.
Conway’s Game of Life is an old standby for code retreats and coding katas. The game’s simplicity means that implementation complexity won’t get in the way of what you are trying to learn.
A few months back in a code retreat a fellow attendee implemented the game in a functional language. My first thought was “why would anybody do that?” My second was “how could I do this in C?” C isn’t normally thought of as a functional language, but there’s nothing stopping it from being used that way.
Recently at a client we had a discussion as a team about our continuous integration practices. One of the goals of continuous integration is frequently pushing changes to the master branch, so that it can be integrated into the build.
But how do you do that if you need to make breaking changes? You can push to master, break everybody’s build, and earn the undying enmity of your entire team if you do this regularly.
In my last post we looked at a basic query of the GPIO bus just to show that we could read it. This time I want to actually control something. Blinking a light is the IoT equivalent of Hello World, so we’ll try that. In this setup, the anode (short lead) of the LED is connected to pin 19 by a smaller resistor, and the cathode (long lead) is connected to the 3v ground bar.
Halloween is kind of a big deal where I live, so this year I decided I needed a nice rotation of videos projected onto my garage wall. There are a few things you’ll need:
A computer, preferably a laptop or netbook. A projector. External speakers, ideally weather proof. Extension cord Appropriate Halloween videos A safe place out of the weather to set up your gear Video The fun part of this project is putting together the video.
We’ve all seen code bases that look like they might have been written as an ode to Fear and Loathing in Las Vegas. There’s a good chance that we have even perpetrated such code. But now it’s in production and the support is making you wonder why you didn’t take that nice accounting job out of school. You could put tests on the code but it’s such a mess that you should probably just throw it out and start fresh, if only you had the time and the Business wasn’t howling about the way the software is causing them to bleed cash.
I’ve just gotten to play with the C++11 ‘‘for’’ extensions for the first time. It’s really cool, especially the ability to iterate over a plain old array. Dig this code from my current hobby project:
int Driver::getSpeedBonus(int speed) { struct speedbonus { int speed; int bonus; }; struct speedbonus benefits[] = { {200, 10}, {140, 9}, {100, 8}, {60, 7}, {40, 6}, {30, 5}, {20, 4}, {12, 3}, {10, 2}, {0, 0} }; for(struct speedbonus b : benefits) { if (speed >= b.
Over lunch a colleague mentioned that she wanted to start using Raspberry PI projects to draw crowds at some of our community open house events. Because I first learned systems programming on FreeBSD, I wanted to try making it work. Fortunately there’s a great little project called crochet that helps you build an image you can burn onto an SD card. Since cross compiling is actually kind of hard to set up, whenever it encounters a problem it tells you how to fix it.
If you read my previous piece on putting FreeBSD on a Raspberry Pi, you’re probably now wondering what exactly you’re going to do with this little box. Fortunately I have invested the effort to work out some basics of handling GPIO on FreeBSD and a Raspberry Pi. Because of why I chose FreeBSD, I’ve also implemented it in C: my first choice for tackling new problems in systems programming.
Setup You can, of course, connect to the box with a keyboard and screen.
For Christmas my stepson’s mother in law suggested that she would like to buy a small box to hold my step son’s military medals and ribbons, which currently reside in a plastic bag on his dresser. Since I have a wood shop, making him a box seemed like a much better idea. The box is out of black walnut, the trays have figured cherry sides and maple plywood bottoms. The trays were lined with suede.