Showing posts with label OOP. Show all posts
Showing posts with label OOP. Show all posts

Game Programming

I just started reading The Black Art of Java Game Programming. And I tell you what. I already have a good feeling about this book. Sure it was written in 1996 when Java 1 just came out. However by chapter 2 we are already learning about animation. Damn.

One thing that struck me as odd was that the authors of the book are young. Or more precisely they are still in school. One of these is an undergrad, and the other a grad. That does not mean they are junior. They seemed to be on the cutting edge of Java right when it came out.

This book does specialize in teaching you how to code network games. The authors believe that object oriented programming is the way to go for creating games. They are going to teach me a lot about AWT (since Swing has not been invented I guess).

Chapter 1 already got me into a lot of Java syntax. It also highly recommends you use arrays instead of lists for speed. Back in 1996, Java ran a lot slower than compiled C or C++. I also learned some basic stuff I was never taught in my Java college class. The import statement allows you to reference classes in packages. However you can still access those classes without an import by using the classes fully qualified name. I did not know that. I am excited about getting into the meat of this book. Who knows? I might be turning out some cool games in no time.
Previously I had written about some benefits of the Java programming language. However some people just love writing code in Java. I have worked with many of these people. They will invent up projects just to write some Java. They work extra hours as long as the app is written in Java. Craziness I tell you.

Well I read up on some reasons why people love Java. One is that there is industry standard certifications you can learn. You can tell whether somebody has a least a little Java knowledge by the certification they possess.

Java is also a popular language. You can always find a Java developer for your project. And you can find some supporters for Java in any group of developers out there. Although I have not personally experienced this, I hear Java gives good conferences.

The Java programming language is easy to learn, especially if you know an object oriented language like C++. It is a general purpose language which can fit many needs. And there is one final reason to love Java that can be summed up in one word - Eclipse. Now I won't say that I love Java just yet. But I am slowly warming up to it. I need to write some enterprise application before the final verdict is in for me.

Once You Go Static...

I am on a 7 Day Quest to write a game in Java. That's a tall order since I am only half way through a college Java class. But I am learning a lot.

For example, I am trying to conserve time due to the quick deadline. Therefore I am putting all my code in one class. This class has a static main function to run the program. Guess what? That function can only call other static functions in this class. That's not too object oriented.

Well perhaps the optimistic way of looking at this is that I have an object. But it is the only one of its kind. There is only one main. So the class with that has main must be a singleton. I am keeping some data in static variables. And I am breaking up functionality into static methods. But it still feels a little clunky.