<?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>Chris-Software.com &#187; big</title>
	<atom:link href="http://chris-software.com/index.php/tag/big/feed/" rel="self" type="application/rss+xml" />
	<link>http://chris-software.com</link>
	<description>iPhone, iPod touch games, Objective-C Tutorials, krzysztofrutkowski.com</description>
	<lastBuildDate>Tue, 29 Mar 2011 09:58:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Planning a bigger application</title>
		<link>http://chris-software.com/index.php/2009/05/06/planning-a-bigger-application/</link>
		<comments>http://chris-software.com/index.php/2009/05/06/planning-a-bigger-application/#comments</comments>
		<pubDate>Tue, 05 May 2009 23:43:45 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Obj-C Tutorials]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[big]]></category>
		<category><![CDATA[bigger applications]]></category>
		<category><![CDATA[navigate]]></category>
		<category><![CDATA[Planning bigger application]]></category>
		<category><![CDATA[start programming]]></category>
		<category><![CDATA[two views]]></category>

		<guid isPermaLink="false">http://chris-software.com/?page_id=816</guid>
		<description><![CDATA[Before you start developing a bigger application you should plan, how the whole project&#8217;s classes should talk to each other. You should take a sheet of paper and draw the schema, describing the most important classes
I don&#8217;t want you to draw the flowchart describing every single algorithm, every if statement or loop like this one below.

When [...]]]></description>
			<content:encoded><![CDATA[<p>Before you start developing a bigger application you should plan, how the whole project&#8217;s classes should talk to each other. You should take a sheet of paper and draw the schema, describing the most important classes</p>
<p>I don&#8217;t want you to draw the flowchart describing every single algorithm, every <em>if statement</em> or <em>loop</em> like this one below.</p>
<p style="text-align: center;"><a href="http://chris-software.com/wp-content/uploads/2009/05/flowcharts.png"><img class="alignnone size-medium wp-image-817" title="flowcharts" src="http://chris-software.com/wp-content/uploads/2009/05/flowcharts-163x300.png" alt="flowcharts" width="163" height="300" /></a></p>
<p style="text-align: left;">When I started programming, every next <em>view</em> (<em>UIViewController</em>) of any application, was <em>allocated</em> by previous <em>view</em> and there was no simple way to return from the last one to the first one. Either I had to start programming the app from the beginning to fix it or had to call <em>dealloc</em> method which should be called only automaticaly when the application is quited.</p>
<p style="text-align: left;">
<p style="text-align: left;">Since few months I&#8217;ve new idea, I would like to show you. Below is the schema &#8211; the frame of most my new apps:</p>
<p style="text-align: center;"><span style="color: #0000ee; text-decoration: underline;"><a href="http://chris-software.com/wp-content/uploads/2009/05/schema.png"></a><a href="http://chris-software.com/wp-content/uploads/2009/05/schema.png"><img class="size-full wp-image-819 aligncenter" title="schema" src="http://chris-software.com/wp-content/uploads/2009/05/schema.png" alt="schema" width="615" height="384" /></a></span></p>
<p style="text-align: left;">Legend:</p>
<p style="text-align: left;">
<ul>
<li><strong>A</strong> &#8211; App Delegate, the first objective-c file, autmatically allocated when the application starts.</li>
<li><strong>B</strong> &#8211; Main Controller &#8211; this is the &#8220;application central unit&#8221; that is responsible for displaying some part of the menu, receiving messages from any classes it allocates and delivering them somewhere else.</li>
<li><strong>C</strong> &#8211; Settings &#8211; class that provides an interface to adjust the volume of sounds / music, way of steering (arrows / accelerometer) etc.</li>
<li><strong>D</strong> &#8211; heart of the sounds and the background music.</li>
<li><strong>E</strong> &#8211; in this case, the funniest part of app, the hardest to code, responsible for loading a level, tracking the game progress, check for collisions and more.</li>
<li><strong>F</strong> &#8211; provides a form for entering new high score</li>
<li><strong>G</strong> &#8211; displays the best times / scores for any level.</li>
<li><strong>H</strong> &#8211; other simple <em>views</em> that almost every application has.</li>
</ul>
<h3>How does it all work?</h3>
<p>Let&#8217;s start with arrow <strong>#1</strong>. In fact, my <strong>App Delegate [A]</strong> has one single task - to allocate a next <em>view</em>, in this case the <strong>Main Controller [B]</strong> and I never use it again.</p>
<p>Once <strong>MainController [B]</strong> is allocated the <em>Main Menu</em> it provides is visible on the screen. Any function user presses is <em>allocated</em> and/or displayed via transition or not &#8211; it&#8217;s up to me.</p>
<p><strong>#2, #3, #9<br />
<span style="font-weight: normal;">When users changes the volume in the </span>Settings [C]</strong>, the <strong>Main Controller [B]</strong> is informed about that change and it&#8217;s passed to the <strong>Sound and Music Engine [D]</strong> to perform necessary tasks. If it was other option, for sure <strong>Main Controller [B]</strong> now, how to deal with it.</p>
<p><strong>#4, #5, #6<br />
<span style="font-weight: normal;">When users starts/load/continue the game,</span> Game Controller [E]</strong> is checking each parameter of the game. When the game is canceled it returns to <strong>Main Controller [B]</strong>, when the game is over, it checks, if the score is enough to appear on the high scores list. If yes it tells the <strong>Main Controller [B]</strong> to display the form &#8211; <strong>New High-Scores [F]</strong>. Once form was compleated, <strong>#6 Main Controller [B]</strong> updates the list of high scores and displays the records <strong>High-Scores View [G]</strong>.</p>
<p><strong>#7<br />
<span style="font-weight: normal;">User can easily visit the </span>High-Scores View [G]<span style="font-weight: normal;"> and quit to </span>Main Controller [B]<span style="font-weight: normal;"> without any difficulties.</span></strong></p>
<p><strong>#8<br />
<span style="font-weight: normal;">Any instructions, information are simply more or less polished <em>views</em>, so one class is enough to handle them all. It&#8217;s easy to navigate from </span>Main Controller [B]<span style="font-weight: normal;"> to </span>Others [H]<span style="font-weight: normal;"> and vice verse.</span></strong></p>
<p><strong>#9<br />
<span style="font-weight: normal;">Whatever user does in the application, </span>Main Controller [B] </strong>tells the <strong>Sound Engine [D]</strong>, if it should play a simple button pressed sound or change the background music.</p>
<p>I&#8217;ve just shown you my idea of programming bigger applications. Of course it doesn&#8217;t mean that whatever I do, is made with only eight classes. For example <strong>Game Controller</strong> has many other classes it includes to help him checking what is going on in the game and they talk only with <strong>Game Controller</strong> and it decides if it should send a message to <strong>Main Controller</strong> to finish the game or continue it.</p>
<p>Hope this helped.</p>
]]></content:encoded>
			<wfw:commentRss>http://chris-software.com/index.php/2009/05/06/planning-a-bigger-application/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

