This past Saturday, I participated in the USC Programming Contest. As you can see here, they used my code as one of the sample solutions. More importantly, as you can see here, I slipped in just two minutes shy of 5th place! I would have gotten to choose a video game as a prize, but since I had to leave early to volunteer at the GLAAD awards, I had someone grab one for me. I realize now that since my taste in video games differs so much from most people's, I probably could have just asked the contest organizers to give me whatever was left, and it would have been something I really liked. Instead, I ended up with an FPS from the Medal of Honor series, which Andy assures me is badly designed, badly coded, and generally just not a good series of games. So I'll probably sell it. It's more about the glory anyway.
In any case, I'm pretty excited, and the GLAAD awards were fun too. We got to watch the show for a few minutes, including seeing Kathy Griffin win for best reality show. The GLAAD people were so grateful for our help, they let us take gift bags with all kinds of swag in them. One paper, one programming project, and three big dance performances away from the end of classes! Then finals, then commencement (playing, not graduating), and then Brazil!
4.28.2008
4.10.2008
Star shapes
So I skipped Philosophy today and went to my CSCI 101 midterm pretty early. Before it started, I was talking to Ashley and Rollerblades Kid (I call him that because I don't know his name, but he uses rollerblades as his primary mode of transportation) about the impending midterm, and computer programming in general. Ashley has no programming experience other than this class, and she was telling me how she had been having trouble on a recent assignment with opening an input file. The relevant code would go something like:
I don't think I ever figured out, based on her description, what she had done wrong, but she said she contacted a friend who works at Google, and her friend had told suggested some sort of modification using character arrays in place of strings. It makes you wonder why, when C++ was designed, they didn't rewrite ifstream::open() to accept strings. I mean, you could just do:
C++ just seems so user-unfriendly after playing around with things like Javascript and Ruby. It would be interesting to learn the history of various languages, because programming languages do grow and evolve like spoken languages, but there are also some clear differences between the way they evolve. In any case, I suppose they use C++ for the 101 class because it's well established, and the people running the department probably aren't familiar with a lot of the newer languages anyway. Plus, C++ forces you to think a little bit about the way the computer deals with data, internally, when you pass things by reference, or try to access an array value that's out of range. I suppose that would be helpful when you get to classes on data structures. (One of many classes, by the way, that I should be taking this fall, but can't because it conflicts with a required physics class.)
However, Ashley is a chemical engineer. Many of the people who take this class are business majors. They're not taking a data structures class, and have no desire to become programmers of any kind. There really ought to be another class for such people. In fact, sometimes I think a few basic programming skills ought to be required of all students. However, I would never wish this particular class upon the student body at large. This other class would be like Physics 100, which I gather is a physics class for people who really don't like physics. It would probably be taught in some version of BASIC, maybe VBA since it's infinitely more useful for many people than any other language. Ideally, it would be something where students can type things in at a command line, rather than having to write, compile, fix compiler errors, recompile, test, fix runtime errors, recompile, etc. There would probably be no need to deal with OOP, but maybe they'd touch on it at the very end.
As it is, no one is going to learn anything from a single class like CSCI 101, especially when we spend more time worrying about things like header files than we do actually writing code. I guess that's the whole point of Ruby. The programmer's job is to write code, and the interpreter takes care of everything else, like memory allocation. Anyway, I have a few problems with the way our class is taught, as well, but I'm sure I'll post about that another day.
What I wanted to post about was actually an exchange with Rollerblades Kid. I was complaining about what I called "bullshit" on the test. I tried to reproduce one from today's test from memory, but Blogger tried to interpret the << operator as the beginning of an HTML tag and it got all messed up. In any case, we have a couple of functions that have a more or less random assortment of +'s, -'s, switch statements, if statements, arguments being passed by value/reference, etc. They don't correspond to anything real at all, it's just arbitrary data manipulation. We have to trace through the program, then write down the output it would generate. Admittedly, these problems are pretty simple, and I guess they're okay for test questions, but it completely goes against the principles of good code writing. You can't use descriptive variable names when your variables do not in fact describe anything.
In any case, Rollerblades Kid didn't seem that concerned with this type of problem, because he was used to them from the AP Computer Science test (which I didn't take), but he and Ashley both objected strongly to "Star shapes" problems. The kind which are supposed to print output like:
or
I must admit that, in modern times, when we have the ability to use "real" graphics, there is no need to learn this particular skill. Yet for some reason, I find it much less like a pointless busywork assignment than the "bullshit" trace problems. I think that's because it solves a real problem. Not real as in real-world. Just real as in, there's an actual problem with a non-trivial solution, and the code is that solution. Yes, it's a problem you may never face, but the same could be said of so many problems you're asked to solve as classwork. Still, it's hard to explain just what it is that, to me, makes Star Shapes problems seem not to be completely worthless. You can actually learn something about good programming style from such problems. But of course, there is absolutely no guarantee that will actually happen.
ifstream fin;
string filename;
/* ... */
cout<<"Please enter filename: "; cin>>filename;
fin.open(filename.c_str());
I don't think I ever figured out, based on her description, what she had done wrong, but she said she contacted a friend who works at Google, and her friend had told suggested some sort of modification using character arrays in place of strings. It makes you wonder why, when C++ was designed, they didn't rewrite ifstream::open() to accept strings. I mean, you could just do:
void ifstream::open(string filename) {
open(filename.c_str());
}
C++ just seems so user-unfriendly after playing around with things like Javascript and Ruby. It would be interesting to learn the history of various languages, because programming languages do grow and evolve like spoken languages, but there are also some clear differences between the way they evolve. In any case, I suppose they use C++ for the 101 class because it's well established, and the people running the department probably aren't familiar with a lot of the newer languages anyway. Plus, C++ forces you to think a little bit about the way the computer deals with data, internally, when you pass things by reference, or try to access an array value that's out of range. I suppose that would be helpful when you get to classes on data structures. (One of many classes, by the way, that I should be taking this fall, but can't because it conflicts with a required physics class.)
However, Ashley is a chemical engineer. Many of the people who take this class are business majors. They're not taking a data structures class, and have no desire to become programmers of any kind. There really ought to be another class for such people. In fact, sometimes I think a few basic programming skills ought to be required of all students. However, I would never wish this particular class upon the student body at large. This other class would be like Physics 100, which I gather is a physics class for people who really don't like physics. It would probably be taught in some version of BASIC, maybe VBA since it's infinitely more useful for many people than any other language. Ideally, it would be something where students can type things in at a command line, rather than having to write, compile, fix compiler errors, recompile, test, fix runtime errors, recompile, etc. There would probably be no need to deal with OOP, but maybe they'd touch on it at the very end.
As it is, no one is going to learn anything from a single class like CSCI 101, especially when we spend more time worrying about things like header files than we do actually writing code. I guess that's the whole point of Ruby. The programmer's job is to write code, and the interpreter takes care of everything else, like memory allocation. Anyway, I have a few problems with the way our class is taught, as well, but I'm sure I'll post about that another day.
What I wanted to post about was actually an exchange with Rollerblades Kid. I was complaining about what I called "bullshit" on the test. I tried to reproduce one from today's test from memory, but Blogger tried to interpret the << operator as the beginning of an HTML tag and it got all messed up. In any case, we have a couple of functions that have a more or less random assortment of +'s, -'s, switch statements, if statements, arguments being passed by value/reference, etc. They don't correspond to anything real at all, it's just arbitrary data manipulation. We have to trace through the program, then write down the output it would generate. Admittedly, these problems are pretty simple, and I guess they're okay for test questions, but it completely goes against the principles of good code writing. You can't use descriptive variable names when your variables do not in fact describe anything.
In any case, Rollerblades Kid didn't seem that concerned with this type of problem, because he was used to them from the AP Computer Science test (which I didn't take), but he and Ashley both objected strongly to "Star shapes" problems. The kind which are supposed to print output like:
*
**
***
****
*****
******
or
*
***
*****
*******
*****
***
*
I must admit that, in modern times, when we have the ability to use "real" graphics, there is no need to learn this particular skill. Yet for some reason, I find it much less like a pointless busywork assignment than the "bullshit" trace problems. I think that's because it solves a real problem. Not real as in real-world. Just real as in, there's an actual problem with a non-trivial solution, and the code is that solution. Yes, it's a problem you may never face, but the same could be said of so many problems you're asked to solve as classwork. Still, it's hard to explain just what it is that, to me, makes Star Shapes problems seem not to be completely worthless. You can actually learn something about good programming style from such problems. But of course, there is absolutely no guarantee that will actually happen.
3.22.2008
Just in case you weren't sure how big a nerd I was: Song Chart
I discovered new meme, via the SDMB, where you take the lyrics of a song, and represent it as some sort of chart or graph. These range from scatterplots to bar graphs, pie charts to flow charts, and represent all kinds of songs. Some of the best ones, in my opinion, are An Analysis of Our Discussion, I don't care too much for money..., Jay-Z's current problems, Test Results, deepness of cuts, class DancingQueen, kung fu fighting.
3.20.2008
Cycles
There is extreme comfort in cyclical patterns. When you know exactly what will happen next because you've seen it before, far from being boring or irritating, it is actually quite comforting. When times are good, we kick back and talk about how great it was the last time around, or about the times when things were a complete disaster, but it's funny now, in retrospect. And no matter what happens at practice, or on the bus, or in an airport, we all know that the cycle will complete itself and everything will be as it was soon enough.
3.07.2008
Alone
I think part of the reason I'm always up late is that I like being alone. When I'm in my room, even though I'm not necessarily doing anything particularly unusual or secretive, I just feel weird that my roommate is there, as if he's watching me. Maybe it's because I'm often watching him, not judging, just curious what he's doing. Usually watching something, but what is he watching? For some reason I often have a desire to know the answer. Out in the living room, late at night after everyone has gone to sleep, is one of the few times I can feel like I'm alone. I keep meaning to spend some time in the "backyard" of Century, particularly since I won't have one next year. Maybe I should also do some studying in one of those closed-off rooms in the library. Or in Doheny somewhere, since Leavey is too bright and everything. I'm just really bad at making plans and sticking to them.
3.04.2008
Pet Peeve
When people mix up dates and days of the week. For example, my next math assignment is due on "Monday, March 11" but March 11 is a Tuesday. How do you fuck this up? Look at a calendar.
Philosophy class is just starting to get interesting again after a couple weeks of being kind of tedious. I think the idea that a complex enough computer can be, at least for all intents and purposes, conscious, is really fascinating.
I'm going to Northrop Grumman on Monday for an interview for a summer internship. It'll be something software-related but I don't really know anything else. I feel like my strategy needs to be to prove that while I don't know a whole lot, I can learn new things really quickly. Also I'm totally a team player.
Philosophy class is just starting to get interesting again after a couple weeks of being kind of tedious. I think the idea that a complex enough computer can be, at least for all intents and purposes, conscious, is really fascinating.
I'm going to Northrop Grumman on Monday for an interview for a summer internship. It'll be something software-related but I don't really know anything else. I feel like my strategy needs to be to prove that while I don't know a whole lot, I can learn new things really quickly. Also I'm totally a team player.
Labels:
Northrop Grumman,
pet peeves,
philosophy,
programming
2.19.2008
Google All-Nighter (or, I am so tired I feel like I'm about to die)
Well, I decided to go ahead and enter the contest, and I'm glad I did because we ended up winning some prizes! We mashed up the data from Citysearch Los Angeles (screen-scraped... shhhhh!) and Google maps, so that users could find restaurants in their area, and find out how much money they would spend in gasoline to drive there from their house, as well as how much CO2 they would be releasing into the atmosphere over the course of the drive, which is how we tied it into the theme of the contest, "Think Green." We ended up with a really good team. Ben pulled the data from Citysearch, I did the mapping stuff, Josh did the HTML, CSS, and processed the data so that I could use it, and David designed some awesome icons to use as map markers. In the end, we won "most useful" and I got a beanbag chair and a sweet Google lava lamp. Now I'm extremely tired, and I still have philosophy homework due in about 13 hours.
2.15.2008
Google All-Nighter
There's a contest this Sunday and Monday, taking advantage of the long weekend, called the Google All-Nighter. You have 24 hours to write an application that uses one of Google's APIs in some way, and fits the theme, which will be announced at the start of the competition. It looks like I'll probably team up with this kid Ben I met, and I'll have to leave in the middle of it for the big ucla game, but it should be pretty fun. All this week, Google and USC UPE have been holding workshops on the various Google APIs and other technologies that may be useful in the contest, like Javascript. On Tuesday, we learned how to use the Google Maps API, so I made a little USC trivia game, where a marker appears, pointing at a building on the USC campus, and the user is supposed to guess the name of the building. I'll post a link once I get it working better. Luckily, a lot of the data I need, including a couple of really nice USC map overlays, already exists, but I didn't realize that when I started writing, so when I get some time, I'm going to rewrite my code to deal with that data, and it will be awesome. Perhaps the hardest part will be making it forgiving, so that if the user misspells something, or adds a tiny bit of extra whitespace, the game will still count it as right. I guess I could make it multiple choice instead. What I really want to do is learn the Google Calendar API since I could probably make things that are actually useful, rather than just fun, with that.
In other news, the white-space-phobically named LetMePracticeAtUSC system could be improved so much by a couple of tiny changes, and I have a feeling that, given several hours to understand the code, I could fix it. It appears I would have to learn ASP, and the source code isn't publically available, AFAIK. Which makes it a lot easier to say that kind of thing, I guess.
In other news, the white-space-phobically named LetMePracticeAtUSC system could be improved so much by a couple of tiny changes, and I have a feeling that, given several hours to understand the code, I could fix it. It appears I would have to learn ASP, and the source code isn't publically available, AFAIK. Which makes it a lot easier to say that kind of thing, I guess.
Subscribe to:
Posts (Atom)