Joy of unit testing

(From about 2 weeks ago, late at night)

I was just vaguely napping and realized I was still thinking in my sleep about the php code I had just been writing. Though I barely even know php at all, it wasn’t that hard to just guess at it because it was mostly like Perl. My thinking in Perl is a bit stuck. Today with Oblomovka I wrote out what I wanted my program to do, then he started writing tests. At first I didn’t get it that the tests didn’t run actually in the program. My thinking was inside out. I thought I’d run a bit of code, then run something that tested if it did it right, or that error/die statements would be sprinkled around. But as I saw what Oblomovka was doing it was like a light went on and I felt like everything I’ve written has been incredibly sloppy! Works fine, tells you if it doesn’t work, but was like wearing shoes instead of making a road. Or the other way around.

It was really fun to write the very simple tests and then figure out how to send it the simplest possible thing to fake it out so that the tests would pass. So for example if you were writing a simulated ball game, you would not start by simulating a baseball game. Instead, you might vaguely sketch out what happens in a game. Then, you’d write a test that goes like, “Does a ball exist? If not, FAIL.” You would watch it fail. It’s supposed to. Then think of the smallest thing it needs to do to pass. Your program would then merely need to go, “Oh hai. I’m a baseball” and the test would pass. You’d write another test that goes, “Is there a bat?” and “Is a baseball coming at my bat?” As you write fake bats, balls, and ball-coming-at-you actions, the baseball game starts to take shape. All the tests have to keep passing. The structure of how to build it becomes more clear, in a weird way. This isn’t quite the right analogy. I can’t quite get into the way of thinking and end up just hacking quickly on ahead. But for a little while, I felt the rightness of this way of doing things.

Technorati Tags: , , ,

Related posts:

Talking with the city about ramps

After I sent a bit of an email blast to everyone in the city government I could think of who might be able to help, I got a super nice response. A city technician, Charlie, called me and left voicemail; I called him back and we met half an hour later outside my house. There could not be a nicer, more competent-seeming person. It was very reassuring.

We walked around and looked at the main obstacles to places I go often: the grocery store, the school, and my path to the train station. With 6-7 curb cuts, it would be workable. There was a large locust tree in the way of one ramp location. Charlie, who is also something of an arborist, said that the tree was around 5 years from dying anyway; it is split in a way that means a main branch should come off, and its core is dead. So it might should be cut down anyway. Still, losing a tree makes me sad.

I learned many other interesting things from Charlie as we walked (and rolled) the route and discussed tangential things like the city’s history, street names, clues to former land use and the evolution of streetscapes.

The curb cuts cost the city about $5000 each.

As of last year, the standard curb ramp is a wide diagonal, heading both directions. It has texture to warn visually impaired people that a slope is about to happen. It has those yellow bumps at the edge to warn that you’re about to be in the street. The texture also directs where the diagonal is, so you know not to go out into the exact middle of both intersections, but to choose one or the other. Behind the ramp, across the sidewalk, there will also be a sort of raised back curb, which signals the sidewalk’s edge.

I found some excellent guidelines here on the Department of Transportation federal government site. It’s especially good at explaining the different needs of different people; how power vs. manual wheelchairs have conflicting requirements that also conflict with cane/walker/crutch users and visually impaired people. It has a very cool table of best practices for access. Also, the illustrations of dismayed wheelchair users in section 7.3.7, Change of grade, are quite funny.

The streets Charlie and I looked at are fairly old. It is not a “Centennial” neighborhood quite, but I think more like the teens… My own house I believe was started in 1910. The many resurfacings since then mean that the street is raised in the middle from the curb and gutter, so the ramp construction will take the crown and gutter slope into account.

Charlie mentioned my other request for a stop sign, and said that Traffic and Engineering might take a while with that, so he would have his crew construct a base for it in the ramp, and put a cone over the base. If the stop sign doesn’t happen, they grind down the base and fill it in. If they don’t do that prep work, then someone will “drill a hole in my ramp” and possibly weaken it structurally.

Not to mention Charlie’s other mission of training rednecks not to do u-turns on the curb ramps and not to use them as driveways. The weight and the sheering force does major structural damage! Now you know. It would never occur to me to do a U-turn onto a sidewalk. I did not ask about skateboarders…

The city contracts its sidewalk construction and repair out to a company called J & J. They have to have a certain amount of work to be done before the contractors will come and do it all in a batch. This had a particular name, but I have forgotten it. The contractors are in the neighborhood now, working, so might be able to do this; but might need to schedule it in October instead and to do that Charlie will likely have to find another batch of work to go with it. I am sure there’s no shortage of things to be done.

The money for this comes from a pool of money for ADA improvements that the federal government gives to the city each year. I don’t know how much there is total. Charlie described a project he was on that provided sidewalk access from Edgewood Road all the way to the Senior Center on Roosevelt. Not bad!

The alleys on my block also limit access to the main road behind our block, Jefferson. It is actually quite funny because there are very nice ramps and crosswalks all on Jefferson, but they lead you up onto a section of sidewalk that ends in a giant curb at the alleyway. I am not going to worry too much about the alleys. If I want to use the mailbox at that corner, I will drive to it or go across the street and down the block and across the street again.

Charlie and I also discussed the driveway slope. That is something I could pay half of and the city would pay half, to fix. For now I am thinking to just put a big heavy board there as a temporary fix so that my car will stop bottoming out and so that I can get down the driveway in my wheelchair.

Then we went into discussion of trees and City Trees. The city used to recommend crepe myrtles, and then banned them, and now doesn’t mind them again, but since they push up the sidewalks the same as a big shade tree, they recommend you just go with the big shade tree. It helps houses be more energy efficient and it makes the city nicer for everyone. Big trees need 6 feet of planting space between the curb and sidewalk, and medium ones need 5. Our planting strip is narrow; about 2.5 feet. So, on streets like ours, the city does the 50/50 cost split, creates a sort of bump or bend in the sidewalk, moving the sidewalk closer up towards the house. The right of way is actually much greater than most people think, so, about 5 feet into our front yard is actually public land or right-of-way.

That was about 1 hour of my morning, and I took another hour to write it up. Time well spent.

I am very relieved that I don’t have to fight harder for this. Also, I was grateful not to have to explain myself, the ADA, my medical status, or anything else, to Charlie, who took my right to use the public sidewalks as a given. What a great public employee and great person to work with.

Technorati Tags: , ,

Related posts:

Pissed off cyborg in your face


New!
Originally uploaded by cdent

If this round of wheelchair use keeps for for much longer, then finally everyone in the known universe will have gone through their awkward reactions and I can stop having the most annoying boring conversation ever.

Here is something I wrote for WisCon. If only I could have forced all 1037 people there to read it.

A quick lesson in wheelchair manners:

1) Please ask before touching!
2) That goes for pushing the chair especially.
3) My lap is not your shelf.
4) I’ll ask if I need direct help.
5) “Would you like help” is fine, good manners; “Here let me do that for you” while doing it already — is not. I value my abilities.
6) Walking beside me is nicer than walking behind me; then I can see you.
7) Coming down to my level for conversation is extra polite, thanks! Looming over me especially from behind… not so much.
8) Think of the chair as an extension of my body or personal space, treat it as such.
9) Thanks for unblocking my path so I don’t get trapped, much appreciated. Move your backpack out of the aisle.
10) Really, please don’t move the chair! I wouldn’t pick you up and move you, would I?
11) Please don’t bump it either, it’s annoying and often it hurts me.
12) Let’s talk about science fiction and feminism instead of wheelchairs and disability and pain, once we get past introductory chit chat.
13) No I don’t really want to listen to your process your feelings and fears about disability unless we’re already friends.
14) No I don’t want your medical advice unless I ask for it.
15) If I ran over your toes, my bad, I’m so sorry
16) I’m not here to satisfy the whims of your curiosity. Why do you need to know? Why do you want to know? Could you possibly put off finding out till you know me better?

Clip and save!

Because that was the polite part. Here is the rude angry in your face part:

What ‘s wrong with you? Why are you in the chair? Oh my god WHAT HAPPENED TO YOU? Is this temporary? Is this permanent? Did you break your leg? Did you go to the doctor? Did you get an MRI? What exactly is wrong? You sure get around well, how did you learn? When will you be out of the chair? Are you sure? I’m so sorry! Are you in pain? Are you going to die? You sure look comfortable. Wow lucky you, you get to sit down while we’re all standing in line. OMG are you OKAY?

(Answers: Nothing, what the hell is wrong with YOU? So that I can get around. I was born and then grew up, what happened to you? I don’t know. I don’t know. No, but I can tell you really really really want me to have broken my leg. What do you think, do you think I went to a doctor, but that’s not what you’re asking, you’re asking what my prognosis is. Do you want to help diagnose me? I don’t know but I have some possibilities which we could discuss exhaustively OR we could have some other more interesting conversation. I learned last time I was crippled which was around 93-98 with varying degrees of disability, oh that surprises you, check your assumptions at the door; oh by the way you seem to get around really well for someone with their head up their own ass. I don’t know. I don’t know. I’m sorry too, for your mama for raising someone so rude and boring, I’d rather be crippled than be a drip like you. Yes I am quite likely in a considerable amount of pain, and you know what, I also was in varying degrees of physical pain when you saw me walking around, why must you bring it up? Yes I’m going to die and so are we all and so are you, especially, about 5 seconds from now. If you want to try being as comfortable as I am I can beat you up right now and stab some daggers into your back. Uh yeah lucky me I have run out of sarcasm to even throw at this one, o falsely jocular person. Yeah, are YOU okay?

Hey you know what, world? Let’s have a conversation about your painful struggle with your own hemorrhoids. Because apparently your head is up your ass. That must be really painful for you and I really admire how you deal with the challenge!

Every time I go out in public in a crowd I get totally fed up. I’m really sick of being the crippled girl. It was a relief last night to scoot over to the couch for a bit and have the pressure off me, the pressure of being looked at and stuck in that box in people’s minds.

You can see their faces as they think “Wow… that could happen to me.”

Pain is annoying and tiring and distracting, and I have very much valued the times it goes away (rare) and that it doesn’t interfere with physical function too much. However, it is not new. It is also not the end of the world.

Limited mobility is annoying and distracting and inconvenient and sometimes isolating or frustrating but you know what… the worst part of it for me so far is the way it makes people act like dumbasses.

I’m off to write a really dumb Mary Sue-ish science fiction story where everyone slathers pity on the people who can’t interface with the cyborg telepathic alien hovercraft symbionts and are doomed to dreary, unassisted, bipedal motion.

Related posts: