Strafe and Fire III

March 18, 2020

Devon swore as he lost his last life.  Before respawning, he checked his messages.  One new message: his friend Kale had just gotten a copy of Strafe and Fire III for his birthday, and invited Devon over.  Devon selected the quick reply for “Be right over” and pulled up the Transportation Manager to fill out a Travel Declaration.  “destination… favorites… Kale’s house.” Date: “today”. Kale had already filled out a Declaration of Visit, and it popped up now.  Devon chuckled at the Declared Purpose, “to kick his ass in Strafe and Fire III”. The approval went through and he headed out the door.  The game was just a small commute away.

Kale was at the grocery store, picking up some snacks for the evening.  As he approached the autoscanners, his mind went thru its checklist. Rarely did anyone have anything illicit, but everyone went thru the list in their head before an autoscanner.  “Did he have anything that could be considered a weapon? Any merchandise out of his age or class rating? Any medications outside of their original packaging?” He gave himself the “all clear”, and stepped into the autoscanner.

The scanner picked up the transmission from Kale’s Universal ID, then it picked up the transmissions from the groceries in his bag.  It looked up Kale’s records, and found the Declaration of Visit, which allowed for the additional food. Kale’s allowance account was deducted, and a few other checks were done.  These passed, except for one.

The sirens on the autoscanner went off, while the lights flashed bright yellow.  A stern automated voice said, “There has been a problem with your purchase. Please see security personnel.”  Two guards came over to Devon. “Hands against the wall, and please hand me your backpack.” One guard scanned him with a hand scanner while the other went thru his backpack.

Kale sighed.  He thought he had covered everything.

The guard looked at the message from the autoscanner.  “OK, Kale, the problem is your choice of snacks. They push your friend Devon over his heart-healthy cholesterol limit. You’re either gonna hafta put back some of those chips or buy some Heart Safe brand cholesterol limiting pills.”

Kale protested, “I can’t afford those pills.”

The guard looked at his display, “Yeah, you’re right, the pills would push you over your allowance limit.  Guess you gotta lose the chips.

“Can I just buy some carrots or something?”

The guards eyes narrowed.  This kid was protesting more than he should.  But he ran the carrots anyway. “Yeah, you can get a six ounce Good Berry Farms, Inc. baby carrots.  That’ll get Devon’s numbers square.” He handed him back his pack. “Get that taken care of, and stay out of trouble.”

Devon’s commute had gone as smoothly as it could have.  He caught the train that the Transportation Department’s computer predicted he would, so Trans Dep could time a bus to be ready as he came out of the train station.  He arrived at Kale’s house as Kale was picking out carrots.

Devon slid his ID thru Kale’s doorbell scanner.  A series of messages displayed on the screen. “Devon Garcia (425-76-2785-329) recognized… Sorry, Kale is not in… Visit Declaration found: Devon Garcia is expected…  Trust level: high… Access granted.” Devon heard the dead bolts click, then a fake cheerful computer voice said, “Welcome Devon”.

When Kale arrived, Devon was sitting in his guest gaming chair playing a spaceship dogfight game.  He blew up his opponent then flipped the game to pause. “Hey K.”

“Sorry I’m late.  Someone didn’t tell me their cholesterol numbers were high.” He threw the bag of carrots at Devon.  

“Oh, sorry about that.”  Devon said, opening the carrots.  “I hope you didn’t get into too much trouble.”

“Nah, it’s ok.”  Kale started unloading the rest of the snacks.  “I’m still under my detain limit. Just got a warning.  But you better enjoy these chips.” He tossed the chips at Devon.

Kale picked up the Strafe and Fire III package.  “And here it is.” He broke the quality seal and opened the game.  He inserted the game, then scanned first the authenticity card then his own ID card.  

He got into his gaming chair as the game yelled out, “Strafe!  And Fire! Three!” He raised his right hand just before the system said, “Please raise your right hand.”

The system immediately detected his right hand was raised, but still had to wait the legally required two seconds.  Then, in a dry voice, “Do you hereby swear (or affirm) that you have you read and agree to the terms of the licensing agreement and that you have legally acquired this software?”  Kale said “yes” in a clear monotone designed to make sure the system didn’t have to ask him to repeat himself.   

Then came the Purchase Circumstances Screen.  “How did you receive this software?” “Gift or Present” “Who gave it to you?”  Kale entered his aunt’s name. “What was the occasion?” “Birthday” Then the screen said, “Transferring to a live agent.”  The boys look at each other. Something must have gone wrong.

