I had an extraordinarily unpleasant time last week, giving me little energy or incentive for a more technical update. To be honest, I spent most of my time either studying for my final or frenetically playing Bastion and Black Mesa to distract myself from… life. Hey, nothing like an immersive story or raging alien warfare to save me from the burden of self-reflection.
Things are infinitely better now, but I don’t want to leave this blog untended until I actually accomplish something. So that means it’s time for more food! Today, Norma’s Peanut Sauce. This is nothing new; anybody who knows me is aware that I always have a jarful of the stuff on hand. It’s my culinary Old Faithful. It’s been put online before, and I’ve passed it on to many people personally, but I want it never to be forgotten. Because this, my friends, is a meal with an origin story.
With the writing I’ve been churning out recently, I’ve realized that my project list is in dire need of an update. I’ve been plotting my time differently than what this thesis, as it were, would lead you to believe.
Last week, I took advantage of a few precious days off to stretch my SQL chops and start designing a usable database. This presented a couple of challenges, the first of which was simply remembering the syntax for creating tables, columns of a specific type, etc. The second challenge was figuring out the multifaceted approach to maintaining data integrity. This latter piece involves judiciously-placed constraints on the data, ensuring that it will always make sense in a real world scenario (even without an application to interpret it). More on this later.
I’ve talked about the tabular format of a database before (like an Excel spreadsheet, remember?). What I avoided discussing earlier are the inherent limitations in modeling an arbitrary system as a series of tables. Individual entities fit in well — for instance, you can easily define a person by their most salient details: username, first name, last name, email address, etc. — but relationships among entities becomes more difficult. How would you denote that two people, as two separate rows in the Person table, are friends? There’s no place for that sort of detail in the Person table. I mean, sure, you could try to add a “friend” column, but that would take either only 1 entry (thus restricting every person to have only 1 friend) or an amalgam of all the friends’ names, which would be an unparsable blob of text.
No; it’s best to keep entities and relationships separate. So to implement the example above, you would create a a second table, Friends, in which each row contains the names of two people who are friends. This way, every person in the system has exactly one entry in the Person table, but a variable number of rows in the Friends table depending on how, uh, socially active they are. A misanthrope will not appear in any rows in the Friend table, whereas a social butterfly will have many, many entries.
I’m pretty ready to call this blog a failure in terms of keeping me on track of my homespun coding projects. In its defense, the intention was to encourage focus and reflection during the summer months. Now that we’re solidly in the swing of the academic year, my other commitments have tripled, leaving me with little time for personal projects.
However, the thought of this thing languishing here is enough (occasionally) to call my frazzled brain back to action. So it will stay up, and I’ll put what effort I can into it. If nothing else, it gives me reason to explore ideas or technologies that I wouldn’t come across otherwise. In my book, that counts as a good thing.
This time around, I want broach a topic that I have previously failed to describe comprehensibly: algorithms. Most everybody has heard me gripe about the math requirements in my computer science programs, but in all fairness, the Algorithms courses are usually very interesting; the concepts are intriguingly brain-bending (at least until you have to prove them formally). And let’s face it: this is an important subject. If you want to solve a problem correctly and quickly, you need to know how to write a good algorithm. To all of you who have heard me rail against my mathematician torturers, hopefully, this will give you a basic idea of what the course is about.
Let’s start at the beginning: what is an algorithm? Google defines the word as a “process or set of rules to be followed in calculations or other problem-solving operations, esp. by a computer.” But let’s make it even simpler than that. Think of an algorithm as a recipe. You want to make a chocolate cake (yes, of course you do. don’t interrupt.), so you follow a series of steps that tell you what to do when (preheat the oven, mix x quantity of this with y quantity of that, etc), and when those steps are complete, you have a chocolate cake. An algorithm follows the same basic idea: the computer needs to solve a problem (analogous to your lack of cake), so you give it a series of instructions that will tell it how to accomplish that goal. That theoretical (ie. implementation-indepedent) collection of instructions is an algorithm. It’s a recipe, with few extra variables, conditional statements, and loops.
I was going to mention this at the end of the previous post, but that was before it turned into a 2,000 word essay. After all time spent working on the Arts project, I had forgotten what it was like to spend an evening without coding (time off? what’s that?). Around the time we launched Arts and UChicago, I was yearning for another website to hack instead of, say, eating dinner. Or replying to email. Or shopping for groceries.
The site I picked belongs to one of my martial arts clubs — UCTSD: UChicago Tang Soo Do. It was a beast. My fault — we were in such a rush to build it years ago that I hacked it together out of some free online template. Of course, the original template wasn’t intended for our use, so I had to rejigger a lot of it in very messy ways.
Here’s how it looked:
Before anything else, let me give a shout out to my former roommate (yes, the one who cruelly abandoned me to pursue a career in another state — the nerve!) who has set up his own blog: Nerd Out. As is his wont, he promises that he will be “overthinking everything you can be a nerd about.” It currently involves discussion over the finer points of game design and unfortunate PR parodies, and I fully expect it will soon contain his thoughts on artwork in comics, great moments in cinematic history, a symbolic reinterpretation of Schrödinger’s Cat for the internet era, plus whatever he happens to stumble across on Reddit that day. I, personally, find him an excellent and thought-provoking writer, and intend to engage him in witty repartee at every opportunity. Should nerdy things interest you, you should consider doing the same.
And now back to our regularly scheduled program.
First off, let me apologize for the past few weeks of radio silence. I’ve been distracted by the start of the school year, which brings with it new classes, club organization & internal politics, and a number of major website launches. It’s said launches that I’ve been wanting to discuss, but in addition to my generally overbooked schedule, I’ve also had the dickens of a time trying to find the right tone. Though my goal is to point out some design & technical accomplishments (or failures), most of what I say varies between shameless praise and a frustrated griping session. Either approach seems vaguely inappropriate for the very public nature of the sites, so writing about them has become an arduous process.
Ok, the main development cycle for work’s Project of Doom is done. The job certainly isn’t finished, but maybe this means I’ll actually get my weekends to myself again. That hasn’t happened in… a little over a month. Bleh.
Since I’ve lacked the will to face more coding in what little after-hours time I’ve had, here’s something to tide you over: my favorite chocolate ganache. It’s modified from a cake book I grabbed from a closing Borders bookstore (*tear). It’s sinfully dark and bitter with a rounded sweetness from the caramel, and the mint offers a fresh jazz that keeps it from being overly rich and decadent. Use it as a cake icing, an ice cream topping, a cookie dip, or whatever you want. Though I wouldn’t eat it straight, tempting as it is, unless you plan to hate yourself afterwards.