Learn To Program With Literate Programming

My heyday in programming was about five years ago, and I’ve really let my skills fade. I started finding myself making excuses for my lack of ability. I’d tackle harder ways to work around problems just so I wouldn’t have to code. Worst of all, I’d find myself shelving projects because I no longer enjoyed coding enough to do that portion. So I decided to put in the time and get back up to speed.

Normally, I’d get back into programming out of necessity. I’d go on a coding binge, read a lot of documentation, and cut and paste a lot of code. It works, but I’d end up with a really mixed understanding of what I did to get the working code. This time I wanted to structure my learning so I’d end up with a more, well, structured understanding.

However, there’s a problem. Programming books are universally boring. I own a really big pile of them, and that’s after I gave a bunch away. It’s not really the fault of the writer; it’s an awkward subject to teach. It usually starts off by torturing the reader with a chapter or two of painfully basic concepts with just enough arcana sprinkled in to massage a migraine into existence. Typically they also like to mention that the arcana will be demystified in another chapter. The next step is to make you play typist and transcribe a big block of code with new and interesting bits into an editor and run it. Presumably, the act of typing along leaves the reader with such a burning curiosity that the next seventeen pages of dry monologue about the thirteen lines of code are transformed into riveting prose within the reader’s mind. Maybe a structured understanding just isn’t worth it.

I wanted to find a new way to study programming. One where I could interact with the example code as I typed it. I wanted to end up with a full understanding before I pressed that run button for the first time, not after.

When I first read about literate programming, my very first instinct said: “nope, not doing that.” Donald Knuth, who is no small name in computing, proposes a new way of doing things in his Literate Programming. Rather than writing the code in the order the compiler likes to see it, write the code in the order you’d like to think about it along with a constant narrative about your thoughts while you’re developing it. The method by which he’d like people to achieve this feat is with the extensive use of macros. So, for example, a literate program would start with a section like this:

Continue reading “Learn To Program With Literate Programming”

Hands-On With The BBC Micro:Bit

It’s been a long wait, but our latest single board computer for review is finally here! The BBC micro:bit, given free to every seventh-grade British child, has landed at Hackaday courtesy of a friend in the world of education. It’s been a year of false starts and delays for the project, but schools started receiving shipments just before the Easter holidays, pupils should begin lessons with them any time now, and you might even be able to buy one for yourself by the time this article goes to press.

The micro:bit top view
The micro:bit top view

It’s a rather odd proposition, to give an ARM based single board computer to coder-newbie children in the hope that they might learn something about how computers work, after all if you are used to other similar boards you might expect the learning curve involved to be rather steep. But the aim has been to position it as more of a toy than the kind of development board we might be used to, so it bears some investigation to see how much of a success that has been.

Opening the package, the micro:bit kit is rather minimalist. The board itself, a short USB lead, a battery box and a pair of AAA cells, an instruction leaflet, and the board itself.  Everything is child-sized, the micro:bit is a curved-corner PCB about 50mm by 40mm. The top of the board has a 5 by 5 square LED matrix and a pair of tactile switches, while the bottom has the surface-mount processor and other components, the micro-USB and power connectors, and a reset button. Along the bottom edge of the board is a multi-way card-edge connector for the I/O lines with an ENIG finish. On the card edge connector several contacts are brought out to wide pads for crocodile clips with through-plated holes to take 4mm banana plugs, these are the ground and 3V power lines, and 3 of the I/O lines.

Continue reading “Hands-On With The BBC Micro:Bit”

How Did Pocket NC Survive and Thrive?

We had a chance to talk to Matthew Hertel of PocketNC at the Bay Area Maker Faire this year. During the conversation, he answered some questions I’d had about the project since I saw it on Kickstarter, and told a cool story while he was at it.

When the Pocket NC 5-axis Tabletop CNC Mill KickStarter came out, I immediately chocked it up as a failure out of the gate. I figured that there would never be a single delivered unit. It just seemed too impossible. The price was too low for a machine with that many large machined aluminum pieces. It had real linear guides. It had a real spindle and housed a beagle bone black running linuxCNC. It just couldn’t be that cheap. Ends up, I’m quite happy to be wrong. Pocket NC is doing well, delivering their first units, and taking new orders.

The CNC equivalent of a brag track on a hip-hop record.
The CNC equivalent of a brag track on a hip-hop record.

It’s easy to get jaded with the Kickstarter and IndieGoGo scams that are out there. Or even the disappointing behavior of projects that could be legitimate. People often do failure analysis of companies, but it is also worth investigating what people did right when they are successful.

Continue reading “How Did Pocket NC Survive and Thrive?”

Kids! Don’t Try This at Home! Robot Destroys Mankind

From the Forbin Project, to HAL 9000, to War Games, movies are replete with smart computers that decide to put humans in their place. If you study literature, you’ll find that science fiction isn’t usually about the future, it is about the present disguised as the future, and smart computers usually represent something like robots taking your job, or nuclear weapons destroying your town.

Lately, I’ve been seeing something disturbing, though. [Elon Musk], [Bill Gates], [Steve Wozniak], and [Stephen Hawking] have all gone on record warning us that artificial intelligence is dangerous. I’ll grant you, all of those people must be smarter than I am. I’ll even stipulate that my knowledge of AI techniques is a little behind the times. But, what? Unless I’ve been asleep at the keyboard for too long, we are nowhere near having the kind of AI that any reasonable person would worry about being actually dangerous in the ways they are imagining.

Smart Guys Posturing

Keep in mind, I’m interpreting their comments as saying (essentially): “Soon machines will think and then they will out-think us and be impossible to control.” It is easy to imagine something like a complex AI making a bad decision while driving a car or an airplane, sure. But the computer that parallel parks your car isn’t going to suddenly take over your neighborhood and put brain implants in your dogs and cats. Anyone who thinks that is simply not thinking about how these things work. The current state of computer programming makes that as likely as saying, “Perhaps my car will start flying and we can go to Paris.” Ain’t happening.

Continue reading “Kids! Don’t Try This at Home! Robot Destroys Mankind”

How to Fail at Laser Cutting

Laser cutters are CNC power tools, which means an operator uploads a job digitally and then pushes START to let the machine do all the work while they lie back in a hammock sipping a margarita, occasionally leaping out in a panic because the sound coming from the machine changed slightly.

Like other power tools, laser cutters are built around doing one thing very well, but they require an operator’s full attention and support. The operator needs to handle all the other things that go on before, during, and after the job. It’s not too hard to get adequate results, but to get truly professional and repeatable ones takes work and experience and an attention to detail.

People often focus on success stories, but learning from failures is much more educational. In the spirit of exploring that idea, here are my favorite ways to fail at laser cutting and engraving. Not all of these are my own personal experience, but they are all someone’s personal experience.

Continue reading “How to Fail at Laser Cutting”

Path to Craftsmanship: The Art of Throwing It Away

Some hackers build sharp, mildly toxic nests of parts, components, and thrifty finds around themselves. These nests, while not comfortable, are certainly comforting. They allow the hacker’s psyche to inhabit a locale as chaotic as their minds. Within these walls of stuff and clutter, stunning hacks pour out amid a small cloud of cursing. This article is not for them.

http://www.computerhistory.org/atchm/an-analog-life-remembering-jim-williams/
Very few of us can actually function in a workplace such like that of the venerable Jim Williams (photo from linked article). Thanks to the commenters for mentioning him in the previous article.

For the rest of us, clutter is a Zen destroying, seemingly unconquerable, monster that taunts our poor discipline and organizational skill from the dark corner of our minds. However, there is an easy solution that is oft overlooked. Somewhat obviously, most organization problems can be solved by simply not having things to organize.

It’s taken me a very long time to realize the source of my clutter woes. My first tactic was to blame myself for my inability to keep up with the mess. A more superior human would certainly be able to use their effortless discipline to keep a space organized. However, the clutter was a symptom of a problem completely separate from my actual ability to keep a space clean.

Continue reading “Path to Craftsmanship: The Art of Throwing It Away”

Adventures of ArduinoMan – The Rudis

Rudis – A small wooden sword given to a Gladiator as proof of his achieved freedom. It signifies his ascent from being a slave to becoming a free man.

One thing is certain – anything that runs on electricity can be connected to the internet. The only obstacle is cost. And as costs come down, the reality of The Internet of Things will be upon us. Everything from cars to curling irons will be connected to the Internet. With this newly connected world will come a new breed of hacker. The Black Hats will move out from behind their keyboards and spill into the streets, only to be met by the White Hats as they battle for control over our endlessly connected world.

And such was the case on the morning of October 16, 2029. The air was cool and breezy when Randall C. Tubbs, a senior police officer at the Bronx 49th precinct, received a call over his radio to check out a tripped alarm at a nearby cell tower. Barely a minute had passed by when he pulled in to the Tower Road cul-de-sac on the day our story begins. The cell tower dominated the horizon, and was silhouetted against a cloudless blue sky. The trees of the forest surrounding the area were just starting to show their colors, with the yellow oak leaves being most vibrant. A narrow gravel driveway led to a small, brown, nondescript building at the base of the tower. At first glance, Officer Tubbs could see no sign of anything unusual. There was no service truck in sight, and the gate to the ten-foot-tall chain link fence surrounding the tower was latched shut and securely locked.

It wasn’t until he unlocked the gate that he first noticed something odd. A security camera on the right corner of the building was pointing toward the forest. He glanced around and quickly spotted two other cameras, each of them pointing away from the tower building. Clearly, they should have been pointing toward the tower and the door to the building… a door that Officer Tubbs now realized was slightly open. He could barely make out shadows moving around from the small sliver of light that was peeking ominously through the opening, suggesting someone was inside. Suddenly, the sound of his footsteps on the gravel seemed to become amplified, and his breathing so loud that for a split second he held his breath. He reached down and turned the volume of his radio to silent, and slowly began making his way to the open door.

Continue reading “Adventures of ArduinoMan – The Rudis”