A board game designer's web site

 Copyright Eric Pietrocupo


E-Mail: ericp[AT]lariennalibrary.com


General Information

My Designs

Game Design Knowledge

My Board Games

Object Oriented Development

Page: Guide.ModelingDesign22 - Last Modified : Mon, 29 Sep 14 - 1737 Visits

Object oriented deevlopment is a new way of programming that was introduced with java and C++ at the end of the 90ies. This is a new way to organize the code. Programming started with spaghetti programming which made programs very hard to follow, which eventually evolved to structured programming, and now it has evolved to object oriented programming which is much more decentralized.

The advantage to use such kind of structure allow the code to be easily maintainable. They say the year 2000 bug would have never occurred if programs were already made object oriented. It makes it easier to modify or extend the work done by others. There are many other advantages but I wont pass them in details

What's the idea of talking about this since we will not be coding anything. Well first, they also made object oriented databases in an attempt to replace relational database, but they now seem to work side by side and be used for different purpose. Second, the notion of object is important to understand board game modeling.

Objects

What is an object. There are many definitions out there, let's just say that it is a group of data and code to handle a specific concept. For example, a ship is an object, it contains data like on the relational database. But in addition to that, it will contain pieces of codes to handle the data of the ships. So an object is somewhat autonomous.

My teacher tried to illustrate the class with the following example. He took a piece of paper and wrote my name on it. Then he put in in my shirt pocket. In structured programming, if he wants to know my name he will look in the pocket himself. But if meanwhile, I decide to place his piece of paper in my right pocket, when my teacher will try to get my name from my shirt, and he'll find and empty pocket. This is where the program crash.

On the other hand, in object oriented programming, instead of looking in the pocket by himself, he ask me "What is your name" and I pick the paper from my shirt pocket myself to give it to him. Now If I decide to move my name tag in my right pocket and the teacher ask for my name again, I will be able to give him my pieces of paper because I will know where it has moved.

In summary, each object becomes autonomous and manage his own things. From now on, we will refer game concepts as objects. So ships and fleets are objects.

Another details that we won't touch much is the difference between a class an an object. In programming you define classes but create objects. This is because classes are like a cupcake mold, while objects are the cupcake themselves. You need a mold to make cupcakes, but the mold itself is not a cupcake.

Object Oriented Database

Object Oriented database where created after the language was made but they did not entirely replaced Relational Databases. Because of the way the objects are structured, sometimes it is more convenient to use Relational while other times it's better to use object oriented. Here is an example of how information is organized in each type of database:

People are still programming in object oriented language even if using Relational databases, they use something called Object Relational. This is the technique I used for wizardry legacy. Every time I need to manage data, I use a temporary object that will import it's data from the database, then do some processing on the object and then export the data back to the database.

Relational databases has some advantages especially for searching and sorting information. First because the SQL language is pretty powerful, but also because the data is all contained in a table. So you know where to look for your information. While in object oriented objects are scattered around in memory, so getting a list of objects with specific criteria is not that easy. This is why you need to use Object Oriented Database software to make it easier to find your objects.

But for certain application, like board game as video games, object oriented DB seems to be pretty efficient. Because the idea of object oriented structure is that objects contains objects or link to other objects. Board games piece use that sort of containment structure: For example: A table contain cards, which contains tokens.

But the advantage of Object Oriented structure is polymorphism. In our relational database, fleets could only contain ships because they were designed to do so. Here table and cards can hold any type of object. A card could hold pawn, dice, other cards or even a table (illogical but possible). This is something that cannot be done with relational database.

<< Relational Database | Table of contents | Model, View, Controller applied to board games >>


Powered by PmWiki and the Sinorca skin