However, as a Computer Scientist, I've been taught that things need to be as efficient as possible, and anything unnecessary that gets in the way of that has to go. As a researcher, I've learned that strong emotions are, to put it bluntly, something that literally gets in your blood and has to be used up before you can continue whatever it was you were doing before you felt that way. As someone who writes on the internet, I know that people need to hear from you, and that these are the things they want to hear about. And finally, as an artist, I'm supposed to know that the best way to channel these emotions, is by creating something out of them them.
So yesterday, when I became so-furious-with-myself-I-just-could-have-killed-something at discovering what was wrong with the program I was writing, I made this:
A flash course in C++ and Java
- A program with a Memory Leak is one that, the longer it's running, the more space it takes up, even though it tells you it's gotten rid of everything it had made up to that point. Probably the best example of this was Firefox 2: You could create tabs, you could close tabs, but although the closed tab disappeared from view, it stayed in memory, slowing your computer down: the program "told" you it had gotten rid of it, but hadn't deleted it.
- A segmentation fault is the way the operating system (Windows, Linux, etc) has of saying "This program is trying to kill me!" It is therefore considered one of the worst possible errors a program can cause. It is, however, also one of the most common errors in C and its derivatives.
This happens because these programming languages are built around the concept of pointers: if you need anything remotely complicated (such as a simple list), rather than actually having a list, you have a pointer, which is a number telling the program where in the RAM the list actually is. If you don't do them right, you'll end up with a pointer that corresponds to the RAM where the operating system is, and if that happens, and you dare so much as to look at it, you'll get a segmentation fault.
- Java is a programming language designed to be simple (meaning that if you knew how make programs in any other programming language, learning Java should be childsplay, and if you didn't, it should still be easy) and portable (meaning that if you wrote a program for the Mac, it would work under Windows without having to make any changes to it). Java was built around the concept of Object-oriented programs, which means that you can actually use remotely-complicated things like lists without going through all the trouble pointers create.
Probably Java's key innovation is the "garbage collector", which deletes things when the program gets rid of them (can you imagine why?)
- C++ is what happened when people tried to add object-oriented programming to C. And C, in turn, is considered the first modern programming language (in the sense that you could tell the computer "I need the area of a rectangle, multiply this width times this height for me;" rather than having to say "CPU instruction LW on whatever's at position 15, CPU instruction LW on whatever's at position 16, CPU instruction AU, etc.") and was invented by Brian Kernighan and the late Dennis Ritchie (died last month, didn't you know?)
It really was C that allowed computers to spread to where they are today (yes, Computer Science majors are bitching at no one knowing that he died), which is why it seemed like a good idea at the time to simply tag on new ideas to what was already the standard to write computer programs. Despite being object-oriented, C++ uses pointers, which means that, although you can have complicated stuff, you still have to worry about segmentation faults and memory leaks.
So what I did wrong was this: because programming languages don't really know what to do with complex structures when they first show up in the program, programmers are required to write a thing called a "constructor" for them which tells them. In Java, one constructor can perfectly well call another constructor, and Java reads this and says "oh, so this constructor is shorthand for this other one? That's cool, you're making things easy on yourself and the next person who will read this!"
C++ on the other hand, sees a constructor in a constructor and says "Oh, you need to build another thing to tell me what to do? Sure, I can go do that and then come back to this." The result is that when C++ "comes back" to the constructor and sees nothing else, it says "Oh, you aren't going to use it? Let me just put it over here where it'll take up space." (Argh! Memory leak!) And when you try to actually use what-you-think-was-constructed-but-in-reality-nothing-was-done-to-it, you find a "default" pointer. Guess what the default pointer points to? The operating system! Segmentation fault!
And it took me three days to find out!
Originally, I was going to do a regular Facebook wall post. I tried several phrases before coming up with one that was witty and succinct enough to express what I had gone through, but once I did, I realized I needed something between the first part and the second. I also was looking for an emoticon that showed incredulity or frustration.
It was the latter of these things that made me realize that what I needed was an image macro. But of course, none of the well-known image macros were appropriate for what I was trying to express. So I went to Know Your Meme (Disclaimer: I'm not responsible for what you click after clicking that link) and searched for Advice Animals. When I saw the Annoyed Kitty macro, I thought "Perfect! But wait, would I be using it right?" I checked the page. There was only one other example, uploaded by the creator of the blank image macro, and it was nothing but a simple pun. "Everything's fair game! Even more perfect!"
The only thing left was to add the text, but I couldn't find the image in any of the meme-maker sites, nor how to upload it to them. "Sigh, I guess I'll have to do it with Powerpoint" and so I did. It took me 20 minutes (which is a lot longer than I expected) but hey, once on Facebook, it got 2 "likes" within seconds, and relieved my frustration, letting me fix the problem.
What's my major again?