Unit 24 Reading Activities Plus Questions

USA Speaker One:
Dialogue: Procedural Programming is not Rocket Science

Dialogue Between a Senior Programmer and a Junior Programmer working at an aerospace startup in Los Angeles, CA.

CommanderKeen:  Hey kid, how is that new integration going for the booster rocket project?

SpaceCadet:  Huh? What? Okay I guess.

CommanderKeen:  So will it be ready to demo next week as scheduled? The client really thinks this product will take off.

SpaceCadet: Ha ha. I get it, take off. No wait. It’s going terrible. I guess I need some help.

CommanderKeen: Okay, what’s up?

SpaceCadet:  Well, firstly, this statement is always returning the wrong answer. Why?

CommanderKeen:  Okay let me see here. Well for starters, you’re using single equals (=) signs instead of double equals (==) signs. Assignment operators always return the value that is assigned to the left operand.

SpaceCadet:  Oh yeah. Stupid mistake. Thanks. I guess that’s why we still need to employ old people who remember programming the Motorola 6502.

CommanderKeen: The 6502. It was a great chip Don’t laugh... you could write an entire operating system in 2K of Assembly on that baby. No unit tests though.

SpaceCadet:  Gee, no wonder the space shuttle crashed 3 times.

CommanderKeen:  Twice. It only crashed twice. And there was no Motorola 6502 on board. It was an Intel 8086. And we had tests. But it crashed anyway. Twice. I still have nightmares.

SpaceCadet:  Oh spare me the drama! Well anyway, my second problem is that this function you wrote always seems to return false … no matter what parameters I send in! What gives?

CommanderKeen:  Weird, dude. Ummm… did you try to dump the arguments as they come in and output them to a log?

SpaceCadet: Yeah! But they are all null values! I think something is wrong with the compiler. Or maybe we got hacked. Or maybe even… aliens!

CommanderKeen: Yeah, right. Possibly aliens. Or maybe you can’t code. Let me see here… AHA! These input variables are supposed to be strings but you are sending in arrays. That seems to be one of your problems, anyway.

SpaceCadet: Strings? Okay. But how do I get the values I need out the array?

CommanderKeen: You iterate over them and pull them out of the array, duh. It’s not rocket science, you know.

SpaceCadet: Yeah but the Iterator class I want to use is not in this function’s local scope. And I don’t want to pollute the global scope with unnecessary cruft.

CommanderKeen: Iterator Class? Stop being such a Java nerd and use a procedural function like a for loop, or a while loop.

SpaceCadet: Ugh. I hate procedural code. We might as well be using goto statements and COBOL subroutines at this point. Would that make you happy?

CommanderKeen: Arrgghh! I can’t stand young people whining… if you HAVE to use an OO Iterator then just do a callback to the main object’s static function in the global scope. How did you get this job, anyway?

SpaceCadet: What? Me? I thought they brought me in to clean up after you! During my interview they asked me to review your code on the Ballistics project. There was a switch statement with 1,000 lines, each with a tiny variation. We had a good laugh over that one. Ever hear of regular expressions, dude?

CommanderKeen: Listen mate, that code was still in development. It’s easier to tweak things if you can actually read it. Regular Expressions are great, but they are not always very readable or testable. And I’ll have you know, I refactored that code the very next day, as planned. I got it down to 35 lines.

SpaceCadet: Well, at least you’re not being defensive about it.

CommanderKeen:  Okay yes, sarcasm. I recognize it. I am also human and a bit defensive when people criticize my code. But that’s not the point. You need to see the bigger picture. At the end of the day, reality is not an object. It’s just a giant if else statement going on into infinity. That’s how I see it, anyway.

SpaceCadet: Deep. Maybe you should have been a philosopher instead of an aerospace engineer.

CommanderKeen: Hardy har har. Maybe you should learn more C and stop doing everything in Java. OO is shit. It’s 90% boilerplate and 10% action. Inheritance is just a fancy lie to keep Computer Science professors employed. At the end of the day, it wouldn’t hurt you to know a little Assembly language as well! There’s no school like the old school!

SpaceCadet: Yeah, but Java is actually written in C++, and C++ is written in C, and C was originally written in Assembly. So I guess in some ways I already am an assembly language programmer. After all, old man, we are all standing on the shoulders of giants.

CommanderKeen: Wow, I never thought of it that way, kid. Deep. I guess we are both philosophers then.

SpaceCadet: Yeah… and all this coding and philosophizing is making me hungry… let’s go iterate ourselves over some tacos and beer. I’ll treat for helping out with that stupid assignment error.

CommanderKeen: Wow. Thanks. And I’m starving… so that’s an iteration I can really sink my teeth into.

SpaceCadet: ugh (groans at bad pun).

End of Dialogue.

Discussion Questions
  • Research 3 procedural programming terms or concepts not covered in this unit. Write a definition and example sentence similar to the ones in the vocabulary sheet. Explain why these terms/concepts are important to you.
  • Are you more like CommanderKeen or more like SpaceCadet? Are there any alternatives to procedural and object-oriented programming? Functional programming maybe? Do you like tacos and beer? Discuss.

Quiz: Reading Questions

1. SpaceCadet is more skeptical of object-oriented programming and its usefulness than CommanderKeen.
 
 
2. The relationship between CommanderKeen and SpaceCadet is very formal and never resorts to puns.
 
 
3. CommanderKeen thinks SpaceCadet could never be a good philosopher because he can't code Assembly language.
 
 
Please register and/or login to answer these questions.