F#

December 15, 2006

I tried out Ruby, and it was pretty nice. But I’m excited about something more now; F#.

Beyond the crazy type system, one of the reasons why I gave up OCaml was the lack of libraries, specifically for GUIs. The Graphics module was nice, but small. Since F# is based on the .NET framework, I get OCaml’s beautiful functional-ness, and all the libraries I could ever ask for (I can even use XNA!). I’ll see how it works out.

It’s the weekend now. But I have a 20 page Biology paper to write. Meh…

A Tale of More Than Two Cities

December 10, 2006

I’ve been trying to write something here; really, I have. I have several unfinished drafts saved, staring me in the face. But, since I can’t think of anything worthwhile to say, I figured I’d share a story instead:

As far back as I can remember, I wanted to make video games; I have pictures that I drew in first grade of a stick figure with a pocket protector holding a computer monitor. But it was only recently that I learned these game-making magicians trained and lived in a magical kingdom known as Programmerlot. I decided that if I was ever going to fulfill my life’s goal of becoming a game programmer, I would have to journey to this fabled land. But when I set out, I had no idea what to expect.

My first stop was BASIC Village. It seemed as though a lot of upcoming young magicians were getting their start here, so I settled down. For a while, times were good. I came to know my TI-83 calculator inside and out. I was immensely proud of myself for being able to display messages on the screen; I could even ask the user for a number, and add another number to it! But I soon became disenchanted. There was little I could do except write small math programs with my beloved BASIC. I saw a few of my peers writing games of Pong, but I wanted more. I wanted to create the games people buy in stores, not trivial calculator applications. I decided it was time to move on to something new.

While traveling the countryside of Google, I heard of a new place: Assembly Town. Apparently, Assembly was an extremely awesome language; I wanted to make awesome games, so I rented an apartment for cheap and got to work.

I never successfully completed one Assembly program. From day one, I was completely lost. I was trying to take in strange new concepts like “Assembler”, “Linker”, and “Command Line”, and it was just too much. At this point, I thought it was time to give up; I simply wasn’t cut out to be a magician. But during my studies one day, I came across a reference to a slightly more distant locale: C City. I packed my bags that night, and arrived in C the next morning.

Coming from Assembly, C was a breath of fresh air. I could insert words in my code now; complete words, readable by humans! Still, life was not without hardships; gcc on Windows was a pain to install for a novice like me. However, I quickly conquered the basics, and I then felt I was ready to take on my biggest challenge yet: Pong. Real, live, graphical, Pong. It wasn’t easy. DirectX was difficult to learn, and even more difficult to understand. My first attempt was little more than the modification of some code from a book. But in the end, it compiled. And I was able to move the paddle back and forth, and hit the ball with it. And I was happy. I thought I had the world at my fingertips. But this is not the end of our story.

I continued to work off this code to create a small game where you controlled a space ship, trying to shoot an alien (although it looked more like a Christmas tree, since I can’t draw to save my life). After some problems, it worked. More happiness. But I could sense change in the air. I was constantly reading about a district of C City I had never heard of, called C++ Square. Although many were praising it for its “Object-Oriented Programming”, I saw no reason to move yet again. I was happy with C; I had made two games. But, curiosity eventually got the best of me, and I was off.

At first, I couldn’t see what made C++ so different. It was just C, with these newfangled “Classes” and “Objects”. But when I began to study the language in earnest, I saw what made it different, and I learned the OO Ways. However, I didn’t do anything significant with C++ on my first visit to its home; by chance, I heard of a new, rather out of the way place, called Python Land. I could see it on my map, but it was far off. Still, curiosity once again got the best of me, and I was traveling once more.

I found Python Land to be very quaint. I thought it was the coolest thing in the world that you didn’t have to specify a variable’s type when you created it. For the first time since BASIC Village, I found programming to be fun. With C and C++, I always loved the problem-solving, and I liked the end result, but the process of writing the code itself was not all that enjoyable; in Python, it was. But even after experimenting a little with PyGame, I didn’t think Python would be suitable for “real work”, so I went back to C++.

It was then I made my first complete game, from start to finish, on my own: Tetris. I was pretty proud of the fact that it was in C++. Although it wasn’t really C++; it was just C with the “struct” keyword replaced with “class”. For some reason, I was having trouble applying the OO Ways to my programs. I understood all the concepts well; I knew the difference between a class and an object, and I knew about encapsulation and polymorphism; but I just couldn’t bring it together.

So, I once again began roaming the countryside, in search of someone who could teach me proper OO techniques. Being the fair-minded person I am, I wanted to find out what was wrong with the OO paradigm, in addition to what was good about it. That’s how I stumbled on Paul Graham’s essays [1].

While checking out the links in the Criticism section of Wikipedia’s OOP page, I came to Paul Graham’s website. In case you didn’t know, Paul Graham is a Lisp programmer; he’s also a very good persuasive writer. Before then, I had heard of the magical Lisp Wonderland, but I had never had the impulse to actually learn about it; but after hearing Graham make statements such as “Lisp is the most powerful programming language” and “Java programmers are unlikely to be as smart as Python programmers”, I decided to check it out.

My excursion into Lisp’s territory was fairly short. I thought it had some novel ideas- code is data, blah blah blah- but again, it was nothing to use for “serious work”, especially since it didn’t have a free GUI that didn’t require 50 other libraries. The Dr. Scheme implementation of Scheme actually has a fairly nice GUI, but I never did much with it.

