Oldskooler Ramblings

the unlikely child born of the home computer wars

My experience is killing me

Posted by Trixter on February 2, 2008

I taught myself Pascal in high school. I was not admitted to the AP course my high school was offering due to my overall GPA, so I taught myself to 1. spite the arrogant jerk of a teacher who denied me, and 2. follow along with the course so I could spend time with my friends. I had been taught other languages (LOGO when I was 12, and BASIC when I was 13) so I wasn’t a stranger to programming. What I was a stranger to, however, was discipline.

My early code, which includes my early demo coding, is sloppy. Oh, the code is nice to look at and doesn’t contain spelling errors, but it is incredibly sloppy. Instead of using REP MOVSW to copy memory around, or even Turbo Pascal’s move() procedure, I would copy one array to another byte by byte. Instead of sorting an array by inserting an array set into a sorted binary tree and then copying it back to the array (heapsort), I would loop through the array and swap crap as necessary (bubblesort). Instead of learning how to use pointers, I would try to trick the compiler into giving me multiple data segments (which had the side effect of bloating the executable). Essentially, I lacked experience, insight, and wisdom — and my programs were buggy and slow as a result.

Today, nearly 20 years later, that is not the case. I still program in Turbo Pascal, but I use pointers/heap, objects, inheritance, and especially in-line assembler in places that need it. I understand proper data structures a lot better now (still struggling with tries, but I’ll get it eventually).  I write my code as if I am delivering it to someone else to maintain.  I can’t say that I am ashamed of anything I’ve written past 1997.

I mention all this because the PC Speaker tracker, something that most people bang out in a day, has taken over two weeks and I haven’t written more than 50 lines of code.   What I have done, however, is:

  • Spent 3 hours writing up various design and structure ideas in a notes file
  • Spent 2 hours last night laying in bed trying to visualize object-oriented tracker design while preventing playback performance from turning to shit (answer: a Song object that controls entering and retrieving note/effect data into the song, and a Player object that retrieves song data one row at a time… still thinking about this one, since a single object makes more sense, but would be harder to virtualize playback methods for other output devices)
  • Spent an hour researching the frequency and amplitude characteristics of Vibrato (not just the human voice, but woodwinds and stringed instruments) so I could be sure to make the best use of the effect bits I have available (answer: most pleasing vibrato has a frequency within 4 to 7Hz and amplitude of about 10 cents)
  • Spent an hour revisiting various tracker formats, looking for ideas on how to pack notes+volume+effects into two bytes (answer: 7 bits for note, 3 bits for effect, 3 for effect 1st parm, 3 for effect 2nd parm)

…but no code.  Yet.

I believe it was the demogroup Silents who proclaimed, “If you can’t do it better, why do it at all?”  That is simultaneously democoding’s greatest motto, motivator, and curse.

5 Responses to “My experience is killing me”

  1. Well, technically, all that other stuff, including design, is coding as well. Really, truly coding in the proper sense. A lot of people just choose not to do it, is all.

  2. Wasn’t it Sanity? Oh well, they all rocked anyways.

  3. PulseCode said

    Strange. I had this same conversation just a few hours ago.

    A young woman I know was saying she was very intrigued by the Computer Science/AI program at the local large university. She said she might not have a shot at it because she was having trouble passing Statistics and Calculus I.

    I told her that “most of real computer science is careful thought and planning” and that if she could get through college algebra, she’d be fine.

    So what if you’ve spent seven hours total of careful thought and planning. It appears like you’re ready to write those seven lines of code it came out to.

    And because you took that careful thought and planning, those seven lines will never break. Ever.

    Also, some keywords for you can be “critical bands of hearing” and “psychoacoustics.” Wikipedia doesn’t provide much, but I found tons at the local, outdated library from early 80’s texts.

  4. spoulson said

    I have to agree that my early days of coding included lots of naive implementations, half-working code, no real design plan, etc. It’s no surprise since the mainstream development world in the 90’s was very immature compared to today. There are now tons of books on code design, team strategies, design plans, etc. etc. which all encompass spending hours, nay, days of work before you even open up your code editor. But it all makes sense now today.

    You’re further ahead of the game than you think.

  5. Trixter said

    Tomer: It was indeed Sanity, at the end of Arte. My bad.

    Pulse: I’ll check into those, thanks. I was able to free up one more bit from the data format (every bit counts!) so I might have more flexibility to control the vibrato frequency and amplitude. And you’re right about algebra — that’s all I ever had, and I’ve been able to do most stuff I want to (except 3-D — all my 3-D is self-taught from VLA tutorials and it is rather poor (my 3-D, not the tutorials)). I’ll be working on 3-D next year.

    spoulson: I think the smaller the industry was, the more “one-man wonders” could get away with hot-dogging it because the environments and target audience was smaller and less diverse. The only environments left like that today are for fixed devices, like cell phones (or more specifically, a single phone, since they all run different versions of java/symbian/macos/etc.).

    Jason: You get no comment because I talk to you weekly ;-)

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: