1998Q2/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: [MUD&#45;Dev] Re: Databases: was Re: skill system -->
<!--X-From-R13: "Xba O. Znzoreg" <wyflfvapNvk.argpbz.pbz> -->
<!--X-Date: Wed, 24 Jun 1998 22:52:20 &#45;0700 -->
<!--X-Message-Id: 199806250550.AAA27698@dfw&#45;ix8.ix.netcom.com -->
<!--X-Content-Type: text/plain -->
<!--X-Reference: 199806200815.DAA06995@dfw&#45;ix12.ix.netcom.com -->
<!--X-Reference: 19980620093733.B14214#tucson,Princeton.EDU -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, [MUD-Dev] Re: Databases: was Re: skill system</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:jlsysinc#ix,netcom.com">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg01199.html">Previous</a>
&nbsp;|&nbsp;<a href="msg01201.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg01153.html">Previous</a>
&nbsp;|&nbsp;<a href="msg01212.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#01200">Author</A>
&nbsp;|&nbsp;<A HREF="#01200">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#01200">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>[MUD-Dev] Re: Databases: was Re: skill system</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Subject</em>: [MUD-Dev] Re: Databases: was Re: skill system</LI>
<LI><em>From</em>: "Jon A. Lambert" &lt;<A HREF="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</A>&gt;</LI>
<LI><em>Date</em>: Thu, 25 Jun 1998 01:51:25 -5</LI>
<LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
On 20 Jun 98, Adam J. Thornton wrote:
&gt; On Sat, Jun 20, 1998 at 04:17:25AM +0000, Jon A. Lambert wrote:
&gt; &gt; An OO DB might be more attractive than an RDB.  Since a whole host 
&gt; &gt; of OO comes for free.  Yet your mud programming language's particular
&gt; &gt; implementation of OO might have to match or be translated to a form
&gt; &gt; recognizable by the OO DB.
&gt; 
&gt; I'm using PostgreSQL in the project I'm working on.  I have no idea whether
&gt; the speed will eventually be acceptable or not, yet.
&gt; 
&gt; My objects are runtime-static in the sense that new object properties and
&gt; methods will not be created on the fly.
&gt; 
&gt; Postgres works rather nicely for this since you can define tables/classes
&gt; in an inheritance relationship, so that class Item can inherit Object but
&gt; add the properties Legal_Owner, Parent_Object, and Container_Relationship,
&gt; for instance.  Then items with weight and bulk can inherit item and add
&gt; weight and bulk properties.  You can do multiple inheritance, too, so I can
&gt; have an item class that inherits both Bulky_Item and Container, to get,
&gt; say, an orange crate.  Or those two plus Lockable for a chest.
&gt;

It is particularly important to develop unique OIDs (object IDs) to 
use as keys in the design of tables.  If you are implementing 
concurrency or a distributed environment, the mechanism for 
assigning OIDs needs to be even more robust.  Using anything from the 
problem domain (i.e. user name, etc.) as table keys creates a mess of 
maintainence and access problems.

Object attributes can be mapped to SQL-RDBMS columns.  But since 
RBMS usually only allow data primitives, sometimes it makes better
sense to map nested structures/ADTs to one-to-one table associations 
and sometimes fold them into the class table.  It depends.

One can map objects directly to classes and instances to rows, or 
joined rows as with ADTs, there are some other ways to implement 
inheritence.   For instance you can map entire class heirarchies to a 
single table.  This has the advantage of making queries and access 
very simple and performance quite high, but it wastes disk space and 
couples the classes very tightly to the class heirarchy, so making 
small changes to a single class affects every class within that 
heirarchy.   Another way would be to map only sub-classes of 
superclasses to tables.  This is probably worse than he former since
one has to add attributes to both the base class and the descendent 
classes.  

The method I like best is the direct class to table approach since it
preserves the spirit of OO.   However, the ease and speed of access
is directly related to the depth of your inheritence tree. :(

The only problem areas come from many-to-many relationships which
ideally become meta-tables which function solely to maintain the 
association and thus create additional tables in the RDB. 

&gt; Clearly database manipulation gets very time-expensive.  My strategy,
&gt; although it's not completely thought through yet is to maintain much of the
&gt; world state in in-memory data structures and only commit it to the DB when
&gt; a) there's a lull and my system load is low enough that I can do so
&gt; without fear of vastly slowing down things, or b) when something that it's
&gt; crucial that the rest of the world know about happens (figuring out the
&gt; criteria for this is the tricky part), or c) when a timeout happens such
&gt; that the DB hasn't been written in X seconds, so that I don't end up with
&gt; an impossibly huge transaction queue.
&gt;

I'm an advocate of having a translation layer (or persistence layer) 
to encapsulate SQL.  Leave hard-coded SQL out and use dynamic SQL in 
the translation layer.  This way the access interface from the "real" 
application is very simple (get/put) and easily replaceable.

Keep in mind everything I've written here, with the exception of 
OIDs, is based on the assumption of the objects' attributes being 
static at runtime.  Dynamic objects are a whole different ball-game.  

--
--/*\ Jon A. Lambert - TychoMUD     Internet:jlsysinc#ix,netcom.com /*\--
--/*\ Mud Server Developer's Page &lt;<A  HREF="http://www.netcom.com/~jlsysinc">http://www.netcom.com/~jlsysinc</A>&gt; /*\--
--/*\   "Everything that deceives may be said to enchant" - Plato   /*\--


</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<ul compact><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><A NAME="01212" HREF="msg01212.html">[MUD-Dev] Re: Databases: was Re: skill system</A></strong>
<ul compact><li><em>From:</em> J C Lawrence &lt;claw#under,engr.sgi.com&gt;</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<UL><LI><STRONG>References</STRONG>:
<UL>
<LI><STRONG><A NAME="01152" HREF="msg01152.html">[MUD-Dev] Re: Databases: was Re: skill system</A></STRONG>
<UL><LI><EM>From:</EM> "Jon A. Lambert" &lt;jlsysinc#ix,netcom.com&gt;</LI></UL></LI>
<LI><STRONG><A NAME="01153" HREF="msg01153.html">[MUD-Dev] Re: Databases: was Re: skill system</A></STRONG>
<UL><LI><EM>From:</EM> "Adam J. Thornton" &lt;adam#phoenix,Princeton.EDU&gt;</LI></UL></LI>
</UL></LI></UL>
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg01199.html">[MUD-Dev] Re: Databases: was Re: skill system</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg01201.html">[MUD-Dev] ScryMUD:  Source release, version 1.4</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg01153.html">[MUD-Dev] Re: Databases: was Re: skill system</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg01212.html">[MUD-Dev] Re: Databases: was Re: skill system</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#01200"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#01200"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>[MUD-Dev] Re: Databases: was Re: skill system</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<ul compact>
<ul compact>
<LI><strong><A NAME="01075" HREF="msg01075.html">[MUD-Dev] Re: Databases: was Re: skill system</A></strong>, 
s001gmu <a href="mailto:s001gmu#nova,wright.edu">s001gmu#nova,wright.edu</a>, Tue 16 Jun 1998, 18:02 GMT
<UL>
<LI><strong><A NAME="01081" HREF="msg01081.html">[MUD-Dev] Re: Databases: was Re: skill system</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Tue 16 Jun 1998, 18:44 GMT
</LI>
</UL>
</LI>
</ul>
<LI><strong><A NAME="01152" HREF="msg01152.html">[MUD-Dev] Re: Databases: was Re: skill system</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Sat 20 Jun 1998, 08:20 GMT
<UL>
<LI><strong><A NAME="01153" HREF="msg01153.html">[MUD-Dev] Re: Databases: was Re: skill system</A></strong>, 
Adam J. Thornton <a href="mailto:adam#phoenix,Princeton.EDU">adam#phoenix,Princeton.EDU</a>, Sat 20 Jun 1998, 13:41 GMT
<UL>
<LI><strong><A NAME="01200" HREF="msg01200.html">[MUD-Dev] Re: Databases: was Re: skill system</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Thu 25 Jun 1998, 05:52 GMT
<UL>
<LI><strong><A NAME="01212" HREF="msg01212.html">[MUD-Dev] Re: Databases: was Re: skill system</A></strong>, 
J C Lawrence <a href="mailto:claw#under,engr.sgi.com">claw#under,engr.sgi.com</a>, Fri 26 Jun 1998, 06:45 GMT
<UL>
<LI><strong><A NAME="01265" HREF="msg01265.html">[MUD-Dev] Re: Databases: was Re: skill system</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Tue 30 Jun 1998, 06:56 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</UL>
</LI>
<LI><strong><A NAME="01188" HREF="msg01188.html">[MUD-Dev] Re: Databases: was Re: skill system</A></strong>, 
s001gmu <a href="mailto:s001gmu#nova,wright.edu">s001gmu#nova,wright.edu</a>, Wed 24 Jun 1998, 04:45 GMT
<UL>
<LI><strong><A NAME="01199" HREF="msg01199.html">[MUD-Dev] Re: Databases: was Re: skill system</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Thu 25 Jun 1998, 05:50 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</ul>
</ul>
</ul>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>