Still, I liked the Lisp language; a lot. I especially liked the parenthesis surrounding every statement (I think I’m alone in that sentiment). But the coolest thing was that it gave the same “fun” feeling as Python. I wondered if Paul Graham was right: that there are these magical “smart languages” (Lisp, Python, Ruby) that are leagues more powerful and interesting than “dumb languages” (C++, C#, Java). I think it was there I began my quest for the One True Language; something fun, easy to use, and powerful; and it needs a GUI (I’m still trying to become a game-making magician, remember?).

I decided the best place to start my search was with Java. If it really wasn’t a “smart language”, I wanted to experience first-hand why it wasn’t. When I got to the Kingdom of Java, I found it to be the largest city in all of Programmerlot. There are people all over the place, from veterans working on enterprise applications, to newbies asking for help on their CS homework.

My experiences with Java were rather good. Within a few days of learning, I was able to create a Pong Applet, and Swing GUIs. I always wondered why the long-standing citizens in the Kingdom professed it was so hard to learn.

I actually did get a minimal “fun” feeling from Java, mainly because it was so easy to quickly put something together. But it wasn’t the same fun I got from Python and Lisp. You see, while programming in Java was easy, it was also boring; extremely so. The language was so simple, I began to look at it as merely an interface to its standard library, rather than something you expressed your own ideas in. Looking for an excuse to try something new, I heard of a new version of Managed DirectX, called XNA, being released in the City of C#.

C# was easy to pick up, since I was fresh from my Java adventures, and XNA was like having a rock removed from my face after all that time working with plain old Win32 and DirectX. In fact, I’m working on a small RPG in C# and XNA right now.

Shortly after that, I stumbled upon Steve Yegge’s blog [2], where I found high praise of a language I had nary heard of before: OCaml. It was functional; which initially turned me off, since I had already had such a bad experience with Haskell; but it could also create Win32 applications, which piqued my interest again.

Entering OCamlot (which had a population of about five people) was the defining moment in my trip through Programmerlot, I think. It was then I finally began to understand the “smart language vs. dumb language” rhetoric I had been blindly spewing out for the past few months. Now, I’m not one of those language snobs who believes their language is better than everyone else’s; there are times when I would use Java, because it’s well suited for some problems. But I can see how some languages are much more well designed than others. Coding in OCaml was fun; truly fun through the whole process. My code was three times more concise than it was in Java, and it was more clever, too. I thought I had found the One True Language; but alas, I had not.

OCaml’s static type system drove me up the wall after a while. Seriously, where else do you get error messages like “This expression has type Point but here is used with type Point”? Maybe I just didn’t learn enough of it to get past that stage of frustration. I’d still rank it among my favorite languages, if not my most favorite, but I couldn’t imagine doing a huge project in it. Thus, my quest for peace continues.

So, what’s next? After my C# RPG is done, I’d love to get into 3D graphics with C++ and DirectX. But if I just stick with those languages, I’ll stop learning; and when you stop learning, you end up working on a business application written in Java. Thus, I have to keep moving on over the horizon, searching for the One True Language; but what does that horizon hold?

Much of the Great Northern Functional territory remains uncharted; exotic languages like Erlang, Maple, and Dylan await. To the west lie web languages and other oddities: SQL, ASP, and maybe a bit of Prolog can be found there. There is a tropical island in the deep south where people speak Smalltalk. I have also heard of a prosperous country not too far from Python Land where the Rubyists make their home; I believe that will be my next stop. But I have little hope that any of these languages will solve my problem. I am not an expert with any of the languages I have come across, but I know enough to know that they are not perfect. Maybe no language is.

All I wanted to do was be a magician; I had no idea it would be so complicated. Overall, the future looks bleak; but if there’s one thing I’ve learned in my travels through Programmerlot, it’s that the future holds many surprises, and things are never as bad as they seem.

[1]: Paul Graham’s website can be found at www.paulgraham.com
[2]: The archives of Steve’s blog can be found here, while his latest works are stored here

Something that’s been really bugging me about Firefox

December 5, 2006

After typing in an address, holding the shift key and pressing enter will take you to that address, but will ppend .net to it. I often accidentally strike the shift key when I go to press enter, so I often wind up with something like “www.somename.com.net”. And it’s really starting to annoy me. Just had to get that off my chest.

So, you want to make a MMORPG?

December 3, 2006

This post was written in response to the many gazillions of questions along the lines of “how do I make a MMORPG?” that appear on programming forums across the internet every day. Rather than rehashing the same old disscussion, I figured I’d write a catch-all post and just link people to that. Quick summary: if you have no experince, start with smaller games, and work your way up. Making a MMORPG without any prior knowledge is very difficult.

Q: Hi, I’m 13 years old, and I want to make a MMORPG like World of Warcraft.

A: Good for you. So does everyone else in the world.

Q: Can you give me instructions? I don’t have any game development experience.

A: No.

Q: Why not?

A: Someone with no game development experience could never complete a WoW-quality MMORPG. It just can’t be done. Those games are made by huge teams of highly paid artists and programmers who have had years of experience at doing their job. Creating a game, especially a large one, is not as easy as you might think. Sorry, but you’re just out of luck.

Q: But me and my friends have already started! We have a great idea! We even made a design document! There’s no way we can fail!

A: Allow me to reiterate. You need huge teams with years of experience to make a MMORPG. Years. Even if your idea is great, who’s going to implement it?

Q: Won’t I be able to find someone to make it for me?

A: Not without a lot of money you won’t.

Q: I know your type. You’re one of those jerks who is always putting people down, telling them that they can’t follow their dreams. Well, I’ll prove you wrong. I’m going to make a MMORPG anyway!

A: Please do. It will let me know that we have some talented young programmers out there. Let me know when it’s finnished so I can link to it.

Q: Alright, I will! Um… any more pointers?

A: You need to learn how to program. My advice is to start by learning the Python programming language. Study programming for a few years, inside school and outside. Start by learning the very basics; make a text-based game or two. Then make small games like Pong or Tetris. Keep working your way up, and one day you might get the chance to work on a MMORPG.

Q: Someone told me to start proramming by learning C++. Isn’t that what professionals use?

A: In most cases, yes, but that doesn’t mean you should. If you can learn C++, great; if not, start with Python. In order to become a good programmer, you’ll need to learn a wide variety of programming languages, but it’s best to start off with something simple; C++ is the opposite of simple.

Q: Hey, I just made a game of Tic-Tac-Toe! Can I make a MMORPG now?

A: Again: years.

Q: What gives you the authority to write this?

A: I’ve been down the “I will make a 1337 MMO and become rich and prove all these people wrong HAHAHA!” path. It doesn’t work. Start small- very small- and work up. You’ll get there one day.

So…

November 30, 2006

I haven’t posted in a while.  I haven’t really had anything to say.  Here’s a quick list of random thoughts:

I just repartitioned my hard drive with Partition Magic.  No data was lost.  Woot.

I’ve been playing around with Haskell lately, but I went back to OCaml.  I just like OCaml more.

It would be really cool if someone had the last name “Blog”.  I remember seeing the credits in a TV show the other night, and someone’s last name was Blog.  If my last name was Blog, I’d feel really special.

I think I’m going to write something on why I don’t have a MySpace.  Everyone at my school is shocked that I don’t have one, but personally, I just think it’s stupid.

I really wish I would stop getting alerts from my system tray that Java is ready to be updated.

Rube Goldberg

November 25, 2006

This is another crazy conspiracy theory. It’s about OCaml rather than Java technology, but it’s still pretty crazy.

OK, so I was playing around with the char_of_int function in the OCaml interpreter. Below is a snippet of the session:


char_of_int 150;;
-: char = 'Rube Goldberg'

However, that’s not what it originally said. The single quotes originally contained a small rectangular character. I copy it, and when I pasted it to the next line, it came out as “Rube Goldberg”, and the character above it turned into “Rube Goldberg” as well. I am not making this up. I can only assume Rube Goldberg is the head of the INRIA, and this is all part of his sadistic plot to take over the world. So far, I have been unable to replicate this behavior. These are the exact steps:

1) Type “char_of_int 3;;” and press Enter.

