<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jeremy&#039;s Blog &#187; JoS Architecture</title>
	<atom:link href="http://www.jeremyprivett.com/blog/archives/tag/jos-architecture/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jeremyprivett.com/blog</link>
	<description>Programming and Life</description>
	<lastBuildDate>Wed, 05 May 2010 03:16:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Journey of Souls: Loose Class Structure</title>
		<link>http://www.jeremyprivett.com/blog/archives/journey-of-souls-loose-class-structure/</link>
		<comments>http://www.jeremyprivett.com/blog/archives/journey-of-souls-loose-class-structure/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 08:48:18 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[Journey of Souls]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[JoS Architecture]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.jeremyprivett.com/blog/?p=398</guid>
		<description><![CDATA[The old PHP version of JoS made the JoS_Core class the central point of almost the entire game. It kept references to all of the descriptors, areas, rooms, etc. It was kind of ugly and I don&#8217;t think I want one class basically being the owner of every piece of the game. I&#8217;d like to [...]]]></description>
			<content:encoded><![CDATA[<p>The old PHP version of JoS made the JoS_Core class the central point of almost the entire game. It kept references to all of the descriptors, areas, rooms, etc. It was kind of ugly and I don&#8217;t think I want one class basically being the owner of every piece of the game. I&#8217;d like to split things out more than that.</p>
<p>There are a handful of requirements that we need to meet with our class/object structure/architecture:</p>
<ol>
<li>We need access to all of the Socket resources from the game loop in order to perform a Socket.Select() on them.</li>
<li>We need to be able to match a Socket resource to its Descriptor object.</li>
<li>We need to be able to quickly query for any available resource by some unique identifier (id number, guid, short unique name, etc).</li>
<li>Unless performance requires it, we should try to avoid the &#8220;reference&#8221; soup that came with the previous implementation. Every object had a property with a reference for each object that was related to it in any way.</li>
<blockquote><p><strong>Example</strong>: Room objects had properties with direct references to all of the characters in the room, the rooms exits, the area the room was apart of. And the exits had references to the rooms they led to and the rooms they were in. The characters had references to the room that they were in. There were a lot of circular references and it&#8217;s hard for most reference counting garbage collectors to properly free resources with these types of references.</p></blockquote>
<li>Classes with Events and Event Handlers need to be public so that scripted pieces in IronPython will be able to see them properly.</li>
</ol>
<p>Possible solutions:</p>
<p><strong>#1 and #2</strong>: Keep a Dictionary&lt;String, Descriptor&gt; that has all of the Descriptors in it in a DescriptorCollection class which will have the lookup methods mentioned in #3. The String key would be the string representation of the Socket.RemoteEndPoint. Including the remote port. Not including the remote port would make it impossible for us to accept multiple connections from the same IP Address.</p>
<p><strong>#3 and #4</strong>: The resources could all be kept in their own Collection classes with the resources mapped out as necessary in Lists or Dictionaries. Multiple Dictionaries using references can be created to facilitate multiple identifiers. We&#8217;ll tie the identifiers to the rest of the objects and use the lookup methods on the Collections when we need to get an object reference.</p>
<p><strong>#5</strong>: Make sure classes are defined as public. They&#8217;re not completely public by default.</p>
<p><em>This entry is almost entirely copied verbatim from the current revision of an internal collaborative document. There were some minor edits for clarification.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremyprivett.com/blog/archives/journey-of-souls-loose-class-structure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

