Jump to content

DRAGONMOUNT

A WHEEL OF TIME COMMUNITY

zomg (tech-talk)


Zyrshnikashnu

Recommended Posts

Who remembers Asha'man Empires? (The version on that site is very old. Ignore it.)

 

It was an online strategy game I was writing years and years ago, when I was new to the whole web programming thing. It's some of the first PHP I ever wrote.

 

Yesterday, I looked at what source I had so far.

 

It was horrible.

 

 

(Database lingo to follow. If you don't care about databases, you may want to stop reading.)

 

To give some of you an idea, at one point I had to pull several fields from a table, all on the same row. This is a standard procedure, usually solved by telling the server, "I want fields A, B, and C from this table of data, but only give me the ones where field D is zero" or something like that. In SQL...

SELECT name, email, status FROM users WHERE id = 12;

This is among the most basic of queries you can make to a database. If you know even a little bit about SQL, you can figure that out.

 

I, on the other hand, clearly knew nothing. Instead of that one query, I would use three:

SELECT name FROM users WHERE id = 12;
SELECT email FROM users WHERE id = 12;
SELECT status FROM users WHERE id = 12;

Now, I planned to make a large-scale game with practices like this. At any given time, dozens of users could have been on. So, rather than, say, six database queries per page request per user, I'd wind up with sixty database queries per page request per user. Only a linear growth, yes, but still far more queries than I needed to make.

 

The emerging computer scientist in me is disgusted.

 

 

And I haven't even touched on how ugly the site is! :P

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...