2) Type “char_of_int 150;;” and press Enter.

3) Copy the rectangular character that is output, and paste it to the next input line. You’ll see it come out as “Rube Goldberg”, and the rectangle above will change to “Rube Goldberg” as well.

Again, this has only happened once, but if anyone else can get it to work, I’d appreciate hearing about it.

OCaml Rocks your Socks

November 22, 2006

Edit: Sorry about the terrible code formatting. The Editor doesn’t seem to let me put HTML where I want it. I’ll try to fix it later.

When I wrote last night’s sort-of-rant, I was thinking about OCaml. I have enough languages installed on my computer as it is, but I decided to try out OCaml for two reasons:

1) Steve Yegge likes it. If it’s good enough for Steve, then it’s good enough for me.

2) Microsoft stole it. If it’s good enough for Microsoft, it’s good enough for me.

A few minutes after beginning to toy around in the interpreter, I was afraid it was going to be just like Haskell, since their syntaxes are so similar. Haskell hurt my head. A lot. But OCaml hasn’t hurt my head; at least, not yet. In fact, I’m growing to really like OCaml. Here are a few of the reasons why:

1) It’s not impractical like Haskell or Lisp. Haskell forces you to write in a functional style, and Lisp has very few libraries for doing things like creating GUIs. OCaml has support for several paradigms, including functional, imperative, and object-oriented programming, and it has libraries for handling GUIs, creating threads, and working with files, among other things.

2) It produces concise code. This:

int factorial (int n)
{

if (n == 0)

{

return 1;

}

else

{

return (n * factorial (n-1));

}
}

is reduced to this:

let rec factorial n =

if(n = 0) then 1 else n * factorial (n – 1);;

3) It has a lot of Really Cool Features (RCFs), like function currying, nested functions, and pattern matching.

I’m probably going to write a quick lintroduction to the language here soon, since tutorials for it seem to be lacking. Check back soon.

Programming Language Promiscuity

November 21, 2006

A few factors keep me from getting programming work done. Starting with the most severe, they are as follows:

1) The habbit of bouncing from language to language like a rabbit on crack.

2) The fact that talking about programming is slightly more fun than programming itself.

3) The tendancy to form project ideas around whatever language I think is “cool” at the moment, rather than coming up with an idea and then choosing the language that would best suite it.

4) School.

5) Video games (Okami at the moment, soon to be FF III).

