Chapter Seven
We arrive at the VU with five minutes to spare. You'd think they'd know that someone as important as Mistress was coming and prepare more food, but we make do with whatever's left on the counter.
I sit down at what is fast becoming "our" table. Or rather, I try to sit. I yelp at the sudden pain in my ass.
Damned welt
, I think, my arousal peeking its head out from between my legs, a groundhog from its ... mound. There's something indefinably satisfying about being unable to sit comfortably for a day or two following Mistress's ministrations. While painful, it's also intimate, secret. A stark reminder that I am
hers
.
"What's wrong, Sarah?" Beatrix asks innocently, a glint of self-satisfied amusement on her lips.
I scramble to think up a plausible lie for the people behind me to overhear. I sit down again, this time as slowly as I can, putting most of my weight on my right cheek. "Oh, I'm just sore," I say feigning nonchalance, "from falling on my butt while bouldering in the Arboretum. I bruised my leg, pretty badly, too. It's nothing to worry about."
"Oh, I'm sorry to hear about your fall," she replies cordially. I grin at our shared secret.
Considering my aversion to, and general incompetence at, lying, I feel pretty good about my delivery.
I hear the guy behind me snicker softly, and whisper to his friend, "Like we didn't notice the collar around her neck." She returns a muffled giggle. I flush.
Ah well,
I think in resignation.
Next time.
"So," Bea asks, "what more can you tell me about programming that relates to..." She gestures absentmindedly, her finger circling, as if highlighting some invisible area on the table. "...our project?"
"I could explain abstraction in more detail, if you'd like. Nothing else springs to mind at the moment."
"That sounds good," she says, once again genuinely interested. I get the sense that she's interested because her girlfriend is the one talking more than because of the topic's potential to help explore her ability. I am quite alright with that. Flattered, even.
💬
We've discussed abstraction with functions, already. The larger part of abstraction, however, relates to objects and classes.
You can think of an object as a collection of fields. Each field has a name and a value. For example, a person's contact information in your phone is an object. It has fields—first name, last name, phone number, email addresses, street address, and so on—and values for each of those keys: text—what programmers call "strings"—for the names and phone number, an list of strings for the email addresses, and an address object which has its own fields, like street address, city, state, and zip code.
Most modern programming languages have a concept of a "plain old object" or-
🗨️
"Poo!" Beatrix laughs delightedly.
"For better or worse, it's actually POJO—plain old Java object. The 'Java' is silent to everyone save those pitiable Java programmers, tragically soulbound to their crappy language. What I find ridiculous is that Java
Script
, an entirely separate language from Java, is what popularized POJOs, so why didn't we just change what the J stands for?" I shrug.
💬
POJOs use arbitrary strings for the fields' keys, and the values of those fields can be anything: strings; numbers; booleans, also known as bits or flags—true or false, a 1 or a 0; null, which is a value that means "does not have a value"; arrays—a fancy word for lists; other objects; and sometimes functions.
🗨️
"Why are true and false called booleans?" Bea asks when I stop to take a bite of my lunch.
"I'm not sure, actually." I grab my phone and tap out the question to an AI. Scanning the response, I summarize, "Evidently, 'true' and 'false' were invented by George Boole back in the mid-1800s. Before this, the world only knew of 'maybe' and it applied to every statement. Proofs became significantly harder after that, so I'm not sure Ol' Georgie's contribution to history was an improvement."
Bea and Sarah Prime give me simultaneous snorts: Bea's amused, Sarah's derisive.
"But for real," I say, "Boole was the one that realized we could assign 1 to true and 0 to false, something fundamental to computers' ability to function. To this day, most spell checkers will complain if you do not capitalize the B. Drives me nuts."
She smiles and I take another bite of my lukewarm pizza.
💬
While POJOs are very versatile, most of the time we actually want our fields to be predefined. When we're given an object with fields that have known names mapped to known types, we can know for certain that the fields we expect will exist. And this is why we have "classes".
Classes are not objects themselves, but the definition of an object's "shape". The objects that are produced by a class are called instances or instantiations of that class. Not only do classes know what their fields are, but they also include functions that
apply
to their instantiations. These functions are called class methods, and fields of a class are usually known as properties.
Because my field is filled with pedants, I feel compelled to mention that
technically
fields are slightly different from properties, but the terms are often used interchangeably. Also, classes predate POJOs by some forty years, as the implementation of POJOs, themselves, are defined by a class called a Map or Dictionary.
🗨️
"By the way," I say, taking another bite, "if you ever level your pedantry stat to 13—the point at which people anal-retentively insist on distinguishing between fields and properties—I will be forced to break up with you. It would be hard, but loving such a person would be harder."
Beatrix snorts. It's a sound I'm quickly coming to love. "No promises," she says. "However, if I were to achieve that level,
I
would break up with
you
, because I could not suffer such a moron that confuses fields with properties."
"Completely fair. I'm glad we agree that the relationship would be untenable."
I take a swig of my Cherry Pepsi and continue in my role as a stuffy computer science professor.
💬
Here's where abstraction comes in. Oftentimes, we'll want to extend a class for more specific purposes. The canonical example is the Shape class. Shapes—polygons at least—can be defined by a list of xy-coordinates representing the corners of that shape, so we'll add a field we'll call "points" because we're clever like that. Remind me sometime to tell you about my Programming II final.
🗨️
"Tell me about your Programming II final," Bea reminds me immediately.
I roll my eyes. "Okay, so the test asked us to write—on paper—a bunch of functions that calculated different values, and some of those functions called other functions from earlier in the test. Pretty standard stuff. However, the instructions did not specify what our functions should be named. Naturally, I named all of mine after Disney characters. I nearly laughed out loud when I had to make DonaldDuck call MickeyMouse. Miraculously, I still got an A."
She chuckles, but I can tell it's less at my story than that I found it amusing enough to share.
Ah, well. Guess you had to be there. Or had to be me, really.