A bored-looking woman appeared on the screen.  She looked at an unseen screen, and didn’t look up when she asked in a monotone, “Name please?”

Kale responded mechanically, “Kale Kline 893-72-9838-12.”

The woman gave no indication that she had heard him and asked the next question, “How did you receive this software?”

“My aunt gave it to me.”

Still in a monotone, “What was the occasion?”

Kale was getting nervous, “Uh, for my birthday.  It’s a birthday present.”

Now the woman stared right into the camera, right at Kale, and spoke with inflection, “The problem, Kale Kline, is that your birthday isn’t for another four weeks.”

The woman’s sudden change in attitude had its desired effect on Kale, and he froze a moment, then responded, “She’s going on vacation.  For a month. She thought she’d give it to me now. It’s for work – her vacation I mean.”

The woman looked back down at her screen and fiddled with it for a bit.  After a moment she responded, “OK, I’ve got her Travel Declaration. Yes, she’ll be gone for your birthday.”

Her off screen hands worked with her system a second longer.  Then, back in her monotone she said, “I’m authorizing your registration.  Thank you, enjoy your software.”

Kale and Devon breathed a sigh of relief.  Then the Strafe and Fire III main screen showed up.  Kale turned to Devon and said, “And now, get ready for the finest video game carnage the world has ever produced!  Oh, and pass me the carrots.”

Declarative programming for business rules, imperative for the rest

July 9, 2019

I’ve been thinking and reading about declarative programming lately. I have a new theory: it would be possible to write all business specific programming declaratively, and make the imperative code completely business neutral. And I see it opening up all sorts of possibilities.

Ok, so now to explain what I just said.

Programming today is generally imperative. The programmer tells the computer, “do this. Then do this. Then do this.” A list of commands. In imperative programming, we tell the computer how to find the answer.

In declarative programming, on the other hand, the programmer tells the computer what the answer is. That is, we declare what we’re looking for. The computer can find the answer any valid way it wishes. Like in a spreadsheet, we declare the formula for every cell, but the computer can evaluate it in any order.

The problem is that computers can’t run declarative programs. Some programmer has to write some imperative code to interpret the declarative code. They must tell the computer how to achieve the what. In the spreadsheet example, these are the programmers who wrote the spreadsheet.

In practice, a programmer creates a special purpose language and the software to interpret and run that language imperatively. Sometimes this is called a Domain Specific Language, or DSL. Examples of declarative languages are SQL or regular expressions.

So why do I think we could write all business logic declaratively?

The names of the business objects, the language of the domain, changes in every program, or at least in every company or industry. But the fundamental concepts are all the same. Most business programming is about moving around and mutating data. A lot of the rest can be modeled as a workflow engine or even just a finite state machine.

And why do I think this would be a good thing?

It’s mainly about a separation of concerns. The two concepts are fundamentally different. We try to treat business rules and implementation specifics as the same thing, and it muddies the water.

And they need different things. Business rules need to be verified that what they’re modeling is what was intended to be modeled. Imperative code needs to be tested for correctly handling all cases, and for non functional requirements, like performance.

It’s also a code sharing thing. What if we shared all the imperative code? Most free software is business neutral. And with there being no business specific logic, we’re not divulging the secrets of how the company is run.

Declarative code would generally not be shared. That defines how the business does its business. Businesses tend to not want to let that information out, and someone not in their industry probably couldn’t do much with it anyway.

Once we have an ecosystem with some shared declarative languages and multiple interpreters, we can finally have some sort of interoperability. “How would this app work with a different database?” Let’s swap it out and see how it works. “Someone just made a better communication method.” Great, let’s deploy it into our entire software. As long as the new code uses the same declarative language, it can be swapped in.

What do you think? Would the declarative / imperative split solve your problems? Do you think this would (or would not) be a good idea? Tell me in the comments.

Programming on your phone

May 19, 2016

I have figured out how to program on an Android phone or tablet. Using Google Cloud Platform and a couple of Android apps, I have a cloud development box, and I can pull up a command line and edit files locally in my Android device.

I’m going to describe the method I use. You can, of course, use different apps that do the same thing. This is just my method of implementation.

Setup up Google cloud platform. See

