<?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"
	>

<channel>
	<title>Potential Blog &#187; Developer&#8217;s Cave</title>
	<atom:link href="http://www.potentialgames.com/blog/category/software-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.potentialgames.com/blog</link>
	<description>Notes of a Potential Independent Game Developer</description>
	<pubDate>Fri, 19 Dec 2008 19:08:00 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
	<language>en</language>
			<item>
		<title>Ripple Effect Subsides, Massive SLOC Drop</title>
		<link>http://www.potentialgames.com/blog/2008/12/19/ripple-effect-subsides-massive-sloc-drop/</link>
		<comments>http://www.potentialgames.com/blog/2008/12/19/ripple-effect-subsides-massive-sloc-drop/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 19:08:00 +0000</pubDate>
		<dc:creator>neb</dc:creator>
		
		<category><![CDATA[Developer's Cave]]></category>

		<category><![CDATA[Potential RPG]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.potentialgames.com/blog/?p=318</guid>
		<description><![CDATA[In software development, less is more. Clean, lean code is easier to debug and maintain. Designing the simplest solution is the trick. Whenever I design a software component, I tend to over-engineer it the first time through. This produces a solid, well-designed, hand-crafted unit of code, which is usually terribly complicated for its intended purpose. [...]]]></description>
			<content:encoded><![CDATA[<p>In software development, less is more. Clean, lean code is easier to debug and maintain. Designing the simplest solution is the trick. Whenever I design a software component, I tend to over-engineer it the first time through. This produces a solid, well-designed, hand-crafted unit of code, which is usually terribly complicated for its intended purpose. It&#8217;ll work well, but trying to explain it to someone else would be difficult. Some call that <em>job security</em>, but I&#8217;d prefer to find a more elegant design.</p>
<p><span id="more-318"></span></p>
<p>From a management standpoint, a mature software development process should not allow that first design to ever be implemented. Another round of simplification should be performed before any code is written. The initial design is not wasted time, as it provides insight to future improvements based on the original designer&#8217;s concepts. I&#8217;ve found that, working on my own, there is often too little oversight in this regard.</p>
<p>So it was with the content management system for the MMORPG platform I&#8217;m developing. Since I&#8217;m on my own, I could cope with the inelegant-yet-functional initial design. It had several programming-theoretic benefits. For example, I&#8217;m a big believer in strong typing and layering, but to the extreme it adds boilerplate code at each layer of architecture. In addition, (against my own advice) much of the design was overly rigid and complicated for the sake of <em>theoretic</em> (unproven) efficiency gains.</p>
<p>The straw that broke the camel&#8217;s back was gameplay integration. Adding and changing game content was a multi-step process to integrate properly with the underlying content system. Due to the aggressive byte-packing strategy, database storage was fragile, requiring a complex process to cope with code changes. Altering the gameplay needed to be more fluid, robust, and simple.</p>
<p>The new content design is fundamentally the same as before, but with a radically simpler implementation. As evidence, I dropped over 12,000 lines of code after removing the legacy content structure from the code base. Granted, not every little thing is fully functional yet, but the client and server operate with basic functionality, at least as well as before. Every line of content integration is simpler, with cleaner behavior. Database storage and network transport are more robust.</p>
<p>As a postmortem to the legacy content system, it provided a solid testbed for developing the features needed to support an MMORPG. It served as a proof-of-concept of the fundamental design principles, which are now more elegantly realized in the new content system. Most importantly, the new system shall usher in a renaissance of gameplay integration.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.potentialgames.com/blog/2008/12/19/ripple-effect-subsides-massive-sloc-drop/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ripple Effect</title>
		<link>http://www.potentialgames.com/blog/2008/12/09/ripple-effect/</link>
		<comments>http://www.potentialgames.com/blog/2008/12/09/ripple-effect/#comments</comments>
		<pubDate>Wed, 10 Dec 2008 03:37:24 +0000</pubDate>
		<dc:creator>neb</dc:creator>
		
		<category><![CDATA[Developer's Cave]]></category>

		<category><![CDATA[Potential RPG]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.potentialgames.com/blog/?p=312</guid>
		<description><![CDATA[It has been some time since my last post, but I have been far from idle. There have been no new (Alpha) releases lately, either. Despite seasonal distractions, all of my efforts have been focused on a renovation of the core content system. The software design is significantly better; but what does that mean to [...]]]></description>
			<content:encoded><![CDATA[<p>It has been some time since my last post, but I have been far from idle. There have been no new (Alpha) releases lately, either. Despite seasonal distractions, all of my efforts have been focused on a renovation of the core content system. The software design is significantly better; but what does that mean to you, the player? Absolutely nothing! The next release should play exactly the same as the last one, albeit with a sleek new content model.</p>
<p><span id="more-312"></span></p>
<p>From a software project standpoint, I had to weigh the consequences of the new design versus maintaining the existing (mostly working) design. Anticipating major ripple effect throughout the code, I decided to take the plunge (pun intended).</p>
<p>From a software design standpoint, I planned out the enhancement to avoid breaking existing systems until the last minute, by implementing the new code separately. I moved old classes to <tt>legacy</tt> packages for easy identification, for later removal. After the new content implementation was working on its own (granted, only with minor developer testing), it was time to integrate the rest of the game systems. To my body of code, it was like breaking every one of its bones, just to reset them to heal in a better position.</p>
<p>Since dis-integrating the old system, it has taken me about five days of furious coding to re-integrate with the new classes. The code is remarkably simpler, and is even more capable than the previous model. For example, I can more easily manipulate content without fear of destroying the entire database! When the old system is expunged entirely, I expect another steep drop in lines of code.</p>
<p>From a software management standpoint, I <em>should have</em> isolated my changes in a branch, to be merged back to trunk after complete. That would have allowed me to support existing releases while the branch remained broken. Also, that would have allowed me to easily abandon my changes if this whole upgrade when terribly wrong&#8230;</p>
<p>&#8230; which it might still do. At this point, I can compile my 1659 source files, but I&#8217;ve not yet run the game with the changes. In fact, I know of several gaps that will cause the system to crash spectacularly, until corrected. Once I have a working game again, I&#8217;ll post an update for Alpha Playtesters to enjoy. With any luck, you won&#8217;t notice a single difference.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.potentialgames.com/blog/2008/12/09/ripple-effect/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Java Logging Abandoned</title>
		<link>http://www.potentialgames.com/blog/2008/11/06/java-logging-abandoned/</link>
		<comments>http://www.potentialgames.com/blog/2008/11/06/java-logging-abandoned/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 19:19:40 +0000</pubDate>
		<dc:creator>neb</dc:creator>
		
		<category><![CDATA[Developer's Cave]]></category>

		<category><![CDATA[Potential RPG]]></category>

		<category><![CDATA[design patterns]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.potentialgames.com/blog/?p=196</guid>
		<description><![CDATA[This article provides a use case that chronicles my experience with the Java Logging API, as used for my MMORPG platform. Software developers can take this article as a cautionary tale against code reuse zealotry. It is often advantageous to follow your own software design goals rather than force your design around an existing system.

As [...]]]></description>
			<content:encoded><![CDATA[<p>This article provides a use case that chronicles my experience with the Java Logging API, as used for my MMORPG platform. Software developers can take this article as a cautionary tale against code reuse zealotry. It is often advantageous to follow your own software design goals rather than force your design around an existing system.</p>
<p><span id="more-196"></span></p>
<p>As an initial disclaimer, I am <strong>not</strong> entirely discrediting the Java Logging API. From a software engineering standpoint, <code>java.util.logging</code> provides a flexible, well-designed logging system, which is fully capable of providing logging services for a variety of applications. However, I have found it to be several times too complicated in the common case, and I disagree with some of its basic principles.</p>
<p>Although <a href="http://www.potentialgames.com/blog/2008/10/03/static-the-dark-side-of-design/">I argue against static design</a> in almost all cases, logging is one situation in which you do not want to be passing an instance reference through all your methods. Languages with <em>aspects</em>, other <em>cross-cutting</em> features, or even <i>multiple inheritance</i> can allow logging to be <em>mixed</em> into classes. Since Java does not (natively) support these language features, a static logging API is the cleanest solution. </p>
<p>I do not fault the static design of the Java Logging API, but I take exception to calling <code>Logger.getLogger(this.getClass().getName())</code> just to obtain a logging instance. The first design simplification I made was to write my own static logging API to encapsulate the ugly details of obtaining the Java Logger. My logging calls look something like <code>Log.warn(this, "message")</code>, which is somewhat cleaner.</p>
<p>All logging systems I&#8217;ve ever used have been based on <em>logging levels</em>, and I&#8217;ve never agreed with this concept. Logging messages are generated for different <em>purposes</em>, not at different <em>levels</em>. Severity levels make sense for informational/warning/error messages. Other message types do not fit into this model, such as debug, audit, start, stop, and configuration logging. Furthermore, levels named <em>fine</em>, <em>finer</em>, and <em>finest</em> (all <em>lower</em> than <em>config</em> messages) force programmers to arbitrarily decide how <em>important</em> a log message should be. Java arbitrarily includes exactly seven levels, placing further restrictions on extensibility.</p>
<p>I do not blame the Java Logging engineers for following a well-established design, even though it is faulty, in my opinion. Nonetheless, the second design decision I made was to isolate Java&#8217;s logging <em>levels</em> behind my own logging <em>categories</em> (fail, warn, info, init, stop, user, debug). My <em>categories</em> are mapped to Java&#8217;s logging <em>levels</em>, which are required to call the underlying Java Logging API. Custom formatters output my category names in place of the Java logging levels.</p>
<p>Registering custom <em>formatters</em> and <em>handlers</em> is another example of good engineering becoming somewhat overbearing in the common case. Based on any criteria, Java logging messages can be reformatted and redirected to different files (e.g., summary, detail, error) and sent over the network. While this is a potentially useful feature, the configuration is more complicated than desired for common use.</p>
<p>The third design simplification I made was to limit my logging to one flat file. If category or message source filtering is needed, <tt>grep</tt> is a perfectly adequate command-line tool. It is more reliable to post-process a complete log file, rather than rely on code changes to adjust logging output. This simplification alleviated any need for complicated Java handler and filter configuration. Since remote logging is useful, I added a few lines of code to (optionally) open a socket and send log messages to a remote server.</p>
<p>At this point, my logging API provided simple static integration from anywhere in my code, featuring source-named messages with meaningful <em>categories</em>. The complexities of configuring and calling the Java Logging API were all hidden behind my static Log class.</p>
<p>With all this effort heaped upon my code just to avoid reinventing yet-another logging system, two straws finally broke the proverbial camel&#8217;s back. For one, I had exhausted the seven available Java logging <em>levels</em> and could not add any additional <em>categories</em>. Even more severe, Java tended to stop logging before the application was finished. Log files lost the last lines of logging, because the logging API stopped outputting at the first signal of application shutdown. There does not appear to be any programmatic control over Java logging shutdown timing.</p>
<p>These issues prompted me to make my fourth, and definitive, simplification to using the Java Logging API; I abandoned it entirely. Since the rest of my code was integrated with my logging <em>facade</em>, I didn&#8217;t have to touch any code outside my static Log class. My application now initializes my logging system at startup, which involves opening a file, and stops it at shutdown, which involves closing the file. To preserve the best of the Java logging design, I have a simple formatter interface, which allows custom output. To prevent file output from blocking the application, I implemented a simple thread handoff queue, so all log calls return immediately. Flushing this queue is coordinated as part of application shutdown, so no messages are lost (even in the case of unhandled application exceptions).</p>
<p>In conclusion, I agree with the sentiment of not <em>reinventing the wheel</em> by using available software libraries. However, there is little added value when more time is spent dealing with the complexities, anomalies, and inadequacies of another library. There is a tradeoff, which can be both a strength and a weakness, between learning to integrate a software library versus developing it yourself. Although the Java Logging API is entirely capable, in this case, I would have made better use of time by implementing my own, simplified, logging API in the first place.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.potentialgames.com/blog/2008/11/06/java-logging-abandoned/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Java 6 Update 10: No Longer Just for Developers</title>
		<link>http://www.potentialgames.com/blog/2008/10/23/java-6-update-10-no-longer-just-for-developers/</link>
		<comments>http://www.potentialgames.com/blog/2008/10/23/java-6-update-10-no-longer-just-for-developers/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 18:41:28 +0000</pubDate>
		<dc:creator>neb</dc:creator>
		
		<category><![CDATA[Developer's Cave]]></category>

		<category><![CDATA[Potential RPG]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.potentialgames.com/blog/?p=252</guid>
		<description><![CDATA[Sun has released Java 6 Update 10, with the primary goal of improving end-user experience. Java is a wonderful programming language and runtime platform for developing many types of applications. Unfortunately, running a Java application can be a stumbling block for end users, which, in my opinion, has been holding Java back from reaching its [...]]]></description>
			<content:encoded><![CDATA[<p>Sun has released <a href="http://java.sun.com/developer/technicalArticles/javase/java6u10/">Java 6 Update 10</a>, with the primary goal of improving end-user experience. Java is a wonderful programming language and runtime platform for developing many types of applications. Unfortunately, running a Java application can be a stumbling block for end users, which, in my opinion, has been holding Java back from reaching its full potential. This update promises many welcome improvements to the platform. </p>
<blockquote><p><strong>Attention Alpha Playtesters:</strong> I&#8217;ll be testing the new Java version soon, with the goal of officially updating the game&#8217;s base Java requirements to this version. Playtesters are encouraged to try the new update and <a href="http://www.potentialgames.com/forums/viewtopic.php?f=5&#038;t=95">report any issues/improvements</a>.</p></blockquote>
<p>In the rest of this article, I give my two cents on Sun&#8217;s approach to Java thus far, and examine a couple improvements I&#8217;ve been eagerly anticipating.</p>
<p><span id="more-252"></span></p>
<p>Since the beginning (and to its credit), Java has been a language <em>by developers</em> and <em>for developers</em>. By learning the Java Programming Language, developers can leverage the platform&#8217;s capabilities for a multitude of applications, including client/GUI applications, networking, server and enterprise applications, database interaction, server-side Web processing (Servlets), and browser-based applications (Applets). Under this developer-centric approach, Sun has underestimated the frustration experienced by end users trying to install and configure the Java Runtime Environment. Although I applaud Sun for remaining true to its target audience of developers, I see its lack of user attention as the major reason Java is not as prolific as it could/should be.</p>
<p>Take, for example, Java Applets. I&#8217;m not a big fan of in-browser applications (especially when abused for purposes of eye-candy), but there are some useful features that can be offered by interactive browser-based widgets. As a Java developer, I could leverage the platform to create fully-featured browser-based applications. Sadly, I have had little confidence that a Java Applet would actually execute properly in a user&#8217;s browser. The <a href="http://java.sun.com/developer/technicalArticles/javase/java6u10/index.html#plugin"><em>Next-Generation Java Plug-In</em></a> promises to improve Applet support.</p>
<p>As a more specific case-in-point, <a href="http://java.sun.com/javase/technologies/desktop/javawebstart/">Java Web Start</a> should be the ideal approach for players to install-update-launch the <a href="http://www.potentialgames.com/rpg/">Potential Games, Java-based, in-development MMORPG</a> game client (<em>&#8220;with a single click&#8221;</em>). My experience has shown JWS to be <a href="http://www.potentialgames.com/blog/2007/11/27/java-web-start-antithesis-of-usability/"><em>problematic</em> (to put it lightly)</a> under many common conditions. Since Java includes this integrated deployment capability, I&#8217;d prefer to use JWS over a third-party deployment system. Java 6 Update 10 promises to make <a href="http://java.sun.com/developer/technicalArticles/javase/java6u10/index.html#dt">application deployment</a> more robust and transparent to the end user.</p>
<p>In summary, and in conclusion, I feel that Java has been incubating within its developer-centric shell and is only now beginning to break out into an environment of mass acceptance, where it can realize its full potential.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.potentialgames.com/blog/2008/10/23/java-6-update-10-no-longer-just-for-developers/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MMORPG Security: Secret Chat Exploits</title>
		<link>http://www.potentialgames.com/blog/2008/10/16/mmorpg-security-secret-chat-exploits/</link>
		<comments>http://www.potentialgames.com/blog/2008/10/16/mmorpg-security-secret-chat-exploits/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 16:27:12 +0000</pubDate>
		<dc:creator>neb</dc:creator>
		
		<category><![CDATA[Developer's Cave]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.potentialgames.com/blog/?p=232</guid>
		<description><![CDATA[Forgive the somewhat sensationalized title. This article does not describe any actual attacks on MMORPG chat systems (e.g., no World of Warcraft exploits). Nonetheless, there is good reason to believe that undisclosed chat exploits exist. This article explores the potential for exploiting MMORPG chat engines, based on related security vulnerabilities that are known to exist, [...]]]></description>
			<content:encoded><![CDATA[<p>Forgive the somewhat sensationalized title. This article does <strong>not</strong> describe any actual attacks on MMORPG chat systems (e.g., no <em>World of Warcraft</em> exploits). Nonetheless, there is good reason to believe that undisclosed chat exploits exist. This article explores the potential for exploiting MMORPG chat engines, based on related security vulnerabilities that are known to exist, which occur due to common software development practices. Anyone with experience in this matter is encouraged to comment, as there is a lack of community discussion on this subject.</p>
<p><span id="more-232"></span></p>
<p>Prior to starting Potential Games, my academic and professional background focused on distributed software security topics. While an online game is more entertaining to play than an enterprise business application, the need for critical security analysis is just as important in both settings.</p>
<p>A potential vulnerability of any software system is injection of malicious data. In an online environment, peers (clients and servers, or nodes in a peer-to-peer network) pass information as a matter of course. Both sides must be especially wary of information being received, which may have been crafted to trigger some undesirable behavior.</p>
<p>This type of attack is old hat in the field of Web browser/server development. Browsers and servers expect messages to be received from a variety of different applications, so they are designed with data validation in mind. Nonetheless, new injection vulnerabilities are frequently identified.</p>
<p>On the other hand, client and server applications for an MMO game are often developed in-house as proprietary software, designed to communicate exclusively. Because of this, the design process might make the simplifying assumption that input data will be formatted as expected. Taken together with constant-crunch-time scheduling, online game software vulnerabilities are sure to be missed.</p>
<p>Improving the software security design process can be discussed in a future article. In the spirit of <em>Cyber Security Awareness Month</em>, the purpose of this article is to raise <em>awareness</em> of potential chat exploits. I have two reasons for choosing this specific topic: (1) Chat messages represent client-to-client communication, which is especially dangerous, and (2) because there doesn&#8217;t seem to be much written on the subject.</p>
<p>On the first point, the chat system of an MMO(RPG) provides an open channel for a client application to send data to many other clients. The standard architecture is to relay chat communication through the server, subject to game rules, such as character proximity in the world. If the content of the chat message is not carefully sanitized by the server, clients could be fed malicious data, which was crafted by a hacked client (or simply cut-and-pasted as a chat message). The situation could be particularly dangerous if the software designers of the game client made the simplifying assumption that data from the (proprietary and trusted) server is safe. For these reasons, it seems that in-game, player-to-player chat engines would be particularly vulnerable to attack.</p>
<p>On the second point, I haven&#8217;t been able to find much information on actual chat-based exploits. A centralized server architecture provides an obvious location to sanitize chat messages. In practice, the state-of-the-art in MMO game systems may already avoid chat exploits. However, in the generally more open (and therefore inherently more secure) environment of Web browser and server software, vulnerabilities based on the same security principles are regularly uncovered. For these reasons, I must conclude that chat exploits are more prevalent than is openly discussed.</p>
<p>Despite the tingling of my security senses, these problems are either (a) already solved, or (b) are known by <em>insiders</em> who don&#8217;t want to talk about them, or (c) are known by <em>outsiders</em> who don&#8217;t want to reveal them, or (d) are lurking in the darkness waiting to be discovered. Most likely, the answer is (e): (b)-(d). Since the <em>insiders</em> tend to ignore problems that are presumed unknown, and the <em>outsiders</em> have more to gain by concealing the exploits they do know, open discussion is the best way to proactively address security issues.</p>
<p>Anyone with further reading or insight is encouraged to comment. Here is an excellent article describing an <em>Age of Conan</em> chat exploit: <a href="http://aocblog.com/2008/09/age-of-conan-hyperlink-exploit.html"><em>Age of Conan hyperlink exploit vulnerability fixed</em></a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.potentialgames.com/blog/2008/10/16/mmorpg-security-secret-chat-exploits/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Login Security: Password Hashing Techniques</title>
		<link>http://www.potentialgames.com/blog/2008/10/09/login-security-password-hashing-techniques/</link>
		<comments>http://www.potentialgames.com/blog/2008/10/09/login-security-password-hashing-techniques/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 19:25:50 +0000</pubDate>
		<dc:creator>neb</dc:creator>
		
		<category><![CDATA[Developer's Cave]]></category>

		<category><![CDATA[cryptography]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://www.potentialgames.com/blog/?p=203</guid>
		<description><![CDATA[In support of Cyber Security Awareness Month, this article is written as a tutorial on basic login security, including techniques to defend against potential vulnerabilities. I encourage anyone with a software security background to comment on this article. Although I have some years of software security experience, peer review is essential for building secure systems.
TIP: [...]]]></description>
			<content:encoded><![CDATA[<p>In support of <em>Cyber Security Awareness Month</em>, this article is written as a tutorial on basic login security, including techniques to defend against potential vulnerabilities. I encourage anyone with a software security background to comment on this article. Although I have some years of software security experience, peer review is essential for building secure systems.</p>
<blockquote><p><strong>TIP:</strong> Any and all security techniques (including these) should be considered experimental until thoroughly reviewed by the security community.</p></blockquote>
<p><span id="more-203"></span></p>
<p>The most common form of <em>login</em> (gaining access to a system) involves transmitting a username-password pair (the user&#8217;s <em>credentials</em>) to a server for <em>authentication</em> (confidence in the user&#8217;s identity) and <em>authorization</em> (right to access said system). This article describes techniques used by the Potential RPG platform to improve login security, but the approach can be applied to any similar system.</p>
<p>The first step to improving login security is to avoid exposing a user&#8217;s <em>plaintext</em> password. The common approach is to <a href="http://en.wikipedia.org/wiki/Secure_hash_function"><em>hash</em></a> the password, sending the resulting hash value to the server in place of the <em>plaintext</em> password. The server compares this hash value against the hash value stored in the player&#8217;s account. Thus, the hash value of the <em>plaintext</em> password (along with the username) becomes the user&#8217;s <em>authenticator</em>. The <em>plaintext</em> password is never stored or transmitted. The hashed <em>authenticator</em> can even be stored on the client to allow automatic login.</p>
<blockquote><p><strong>TIP:</strong> Legacy software (and many Web-based applications) send the user&#8217;s <em>plaintext</em> password over the network. No modern software has any excuse for ever transmitting or storing a user&#8217;s <em>plaintext</em> password.</p></blockquote>
<p>This basic form of hashing conceals the <em>plaintext</em> password, but has several weaknesses. Suppose you use the same password for several sites (<code>TIP: Don't.</code>). Even though your <em>plaintext</em> password has not been revealed, the hashed <em>authenticator</em> still grants access to your account on any system using the same hash function. Similarly, different users with the same password will have the same hashed <em>authenticator</em>. Since many systems use the (legacy) MD5 hash function, a simple hash is not sufficient to protect your credentials.</p>
<blockquote><p><strong>TIP:</strong> Don&#8217;t use the MD5 hash function. Minimally, use <a href="http://en.wikipedia.org/wiki/SHA_hash_functions">SHA-256</a>. Consider going one step further and use the <em>double-hashing</em> technique defined in <a href="http://www.schneier.com/book-practical.html"><u>Practical Cryptography</u> (Ferguson and Schneier, 2003)</a>.</p></blockquote>
<p>The Potential RPG platform protects your password by mixing in additional information when hashing. Specifically, your password, username, and a system-unique value are hashed together to form your login <em>authenticator</em>. By incorporating these values, each authenticator becomes specific to this game and the user. The authenticators cannot be used on other systems, even if the user has the same password. Users with the same password will not have the same authenticator.</p>
<p>As an added bonus, the above technique defends against <em>dictionary attacks</em>. The purpose of a dictionary attack is to reveal the <em>plaintext</em> password of a hashed <em>authenticator</em>. Dictionary attacks against basic hashing work by pre-computing a <em>dictionary</em> of hash values for all possible passwords. If your hashed <em>authenticator</em> is in the dictionary, your <em>plaintext</em> password is easily revealed. A single dictionary can be used to expose the passwords of many users, for any system using basic password hashing with the same hash function.</p>
<p>By mixing in a system-unique value and username with each password, a dictionary would have to be computed for each system and for <em>each user</em>. This essentially renders a pure dictionary attack more expensive than would be worthwhile.</p>
<blockquote><p><strong>TIP:</strong> Making an attack more <em>expensive</em> increases overall security.</p></blockquote>
<p>Consider a more valuable target: The server&#8217;s database of user authenticators. Before storing any authenticators or authenticating any logins, have the server perform another round of hashing. The one-way nature of secure hash functions effectively devalues the authenticator database, because those values cannot be used to log in.</p>
<blockquote><p><strong>TIP:</strong> <em>Devaluing</em> a target increases overall security.</p></blockquote>
<p>Unfortunately, all this password hardening still does not secure the login process itself. If an authenticator is stolen from a client&#8217;s cache, or in transit to the server (during login), that authenticator can be used to log in as the user. This is an example of a <em>replay attack</em> (the login information is copied by an adversary and resent later). The password hashing techniques described are still a valuable component of the security system, providing <em>defense in depth</em>, but another layer of security must be added to further protect the login process.</p>
<p>Several strategies can be used to protect and conceal data in transit, but this article only covers password hashing.  Besides, this is only Cyber Security <em>Awareness</em> Month. This month, I only need to make you <em>aware</em> of security issues. Later, we can discuss how to defend against further security vulnerabilities.</p>
<blockquote><p><strong>UPDATE:</strong> After writing this, I realized another benefit to good password hashing. If all systems salted and hashed your password as described above, you could safely use the same (plaintext) password everywhere. The hashed result would be unique per system. This sounds good from purely a client-server standpoint, but you would be more susceptible to keystroke logging, which would then be capturing your universal plaintext password as you type it into the keyboard.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.potentialgames.com/blog/2008/10/09/login-security-password-hashing-techniques/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Static: The Dark Side of Design</title>
		<link>http://www.potentialgames.com/blog/2008/10/03/static-the-dark-side-of-design/</link>
		<comments>http://www.potentialgames.com/blog/2008/10/03/static-the-dark-side-of-design/#comments</comments>
		<pubDate>Fri, 03 Oct 2008 13:42:41 +0000</pubDate>
		<dc:creator>neb</dc:creator>
		
		<category><![CDATA[Developer's Cave]]></category>

		<category><![CDATA[design patterns]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.potentialgames.com/blog/?p=184</guid>
		<description><![CDATA[Students of software must be taught early the benefits of object oriented design, lest they succumb to the dark side of static programming. When designing a software component, the temptation can be to write globally accessible public static methods in lieu of instantiable objects. Even experienced developers must remain diligent to avoid being turned to [...]]]></description>
			<content:encoded><![CDATA[<p>Students of software must be taught early the benefits of object oriented design, lest they succumb to the dark side of <em>static</em> programming. When designing a software component, the temptation can be to write globally accessible <code>public static</code> methods in lieu of instantiable objects. Even experienced developers must remain diligent to avoid being turned to this quicker, more seductive, approach. <span id="more-184"></span></p>
<p>The <code>static</code> keyword (in Java) is an important language feature, but can be easily abused, leading to several problems.</p>
<p>One problem is <em>static cling</em> syndrome: Static methods beget static methods. Once you start coding with global access methods, other parts of the system tend toward static access. Eventually, the design degenerates into unmaintainable spaghetti code.</p>
<p>Another drawback is initialization. A static system that requires an initialization method to be called is error prone. Consider Java&#8217;s class loading system, which may trigger static method calls just by accessing a class.</p>
<p>Purely static code may also break other software features, such as modular component design. The static API can be called from any object in any module at any time with no access control or coordination. In some cases, this type of global access is desirable. For example, a fully instance-based (non-static) logging system would require passing the logging object throughout the code, permeating every class with its presence.</p>
<p>If your code has given in to the dark side of static design, do not despair; there may still be some good left in it, and you may be able to save the design before it destroys itself. Attempt to reform the design by rewriting it with instance-based objects. This is your <em>library</em> implementation. If global access is needed (as with the logging example), follow the <em>singleton</em> pattern and provide static access to a single instance of the system.</p>
<p>Do not underestimate the power of an object design. Even though it still involves global static access, the singleton provides several benefits. For one, you can eliminate <em>static cling</em> by implementing helper classes as objects. Premature access problems are eliminated (or at least exposed), since there is no singleton instance to call until proper initialization is performed. The singleton pattern tempers the dark side, and is the tool of a more civilized design.</p>
<p>You might tell yourself that <em>you&#8217;re not afraid</em> of the dangers of a static design. Once you are faced with debugging an evil static system, only to find that your adversary is your very own code staring back at you, you will be; you will be&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.potentialgames.com/blog/2008/10/03/static-the-dark-side-of-design/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Serialized Data Survivability</title>
		<link>http://www.potentialgames.com/blog/2008/09/26/serialized-data-survivability/</link>
		<comments>http://www.potentialgames.com/blog/2008/09/26/serialized-data-survivability/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 16:48:34 +0000</pubDate>
		<dc:creator>neb</dc:creator>
		
		<category><![CDATA[Developer's Cave]]></category>

		<category><![CDATA[Potential RPG]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.potentialgames.com/blog/?p=170</guid>
		<description><![CDATA[Serialized object data is inherently fragile. A change in one class effectively renders any serialized data that includes the class (even deep within the object graph) unusable. This article describes how I have (potentially) addressed this problem in my MMORPG platform. 
First, consider the cases in which data serialization (a.k.a. marshalling and unmarshalling bytes) are [...]]]></description>
			<content:encoded><![CDATA[<p>Serialized object data is inherently fragile. A change in one class effectively renders any serialized data that includes the class (even deep within the object graph) unusable. This article describes how I have (potentially) addressed this problem in my MMORPG platform. <span id="more-170"></span></p>
<p>First, consider the cases in which data serialization (a.k.a. marshalling and unmarshalling bytes) are used on this project. I am serializing objects for client-server network transport, client data cache, and server persistent storage. Without any special care, any class changes could/would break compatibility with old versions of the data. This situation is evident to any Alpha Playtester, as I usually wipe out the database after major updates.</p>
<p>Notice that client-side cache data can be (and is) expunged if any data structure has become incompatible. Also, since I&#8217;m using Java Web Start (at least provisionally), I can assume all users are running the latest version of the client software. Therefore, transport compatibility is not a big concern. Nonetheless, other projects may support clients of varying versions. Although I&#8217;m not explicitly dealing with this scenario, the technique described below could be used to support <a href="http://en.wikipedia.org/wiki/Forward_compatibility"><em>forward compatibility</em></a>. </p>
<p>For the server, serialized data must survive code changes.</p>
<p>The standard advice is to avoid the problem; either maintain yet another external data format, or never change your objects. Since the former is undesirable, and the latter impossible, I&#8217;ve attempted to come up with a more robust approach.</p>
<p>Although Potential RPG is (so far) <em>100% Pure Java</em>, I am <strong>not</strong> using Java&#8217;s built-in Serialization mechanism. Java Serialization is designed (rather elegantly, actually) for convenience at the expense of robustness. Even for core Java classes, the documentation explicitly warns that serialized data is likely to break between Java versions. Using Java&#8217;s <code>Externalizable</code> interface is an option, but this still binds the developer to Java&#8217;s Serialization mechanics.</p>
<p>The approach I&#8217;ve developed is an object <em>packing/unpacking</em> system, in which each <em>serializable</em> class has an accompanying byte-handling <code>Packer</code> helper class. This is functionally equivalent to a class-based Externalizable system (but with a cleaner API, IMHO).</p>
<p>The problem of <em>survivability</em> remains. The <strong>one-byte solution</strong> is to insert a <em>packing schema version</em> byte before each object&#8217;s data. This version is given to the unpacking method when unmarshalling the bytes. The unpacking method can include logic to (a) skip defunct fields and/or (b) set default values for missing fields. This technique provides backward compatibility. (Adapting to future versions is more complex, so I&#8217;ll ignore that on this project&#8230;)</p>
<p>Under this design, maintaining backward data compatibility for a class is a matter of augmenting the <em>unpacking</em> routine. Notice that the <em>packing</em> routine always produces an updated serialized data structure. Therefore, it is possible to write a routine that upgrades the database in one pass; or, the server can be left to lazily update objects as it encounters them.</p>
<p>For Playtesters, the next Alpha release will impose a mandatory database reset. After that, if I am diligent in my code, the test world should survive future updates.</p>
<p>Further reading: <a href="http://www.macchiato.com/columns/Durable4.html">Durable Java: Serialization</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.potentialgames.com/blog/2008/09/26/serialized-data-survivability/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Concealed Controller Pattern</title>
		<link>http://www.potentialgames.com/blog/2008/08/27/concealed-controller-pattern/</link>
		<comments>http://www.potentialgames.com/blog/2008/08/27/concealed-controller-pattern/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 11:48:27 +0000</pubDate>
		<dc:creator>neb</dc:creator>
		
		<category><![CDATA[Developer's Cave]]></category>

		<category><![CDATA[design patterns]]></category>

		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.potentialgames.com/blog/?p=131</guid>
		<description><![CDATA[This article describes an interesting design pattern that I utilized in my Potential RPG code. The following describes the pattern in general and how I&#8217;ve used it in my code. Has anyone seen this pattern in the wild? Does it have any other common forms or names? 
Background: I have a class (let&#8217;s call it [...]]]></description>
			<content:encoded><![CDATA[<p>This article describes an interesting design pattern that I utilized in my Potential RPG code. The following describes the pattern in general and how I&#8217;ve used it in my code. Has anyone seen this pattern in the wild? Does it have any other common forms or names? <span id="more-131"></span></p>
<p><strong>Background:</strong> I have a class (let&#8217;s call it Subordinate) that has special control methods, which should <em>only</em> be called by a Master class. (Subordinate also has methods for public use.) Consequently, I originally implemented the Subordinate in the same (client-side) package as the Master, using package-protected control methods. Unfortunately, this binds the Subordinate, and everything that needs it, to client-packaged libraries.</p>
<p><strong>Simple Solution:</strong> The simple solution is to repackage the Subordinate into its own (non-client-specific) package. Unfortunately, the control methods must become public for the Master (still bound to client-specific logic) to access. The API would have to document, <em>&#8220;Please do not call the control methods, unless you&#8217;re supposed to.&#8221;</em></p>
<p><strong>The Goal:</strong> My goal is to provide a Subordinate that can only be controlled by the Master. One approach is to create a Subordinate interface, and keep its implementation hidden. However, there is no desire to allow any other implementation of the Subordinate (it is best kept final).</p>
<p><strong>Concealed Controller:</strong> The crux of this pattern is a Subordinate helper class, called Controller. Controller has access to the (once again) package-protected control methods of the Subordinate. The Controller exposes public access to the control methods. In addition, the only way to obtain a Subordinate is to construct a Controller (which constructs the Subordinate instance internally). </p>
<p><strong>Integration:</strong> To use a Subordinate, the Master constructs a Controller and exposes the contained Subordinate publicly (but conceals the Controller for itself). The only access to the Subordinate&#8217;s control methods is via the Controller, which is concealed by the Master.</p>
<p><strong>Pseudocode:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">library</span>;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">class</span> Subordinate
<span style="color: #009900;">&#123;</span>
    Subordinate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>
    <span style="color: #000066; font-weight: bold;">void</span> control<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> ... <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> action<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> ... <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">library</span>;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">class</span> Controller
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> Subordinate sub <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Subordinate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">public</span> Controller<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> Subordinate get<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">return</span> sub; <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> control<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> sub.<span style="color: #006633;">control</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>; <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">package</span> <span style="color: #006699;">client</span>;
<span style="color: #000000; font-weight: bold;">final</span> <span style="color: #000000; font-weight: bold;">class</span> Master
<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000000; font-weight: bold;">final</span> Controller control <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Controller<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
    Master<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> activateWhenClientIsReady<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>; <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">void</span> activate<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> control.<span style="color: #006633;">control</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>; <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> Subordinate get<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">return</span> control.<span style="color: #006633;">get</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>; <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><strong>Potential RPG:</strong> In my code, the <em>subordinate</em> is a PlayerCharacter class, with <code>activate()</code> and <code>deactivate()</code> <em>control</em> methods, only to be used by the client-side CharacterAgent (<em>master</em>). Many GUI classes integrate with PlayerCharacter, which provides access to the in-world character being controlled by the player. Following this pattern, the CharacterAgent constructs and conceals the Activator (<em>controller</em>), shielding access to the control methods (thus preventing the chaos that would certainly ensue).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.potentialgames.com/blog/2008/08/27/concealed-controller-pattern/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Software Versioning</title>
		<link>http://www.potentialgames.com/blog/2008/08/05/software-versioning/</link>
		<comments>http://www.potentialgames.com/blog/2008/08/05/software-versioning/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 14:16:38 +0000</pubDate>
		<dc:creator>neb</dc:creator>
		
		<category><![CDATA[Developer's Cave]]></category>

		<category><![CDATA[Potential RPG]]></category>

		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.potentialgames.com/blog/?p=101</guid>
		<description><![CDATA[I&#8217;m trying to settle on a sensible software versioning scheme for Potential RPG. The most familiar structure is X.Y.Z, which I&#8217;m calling Generation.Feature.Incremental.
The generation is the major version of the software. A feature release indicates the completion of a set of available features. Incremental releases may include bug fixes and enhancements, as well as new [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m trying to settle on a sensible <a href="http://en.wikipedia.org/wiki/Software_versioning">software versioning</a> scheme for Potential RPG. The most familiar structure is <em>X.Y.Z</em>, which I&#8217;m calling <em>Generation.Feature.Incremental</em>.</p>
<p>The <em>generation</em> is the major version of the software. A <em>feature</em> release indicates the completion of a set of available features. <em>Incremental</em> releases may include bug fixes and enhancements, as well as new features that might not be fully integrated or ready for a feature release.</p>
<p>Incremental version numbers are treated as steps toward the next feature release. The <em>test</em> environment (including Alpha testing) should see all incremental releases. However, the <em>production</em> environment (when there is one) may skip some incremental releases, but should see all feature releases.</p>
<p>In practice, this versioning plan may be too linear. For example, a bug that affects the production environment may need to be fixed before any next release is ready. What is more, the latest incremental release may include features not ready for the production environment. <em>Branching</em> is the revision control mechanism that deals with this, which must be accounted for in the software development process and release management scheme. For Potential RPG, I will probably resort to a fourth <em>patch</em> level version, indicating something was fixed outside the mainline of development.</p>
<p>In addition to the software version number, I also include an <em>edition</em> (&#8221;Alpha3&#8243;), which is a <em>marketing version</em> name, the repository revision whence the product was built, and the build date/time.</p>
<p><a href="http://www.innovationontherun.com/creating-a-build-number-with-ant-and-subversion/">Here&#8217;s a handy article</a> on retrieving the Subversion revision from within your Ant build script. Anyone with further advice/insight into the exciting world of version management is encouraged to comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.potentialgames.com/blog/2008/08/05/software-versioning/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
