<?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>Feet Have Been &#187; programming</title>
	<atom:link href="http://wheremy.feethavebeen.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://wheremy.feethavebeen.com</link>
	<description>Sometimes, you just go where your feet take you</description>
	<lastBuildDate>Tue, 17 Aug 2010 13:40:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Beta Launch Nearning</title>
		<link>http://wheremy.feethavebeen.com/2009/06/122/</link>
		<comments>http://wheremy.feethavebeen.com/2009/06/122/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 17:39:41 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rpg]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/?p=122</guid>
		<description><![CDATA[As I near the official beta release of Rising Legends, I decided to take some time off from programming and focus on the design and balancing that is so critical to games. Often times you&#8217;ll find classes that are just too powerful, or stat dependencies that don&#8217;t really make any sense, but these traps can [...]]]></description>
			<content:encoded><![CDATA[<p>As I near the official beta release of Rising Legends, I decided to take some time off from programming and focus on the design and balancing that is so critical to games. Often times you&#8217;ll find classes that are just too powerful, or stat dependencies that don&#8217;t really make any sense, but these traps can be avoided. I decided that taking some time off from programming would give me a chance to plan things out a little more.</p>
<p>I&#8217;ve been working on a design document that outlines the game as I finish things up. It&#8217;s slow going, but every time I finish a small section of it, I get almost the same thrill as finishing the same section programmatically. I guess I know that when this piece is completely done, I&#8217;ll have a much easier time finishing up the beta release and porting everything over from the bland black/white layout to something that is much for fitting for an RPG.</p>
<p>From the beginning I wanted browser-based games to contain features that make other MMO&#8217;s so easy to get in to. Not as much page refreshes, modular windows, beautiful graphics and proper fight timers are just some of the things I opted to include in Rising Legends. As well, I worked a long time on the UI, ensuring ease of use, so first time players can just jump right now. From the programming side of view, I had to take some time out to implement my own version of the JQuery Tools tooltip and overlay libraries to ensure speedy load times. While JQuery Tools provides some great animations, I found that not only were they too flashy, but they lagged. The more tabs you had open, the slower it went. While my interpretation of it isn&#8217;t nearly as flashy, it cuts down on a lot of the code cutting out about 6KB of things that I didn&#8217;t need. While 6KB doesn&#8217;t seem like a lot, since network speeds are now our bottleneck instead of processing power, it will start to add up as more players join up.</p>
<p>I figure I will add a brief explanation of a basic version of the overly code, since it is an interesting topic and very easy to implement. As well, it allows for perfect positioning of elements.</p>
<p>In closing, I just wanted to link you all to an in-dev version of the UI that will be pushed out with the beta release: <a href="http://boba.feethavebeen.com/template1/">http://boba.feethavebeen.com/template1/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2009/06/122/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Verbose Arguments</title>
		<link>http://wheremy.feethavebeen.com/2009/06/verbose-arguments/</link>
		<comments>http://wheremy.feethavebeen.com/2009/06/verbose-arguments/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 04:59:11 +0000</pubDate>
		<dc:creator>xangelo</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[verbose arguments]]></category>

		<guid isPermaLink="false">http://wheremy.feethavebeen.com/?p=112</guid>
		<description><![CDATA[Imagine if you will, reading an instruction manual that went a little like this Place 3b into 2c while holding 4d adjacent to panel a4. Now, any normal person will have absolutely no idea what&#8217;s being talked about. And that&#8217;s ok, because there isnt any kind of legend included within. For example, if I included [...]]]></description>
			<content:encoded><![CDATA[<p>Imagine if you will, reading an instruction manual that went a little like this</p>
<blockquote><p>Place 3b into 2c while holding 4d adjacent to panel a4.</p>
</blockquote>
<p>Now, any normal person will have absolutely no idea what&#8217;s being talked about. And that&#8217;s ok, because there isnt any kind of legend included within. For example, if I included a legend like the following, you would have no trouble understanding what I was talking about.</p>
<blockquote><p>a4: Cabinet Side Wall<br />
2c: Hole on bottom left of Cabinet Side<br />
3b: Screw<br />
4d: Cabinet Door</p>
</blockquote>
<p>Hey now, magically that all makes sense. And in an instruction manual, where you have a set number of components, it&#8217;s alright to include things in an abbreviated manner.</p>
<p>But why would you apply the same logic to code? Why would you force variables into concise statements when it would make more sense to expand them? After all, L1 makes less sense than Line1 does right? This logic works great for variables, but fails a little when you move to function arguments. Essentially, the very fact that it is great for describing what a variables&#8217; use is, causes it to be large, and accumulating upwards of 2 or 3 of these verbose variables into a function can become tedious. No one wants to read two or three lines of function arguments.</p>
<p>While thinking about the matter on a recent project that I have been working on, I realized that many frameworks had already stumbled upon the problem, and solved it rather quickly. The idea is that in a function, we can leave room for a variable length of arguments for any function, and still have &#8220;required&#8221; values. It is a little complicated but in a code example, we can see the value of such an idea:</p>
<p>Way 1: Concise<br />
function call($var1, $var2,$var3,$var4,$var5)<br />
{</p>
<p>}</p>
<p>Way 2: Verbose<br />
function call($var)<br />
{</p>
<p>}</p>
<p>No it isn&#8217;t a typo, Way 2, the Verbose way really does have only one argument, but it will be treated as an array. Not a regular array, because those are messy looking in practice, but a string separated by both colons and commas and returned to the function. The bonus of this is that when you go about developing an application, you can see what variables a function requires at a glance.</p>
<p>Concise Argument Definition:<br />
call(135,12331,123,41344,384192&#8242;);</p>
<p>Verbose Argument Definition:<br />
call(&#8216;takeout: 135, initial: 12331, custid: 123, accountid: 41344, custphone: 384192&#8242;);</p>
<p>Now you can clearly see why they are called verbose arguments, but also why we would use them. When perusing your code after a few days, you seldom remember what a badly named variable does. In this way, you can, at a glance, see what variables a function will accept and you can define them in any way. In the first example, if 135 and 12331 were switched, you would get an error since you can&#8217;t subtrace 12331 from 135 without resulting in a negative number. However, with verbose arguments, you can&#8217;t go wrong. You can easily see what you are setting each argument to, and you can easily set things right, incase you mess up.</p>
<p>One could obviously argue that the same method can be achieved using arrays, but arrays are ugly, and since programming is an art form, we try and stay away from ugly.</p>
<p>As for verbose arguments, they are definitely a welcome addition to any piece of software, and it is well worth the few extra minutes of programming to cobble together a quick function that will handle everything for you. The function will take a string verbose input, and split it according these rules, and return the new array back.</p>
<p><strong>Rules<br />
</strong></p>
<ul>
<li>Variable names are before a colon.</li>
<li>There must be no space between the variable name and the colon (ie. varname: is acceptable but varname : is not)</li>
<li>The value for a variable must come after the variable (with or without a space)</li>
<li>Multiple variables are separated with a comma after the variable value (ie. varname1: angelo, varname2: another)</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> parse_args<span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$e</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">', '</span><span style="color: #339933;">,</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
			<span style="color: #000088;">$e</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span> <span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
		<span style="color: #000088;">$num_e</span> <span style="color: #339933;">=</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
		<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$num_e</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$t</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">': '</span><span style="color: #339933;">,</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$t</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
					<span style="color: #000088;">$t</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">':'</span><span style="color: #339933;">,</span><span style="color: #000088;">$e</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// Parse to array[key] = value format</span>
		<span style="color: #000088;">$num_args</span> <span style="color: #339933;">=</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$t</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
&nbsp;
		<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$x</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$x</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$num_args</span><span style="color: #339933;">;</span> <span style="color: #000088;">$x</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$tmp</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$t</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$x</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$t</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$x</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$tmp</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Hopefully, after incorporating it into your own applications you&#8217;ll see the benefit of something like this. </p>
]]></content:encoded>
			<wfw:commentRss>http://wheremy.feethavebeen.com/2009/06/verbose-arguments/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