Create an instance named dev-instance. I use a small preemptable insurance to save on money. You can use a larger instance (but not a smaller one). You can choose to make it preemptable or not. Preemptable is nice because if you accidently leave it running, it won’t stay up more than 24 hours.

Install the Android Google Cloud Console app. Also install JuiceSSH and the paid version of DroidEdit.

In JuiceSSH, go to Connections, slide to Identities, and click the plus to create a new identity. In the Nickname fields, enter ‘dev-instance identity’. Under username, type your Google user ID. Press Set next to Private Key. Go to Generate. Change Key Format to RSA. Hit OK to generate the key (this may take a while). Then press the checkmark in the upper right hand corner to save the identity.

When the identity is created, long press it and select Export Public Key. Select Copy to Clipboard.

Go into Google Cloud Console. Go to Resources then to VM Instances. You should see your instance, dev-instance. Click it and select Ssh from the the dots menu in the upper right hand corner. Select Connect via SSH. This will open a console window to your instance. Type

 cat >> ~/.ssh/authorized_keys

Be sure there are TWO greater than symbols. Then long press the screen and select Paste. This should paste your private key from JuiceSSH into the window. Press the console window to turn on the extra keyboard. Press Ctrl then ‘d’. Type ‘logout’. We’ll be connecting to the console from JuiceSSH from now on. Press OK to close your session.

You should be on the screen for dev-instance. Scroll to the bottom and expand Compute Engine Details. Long press the entry for External IP and select Copy. Also, write this address down, because we’ll need it later.

Go to JuiceSSH. Slide to Connections and press the plus sign to add a new connection. Under Nickname, type ‘dev instance’. Long press the space for Address and press Paste. This should paste the external IP. Make sure Identity shows ‘dev instance identity’. Hit the check mark in the upper right hand corner to create the connection.

Press the connection to test it. When it asks you to trust the connection, hit OK. You should get a command prompt. Type ‘logout”.

Swipe back to Identities. Long press ‘dev instance identity’. Select Export Private Key, then Copy to Clipboard.

Open DroidEdit (this must be the paid version). Press the drive looking icon to get a file menu. Press New. Long press the empty document and select Paste to paste the private key. Now select Save As from the file menu. Press local, then navigate to /storage/emulated/0. Press the folder plus icon and create a folder named ‘.ssh’ (make sure the folder name starts with a dot). Name the file ‘id_rsa’ and press create.

Go to Settings, then Remote Files. Scroll to the bottom and press Global Private Key Path. Enter ‘/storage/emulated/0/.ssh/id_rsa’. Hit OK. Press Add Remote Server. Server Name should be ‘dev instance’. For Server Address, enter the IP address you wrote down earlier (or go look it up again). For username, enter your Google ID. Check Use Global Private Key. Press Test to check it. If it asks for a passphrase then you’ve done something wrong. Press Save and exit the settings.

And you’re done! You can now program on your phone or tablet. To open files, use DroidEdit. To get a command line, use JuiceSSH. You have to set up the box with your development environment, but once you do, you can program wherever you are, if you just have a phone or tablet and an internet connection.

Austin Code Dojo

May 8, 2012

The All-New, Re-Imagined
Austin Code Dojo
Austin Code Dojo

This Dojo is a place for various forms of programming practice, just as a martial arts dojo is a place for various forms of martial arts practices.  We will have a beginners kata for new coders, students, and managers who used to code; and a more advanced kata, if there’s interest.  We also welcome all other forms of cooperative programming practice.  Solve a programming challenge, hack on an open source project, share some code you’re working on, or just talk about programming stuff in a friendly, unstructured atmosphere.  The point is group practice of all sorts.
Read the rest of this entry »

Pablo’s Fiesta 2011 Notes

October 4, 2011

I went to Pablo’s Fiesta this past weekend.  It was an amazing conference with lots of energy and lots of things to learn.  Here aare some of my notes.  I maay go back and clean them up, or expand something, or just leave them s is.  For now, tho, here they are in raw form:

Read the rest of this entry »

How do you tell a master craftsman?

January 17, 2011