6) Necessary human functions, like eating, sleeping, etc.

#1 is the factor that I’ll be talking about in this entry.

Whenever I hear about a new language, I get the irrestible urge to try it out. Whenver I see a phrase in a blog to the effect of “well, I’ve been toying with language x recently, and…”, I instantly go to the language’s website to download the compiler/interpreter. While I watch the progress bar on the download fill up, I think “oh boy oh boy this is going to be great I’m going to learn a cool new language and I’ll probably love it and it will solve all my problems real easy and it’ll be great and I’ll probably love this language forever and I’ll tell all my friends about it and I’ll put its logos on my website and I’m going to become this language’s biggest advocate and this is going to be great my whole life is going to be changed because of language x and OH MY GOSH YAY!!!!!11111112”.

Wow, I didn’t mean to type all of that. But that is an accurate description of what goes through my head.

Ten minutes after installing the language and writing a few simple programs, I get bored with it, and go right back to the interweb to see what Paul Graham has written recently.

I’m not really sure where I’m going with this. Does anyone else have this problem? Maybe I could fix this by fixing #3: actually come up with an idea and see it through to the end. The last major project I finnished was a Tetris clone, and that was back in July (I also wrote a little Pong game to get aquainted with Java GUIs, but I don’t count that as major). I’m working on a super-mini RPG in C# right now; I’ll go back to that. Expect updates.

The Grand Theory on how Sun Microsystems is Killing the Human Race

November 21, 2006

Java technology- nay, the entire Sun corporation- is a conspiracy by aliens to annihilate life on Earth as we know it. Allow me to explain:

On the offical Sun Java Forum, members compete for points known as Duke Dollars (named after the truely awesome Java mascot Duke. He’s in on the conspiracy too). When someone posts a new question, that person can choose to assign Duke Dollars to the question. When another person answers their question, they award that person the Duke Dollars.

For a while, the system worked smoothly. If I recall correctly, no one else could see how many Duke Dollars you had. It was simply a private indicator of how helpful you were. But that all changed yesterday.

Yesterday, Sun implemented the Duke Stars program. Now, each member has a star next to their name- with bronze being the lowest ranking, then silver, gold, and platinum- indicating how many Duke Dollars they have. You may not think this is a bad thing. But it is.

You see, there are two major groups of people on the Sun forums: those who ask questions, and those who answer them. Most of the people who ask questions are high school or college CS students who are asking for help on their homework assignments, without having done much, or any, work to have solved the problem themselves. Typically, those who answer questions won’t give out answers to homework assignments; after all, how will people learn anything if we just give them the answers?

However, there is a major new incentive to answer questions: Duke Dollars. They existed before, but now everyone can see how many Duke Dollars you have. People want other people to know how helpful they are. This means that the value of Dukes has shot way up, and anyone who assigns Dukes to their question will probably get an answer ASAP. Students know this, and they’re already getting more homework answers.

So, what will happen if CS students aren’t made to work? The software industry will suffer. We will have tons of bad programmers in the work force, or maybe no programmers at all. Critical software that runs things like health care systems or automobiles will become broken. Without programmers, our society will eventually collapse.

This has been Sun’s plan all along. Make Java a standard so everyone uses it for their courses, give students a place to go for free answers, and flood the industry with bad programmers and computer illiterates. It’s such an elaborate scheme, they didn’t think anyone would figure it out. But you and me, we can make a difference.

Join the Sun forums. Tell kids that they need to do their own work. Get Java out of schools. Do something. Quick, before it’s too late.

My Thoughts on the PlayStation 3 Launch

November 19, 2006

I don’t understand how people could wait for weaks to get a game console. Yes, weeks; they’ve been out there since the beginning of November. Don’t get me wrong; I’m a gamer too. I know how exciting a product launch can be, especially when said product is a new console.  But I’d never buy it on launch day.  I’d wait for a month or two, then walk into the store and get it with no hassle, and no risk of getting shot or mauled.

At least there won’t be a line for the Wii.  These people don’t know what they’ll be missing.