I asked my 12-year old son today what it means to be a craftsman and a master craftsman (of any profession). Then we went on to discuss how you can tell that someone is a master craftsman. I find his answer illuminating:

  1. They should be able to talk their craft and, if you’re not a master yourself, they will lose you and go over your head and talk about things you don’t understand. This was from a child’s view, but I interpret it as “They must be able to talk up their craft”.
  2. They should be able to create a sample on demand. He was thinking about small crafts when he mentioned it, but when we talked about bigger things (like skyscrapers), we decided a small test problem would suffice.
  3. (and this I think is the most important one) They should show you their previous work. They should be able to say, “Look, I created these high quality things in the past, so I can create high quality things for you in the future.”

The book Software Craftsmanship book mentions that to be a master, you must have a masterpiece. To claim that you’re a master, you must be able to show some really good work. So in our discussion of how do you tell a master craftsman, the answer is simple: look at their work.

When you hire an artist (painter, photographer, sculptor, etc.), you look at their portfolio. All artists have one, and it’s how they get work. So, if we’re craftsman, we should have portfolios. Résumés are similar to portfolios, but a) they don’t emphasize actual completed works enough, and b) they’re dry and boring. So maybe we need to start making multimedia portfolios to highlight our abilities as a craftsman. I picture web sites with screen shots, customer testimonials, sample code, links to your blog and other sites, and links to free software or other non-work projects you’ve created.

The key here is, if you want to convince someone that you’re a master craftsman, show them your work and your masterpieces.

Ron “Ziroby” Romero (which has some portfolio elements, but needs to talk about my actual for-pay work)

[cross-posted to the Software Craftmanship list at ]

Austin Style Code Dojo

August 22, 2010

Here in Austin, Texas, we’ve just started weekly dojos. Our dojo style is similar to Randoori, but without pairing (instead of pairs, we’re all one set).  In Randoori terms, we use something similar to Ping Pong.

The flow goes like this: One of the coders writes a failing test.  Lately we’ve discussed the proper API in detail during this step.  I think we’re trying to learn the wisdom of proper test structure.

Once the test fails, that person sits down, and someone else goes to the keyboard.  That person solves the test, does any refactoring, and writes a failing test.  Then they pass the keyboard.

It continues like that, with each person doing “Fix it.  Refactor. Break it.  Pass Keyboard”.

We’ve been working in very small groups of about 3-5.  In that size, everyone sees what’s going on and gets a chance to drive.  We don’t have a projector, which isn’t too bad since the groups are small. (But if someone wants to lend us one, it could be useful.)

We allow discussions and suggestions and comments at any time (not just on a green bar), but the rule is “the person at the keyboard is supreme dictator”.  They can choose to ignore everyone else, or go with whatever suggestion they choose.

We’re still working out the bumps, but we seem to have a good system going.  If you’re in Austin and have a Monday evening free, come join us at Genuine Joe’s Coffeehouse from 8 – 10 pm.

What comes next after TDD katas?

August 16, 2010

What comes next after TDD katas?  UI Testing?  Mocks?  Design Patterns?

I’ve been doing TDD katas and dojos for a while now, and I think I’ve learned the first lesson.  I know the cadence of “break it, fix it, refactor”.  I understand Baby Steps and The Simplest Thing That Could Possible Work.  I get the importance of test choice in guiding the evolution of design.

So what’s my next lesson?  What’s the next thing the katas and dojos can teach me?  Maybe I need to figure out how to test UIs, and how to make testable UIs. The Humble Dialog Box may provide insight and direction there.  A coworker suggested that I need to learn mocks, maybe JMock or RhinoMocks.  I think there’s a kata in there somewhere.  I’ve tried the Publish/Subscribe example from JMock, but that feels too simple, a Hello World of JMock.  What’s a more complex kata that needs mocks to solve?  Or maybe I need to find a way to incorporate Design Patterns into my solutions.  So far I’ve evolved very simple designs, so they haven’t needed Design Patterns.

So what’s the next lesson to learn from code katas?  I know there’s a lesson in there somewhere, and I feel like I’m on the verge of learning it.  What is that lesson?

What Matters in a Dojo?

July 18, 2010

We in the Austin Code Dojo have been doing weekly dojos for four weeks now, in Genuine Joe Coffeehouse in North Austin, Texas. We’ve been learning a lot in these sessions.  Here are some of my notes.  These mostly talk about what matters in a dojo.  What are the important things we’re doing and why are we doing things this way?

Read the rest of this entry »

Cyborg Poker Night

July 12, 2010

Cyborg games: a human and a computer working together to play a game better than either could alone.  There are Cyborg Chess leagues out there, but how about having a Cyborg Poker Night?

Read the rest of this entry »