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

<channel>
	<title>Martin Rusev Blog about web development and  graphic design</title>
	<atom:link href="http://www.martinrusev.net/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.martinrusev.net/blog</link>
	<description>Blog about web development and graphic design</description>
	<pubDate>Sun, 07 Sep 2008 09:45:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Be a better {web} programmer: Part 1, Good Habits</title>
		<link>http://www.martinrusev.net/blog/2008/08/be-a-better-web-programmer-part-1-good-habits/</link>
		<comments>http://www.martinrusev.net/blog/2008/08/be-a-better-web-programmer-part-1-good-habits/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 09:08:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Programming tips]]></category>

		<guid isPermaLink="false">http://www.martinrusev.net/blog/?p=47</guid>
		<description><![CDATA[Anybody can write code and with a few months of programming experience, everybody can write &#8216;applications&#8217;. Getting them to work is easy, but making them scalable and maintainable requires more work.  Based on my experience in web development I&#8217;ve come up with these conclusions:

1. 20 lines rule
Always try to write briefly and to minimize the [...]]]></description>
			<content:encoded><![CDATA[<p>Anybody can write code and with a few months of programming experience, everybody can write &#8216;applications&#8217;. Getting them to work is easy, but making them scalable and maintainable requires more work.  Based on my experience in web development I&#8217;ve come up with these conclusions:</p>
<p><span id="more-47"></span></p>
<h3>1. 20 lines rule</h3>
<p>Always try to write briefly and to minimize the general code amount. If you have 20 lines limit for your functions, as a result you will have something readeable and easier to understand and maintain.</p>
<h3>2. Document your code, comment your functions</h3>
<blockquote><p>Write what you&#8217;d want to see if you were reading the code</p>
</blockquote>
<p>According to that <a href="http://www.linux.com/feature/22112">common principle</a> your comments should look similar to this example:</p>
<pre>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;"><span class="kw2">&lt;?php</span>
<span class="coMULTI">/*

/*
&nbsp;* &nbsp;This function check if $param1 and $param2 are numbers and if they are
&nbsp;* &nbsp;- multiplies them and returns the results
* &nbsp; The function was created to make multiplying in the application easier.
*/</span>

<span class="kw2">function</span> foo<span class="br0">&#40;</span><span class="re0">$param1</span>, <span class="re0">$param2</span><span class="br0">&#41;</span>
<span class="br0">&#123;</span>
&nbsp; &nbsp; <span class="re0">$test</span> = <span class="re0">$param1</span> * <span class="re0">$param2</span>;

&nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$test</span>;

<span class="br0">&#125;</span>

<span class="kw2">?&gt;</span></div>
</div>
</pre>
<p>Very often good documentation is critical when you need to edit existing or add new features to the application. If you look around and read  about project documentation in general you will notice, that the recommended method for documenting applications is using tools like <a href="http://www.stack.nl/~dimitri/doxygen/">Doxygen</a>, but I think that in addition we must add documentation that is more human friendly. </p>
<h3>3.  Write human friendly code</h3>
<p>It is always a good practice to write applications according to the principle &#8220;From humans for humans&#8221;. If you feel that writing function a_c() {} instead of writing function access_check(){} will bring you to the world of &#8216;rapid and &#8216;agile&#8217; development there is a big chance that possibly you are wrong. In short term you will write faster, but the &#8216;rapid&#8217; aura will disappear when you close the file or return to the code next week or month later. </p>
<h3>4. Use understandable application structure</h3>
<p>Application structure and architecture is something significant not only for web programming, but for programming in general. Always try to separate your application in layers. In web programming  they are many different ways to separate logic from presentation, but standards for the industry are the <a href="http://en.wikipedia.org/wiki/Multitier_architecture">n-tier</a> and <a href="http://en.wikipedia.org/wiki/Model-view-controller">MVC</a> architecture. I am not saying, that they are the easiest ones, but at least they are recognizable. </p>
<h3>5. Learn new language</h3>
<p>Learning new language is always good way to expand your programming knowledge and  naturaly<br />
expand your code quality. If you want to know what are the most used programming languages in the moment, check the <a href="http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html">TIOBE index</a>. If you are web developer and you haven&#8217;t yet tried  <a href="http://www.ruby-lang.org/en/">Ruby</a>,  or <a href="http://www.python.org/">Python</a> , now is the time.</p>
<h3>6. Learn new framework</h3>
<p>if learning new programming language is too much for you, or you don&#8217;t have enough time, try something smaller - learn new framework in the language you already now. If you are Ruby developer, Ruby on Rails is great framework and everybody likes it, but <a href="http://merbivore.com/">Merb</a> and <a href="http://ramaze.net/">Ramaze</a> are great frameworks too. For the PHP guys - there are so many quality <a href="http://www.martinrusev.net/blog/2008/06/popular-php-frameworks-for-everyday-use/">frameworks</a> out there to choose from.</p>
<h3>7. Think, think, think, write</h3>
<p>That one is my favourite. When I write web applications I spend lots of  time thinking about application scalability, performance and reusability of the components. In long term that makes sense, because we never know how big our application will become when we write the first line of code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinrusev.net/blog/2008/08/be-a-better-web-programmer-part-1-good-habits/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PHP performance tips around the web</title>
		<link>http://www.martinrusev.net/blog/2008/07/php-performance-tips-around-the-web/</link>
		<comments>http://www.martinrusev.net/blog/2008/07/php-performance-tips-around-the-web/#comments</comments>
		<pubDate>Tue, 29 Jul 2008 08:15:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Web development]]></category>

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

		<guid isPermaLink="false">http://www.martinrusev.net/blog/?p=26</guid>
		<description><![CDATA[If you search for the topic &#8220;php performance&#8221; in the search engines probably you will get what
you need on the first page. During my investigations around the web I had colected some not so visible and very useful posts and presentations:
12 quick PHP performance tips:
http://www.moskalyuk.com/blog/php-optimization-tips/1272
Enormous collection of slides and presentations about web architectures and scalabilty:
http://www.royans.net/arch/library/
Slideshow [...]]]></description>
			<content:encoded><![CDATA[<p>If you search for the topic &#8220;php performance&#8221; in the search engines probably you will get what</p>
<p>you need on the first page. During my investigations around the web I had colected some not so visible and very useful posts and presentations:<span id="more-26"></span></p>
<p>12 quick PHP performance tips:</p>
<p><a href="http://www.moskalyuk.com/blog/php-optimization-tips/1272">http://www.moskalyuk.com/blog/php-optimization-tips/1272</a></p>
<p>Enormous collection of slides and presentations about web architectures and scalabilty:</p>
<p><a href="http://www.royans.net/arch/library/">http://www.royans.net/arch/library/</a></p>
<p>Slideshow about overall PHP performance:</p>
<p><a href="http://talks.php.net/show/hpp/0">http://talks.php.net/show/hpp/0</a></p>
<p>40  tips for optimizing your PHP code:</p>
<p><a href="http://reinholdweber.com/?p=3">http://reinholdweber.com/?p=3</a></p>
<p>Useful post about php performance and best coding practices:</p>
<p><a href="http://atomized.org/2005/04/php-performance-best-practices/">http://atomized.org/2005/04/php-performance-best-practices/</a></p>
<p>Ilia Alshanetsky talks on different tematics, including PHP performance and security:</p>
<p><a href="http://ilia.ws/talks.php">http://ilia.ws/talks.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinrusev.net/blog/2008/07/php-performance-tips-around-the-web/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Should we use Object-Relational Mapping tools ?</title>
		<link>http://www.martinrusev.net/blog/2008/06/should-we-use-object-relational-mapping-tools/</link>
		<comments>http://www.martinrusev.net/blog/2008/06/should-we-use-object-relational-mapping-tools/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 20:38:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Web development]]></category>

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

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

		<guid isPermaLink="false">http://www.martinrusev.net/blog/?p=15</guid>
		<description><![CDATA[Object-Relational Mapping tools have been in use for very long time. Till 2005  they were implemented and used widely most in Java enterprise world. Ruby on Rails and its famous implementation of Active Record pattern changed that rule and now we can use ORM solutions in all web developing languages. My personal experience is with:

Doctrine [...]]]></description>
			<content:encoded><![CDATA[<p>Object-Relational Mapping tools have been in use for very long time. Till 2005  they were implemented and used widely most in Java enterprise world. Ruby on Rails and its famous implementation of Active Record pattern changed that rule and now we can use ORM solutions in all web developing languages. <span id="more-15"></span>My personal experience is with:</p>
<ul>
<li><a href="http://www.phpdoctrine.org/">Doctrine</a> and <a href="http://propel.phpdb.org/trac/">Propel</a> for PHP</li>
<li><a href="http://www.sqlalchemy.org/">SQLAlchemy</a> for Python</li>
</ul>
<h3>What exactly is ORM?</h3>
<p>According to Wikipedia:</p>
<blockquote><p><strong>Object-relational mapping</strong> (aka <strong>ORM</strong>, <strong>O/RM</strong>, and <strong>O/R mapping</strong>) is a programming technique for converting data between incompatible type systems in relational databases and object-oriented programming languages. This creates, in effect, a &#8220;virtual object database&#8221; which can be used from within the programming language.</p></blockquote>
<h3>Everything should be Object</h3>
<p>In our Object Oriented programming world  every bit of information must be encapsulated in object. That&#8217;s what the giants in industry say and I will no argue.From one point of view objects are slower than functions, but in general in object oriented applications it is easier to work with database objects. Usually that is one of the main reasons for looking around to find proper to our needs  ORM solution.</p>
<h3>SQL is Bad?</h3>
<p>Sometimes choosing Object Relation Mapping tool is excuse for not learning and generally avoiding raw SQL code. Writing SQL code is not something evil and ORM solutions are not always the answer. As a matter of fact when we need to optimize our &#8220;application - database&#8221; interaction we still need to write SQL. And for that reason most ORM solutions are supporting raw SQL code implementation.</p>
<h3>Development made simple</h3>
<p>Usually basic CRUD operations can be performed with  one line of code. Most ORM tools can create tables, sort and filter database queries on the fly and much more. In general they are simplyfiing database interactions and are saving a lots of development time.</p>
<h3>Not so fast</h3>
<p>And what about performance. Taking data from the database, converting it to objects, transfering the objects to higher layers in application and than  repeating the whole process backwards for sure slows down the application. Another problem is that ORM solutions in fact are something that is not listed in &#8220;Top 100 of all software inventions&#8221;. They are created to solve the diversions between the object models interpretation of state and the database schemes storage of state. And they will be not here forever i hope &#8230;</p>
<h3>The future is bright</h3>
<p>If we use Object oriented databases instead of relation databases in object oriented applications we will finally scale the object oriented programming approach to it&#8217;s maximum capacity.OODB are developed very actively and I hope that very soon we will see real world working solution.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinrusev.net/blog/2008/06/should-we-use-object-relational-mapping-tools/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Loading Smarty on Demand in Zend Framework</title>
		<link>http://www.martinrusev.net/blog/2008/06/loading-smarty-on-demand-in-zend-framework/</link>
		<comments>http://www.martinrusev.net/blog/2008/06/loading-smarty-on-demand-in-zend-framework/#comments</comments>
		<pubDate>Wed, 18 Jun 2008 18:24:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Web development]]></category>

		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://www.martinrusev.net/blog/?p=14</guid>
		<description><![CDATA[My last projects are all build with Zend Framework and almost all of my previous projects were created with custom framework using Smarty. I wanted to implement Smarty in Zend Framework and I search through the web to find proper resolution for my problem. I found this article and another one inspired by the first. [...]]]></description>
			<content:encoded><![CDATA[<p>My last projects are all build with Zend Framework and almost all of my previous projects were created with custom framework using Smarty. I wanted to implement Smarty in Zend Framework and I search through the web to find proper resolution for my problem. I found <a href="http://kpumuk.info/php/zend-framework-using-smarty-as-template-engine/">this</a> article and <a href="http://devzone.zend.com/node/view/id/120">another</a> one inspired by the first. I tested both approaches but they were not what I was looking for. Inspired by both articles I created my own Smarty - Zend framework implementation.<br />
 <span id="more-14"></span></p>
<p>First creating custom Controller: </p>
<pre>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;"><span class="kw2">&lt;?php</span>
<span class="kw2">class</span> Base_Controller <span class="kw2">extends</span> Zend_Controller_Action
<span class="br0">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/** 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* &nbsp;DISABLE DEFAULT ZEND FRAMEWORK VIEW &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">public</span> <span class="kw2">function</span> init<span class="br0">&#40;</span><span class="br0">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$this</span>-&gt;_helper-&gt;<span class="me1">viewRenderer</span>-&gt;<span class="me1">setNoRender</span><span class="br0">&#40;</span><span class="kw2">true</span><span class="br0">&#41;</span>;&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* &nbsp;LOADING SMARTY ON DEMAND
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">public</span> <a href="http://www.php.net/static"><span class="kw3">static</span></a> <span class="kw2">function</span> LoadSmarty<span class="br0">&#40;</span><span class="br0">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">include</span> <span class="br0">&#40;</span><span class="st0">'smarty/Smarty.class.php'</span><span class="br0">&#41;</span>;&nbsp; &nbsp; 

&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$smarty</span> = <span class="kw2">new</span> Smarty<span class="br0">&#40;</span><span class="br0">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$smarty</span>-&gt;<span class="me1">template_dir</span> = &nbsp;template <a href="http://www.php.net/dir"><span class="kw3">dir</span></a> ;
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$smarty</span>-&gt;<span class="me1">compile_dir</span> &nbsp;= compile <a href="http://www.php.net/dir"><span class="kw3">dir</span></a>;
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$smarty</span>-&gt;<span class="me1">config_dir</span> &nbsp; = config <a href="http://www.php.net/dir"><span class="kw3">dir</span></a> 
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$smarty</span>-&gt;<span class="me1">cache_dir</span> &nbsp; &nbsp;= cache <a href="http://www.php.net/dir"><span class="kw3">dir</span></a>;
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$smarty</span>-&gt;<span class="me1">plugins_dir</span> = and plugins ;
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* &nbsp;SMARTY CONFIGURATION
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$smarty</span>-&gt;<span class="me1">debugging</span> = <span class="kw2">false</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$smarty</span>-&gt;<span class="me1">force_compile</span> = <span class="kw2">true</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$smarty</span>-&gt;<span class="me1">compile_check</span> = <span class="kw2">true</span>;

&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/**
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* &nbsp; &nbsp; &nbsp;SMARTY PLUGINS 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span> 
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//include various smarty plugins </span>
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; Zend_Registry::<span class="me2">set</span><span class="br0">&#40;</span><span class="st0">'smarty'</span>, <span class="re0">$smarty</span><span class="br0">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>
&nbsp; &nbsp; &nbsp; &nbsp; 
<span class="br0">&#125;</span>


<span class="kw2">?&gt;</span></div>
</div>
</pre>
<p>This is example of the custom Base Controller, if we want to include Smarty in particular Controller we extend Base Controller </p>
<pre>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;"><span class="kw2">&lt;?php</span>
<span class="kw1">include</span> <span class="br0">&#40;</span><span class="st0">'kernel/Base_Controller.php'</span><span class="br0">&#41;</span>;

<span class="kw2">class</span> IndexController <span class="kw2">extends</span> Base_Controller 
<span class="br0">&#123;</span>
&nbsp; &nbsp; &nbsp;<span class="kw2">public</span> <span class="kw2">function</span> indexAction<span class="br0">&#40;</span><span class="br0">&#41;</span> 
&nbsp; &nbsp; <span class="br0">&#123;</span> 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$this</span>-&gt;<span class="me1">IncludeSmarty</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$smarty</span> = Zend_Registry::<span class="me2">get</span><span class="br0">&#40;</span><span class="st0">'smarty'</span><span class="br0">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$smarty</span>-&gt;<span class="me1">assign</span><span class="br0">&#40;</span><span class="st0">'title'</span>, <span class="st0">'Test Page index'</span><span class="br0">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/** DEFINE PAGE TEMPLATES */</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$smarty</span>-&gt;<span class="me1">display</span><span class="br0">&#40;</span><span class="st0">'includes/header.tpl'</span><span class="br0">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$smarty</span>-&gt;<span class="me1">display</span><span class="br0">&#40;</span><span class="st0">'demo.tpl'</span><span class="br0">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$smarty</span>-&gt;<span class="me1">display</span><span class="br0">&#40;</span><span class="st0">'includes/footer.tpl'</span><span class="br0">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>

<span class="coMULTI">/**
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* &nbsp;FUNCTION FOR LOADING SMARTY
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* 
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;* @return smarty object
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</span>
&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">public</span> <a href="http://www.php.net/static"><span class="kw3">static</span></a> <span class="kw2">function</span> IncludeSmarty<span class="br0">&#40;</span><span class="br0">&#41;</span>
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; 
&nbsp; &nbsp; &nbsp; &nbsp; Base_Controller::<span class="me2">LoadSmarty</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span>
<span class="br0">&#125;</span></div>
</div>
</pre>
<p>If we are building some pages, that doesn&#8217;t require Smarty or we want it to use Zend_View component the only difference is that the custom controller extends the default Zend_Controller </p>
<pre>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;"><span class="kw2">&lt;?php</span>
<span class="kw1">include</span> <span class="br0">&#40;</span><span class="st0">'kernel/Base_Controller.php'</span><span class="br0">&#41;</span>;

<span class="kw2">class</span> IndexController <span class="kw2">extends</span> Zend_Controller_Action
<span class="co1">// ALL LOGIC HERE</span></div>
</div>
</pre>
<p>With this approach Smarty  will be used only when it is  needed and.If we completely skip Zend_View in our custom framework we can avoid the frustrating for me default Zend Framework View directory.  structure.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinrusev.net/blog/2008/06/loading-smarty-on-demand-in-zend-framework/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Popular PHP Frameworks for everyday use</title>
		<link>http://www.martinrusev.net/blog/2008/06/popular-php-frameworks-for-everyday-use/</link>
		<comments>http://www.martinrusev.net/blog/2008/06/popular-php-frameworks-for-everyday-use/#comments</comments>
		<pubDate>Wed, 11 Jun 2008 20:31:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Web development]]></category>

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

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

		<guid isPermaLink="false">http://www.martinrusev.net/blog/?p=3</guid>
		<description><![CDATA[During my almost three years in web development i have tested and worked for various projects  with several PHP frameworks. Every framework has its power features and of course drawbacks. Out there they are many more other frameworks but these for me are the so called mainstream frameworks. After that little introduction lets begin with&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>During my almost three years in web development i have tested and worked for various projects  with several PHP frameworks. Every framework has its power features and of course drawbacks. Out there they are many more other frameworks but these for me are the so called mainstream frameworks. After that little introduction lets begin with&#8230; Of course CakePHP.  <span id="more-8"></span></p>
<p><a class="headings" href="http://cakephp.org">CakePHP</a></p>
<p><a href="http://www.martinrusev.net/blog/wp-content/uploads/2008/06/cake_logo.jpeg"><img class="alignnone size-medium wp-image-9" title="cake_logo" src="http://www.martinrusev.net/blog/wp-content/uploads/2008/06/cake_logo.jpeg" alt="" width="99" height="99" /></a>CakePHP for PHP frameworks is like Apple in computer world. It is very cool and trendy to develop web sites with Cake and of course it&#8217;s a piece of cake. In addition to the trend is the fact that CakePHP is porting features from Ruby on Rails in PHP.<br/><br />
So inspired by the trend and all the talks in web development forums i gave it a try. But after 3 or 4 days intense work and learning i found that CakePHP is not that shiny knight everybody loves.<br/><br />
During my tests i encounter several problems and i found that Cake doesn&#8217;t have good documentation and i think that documentation is a MUST for such a popular framework.<br/><br />
I tried Google Groups and there i found the answers i have been looking for, but i have already lost two days. CakePHP have some very strong and appealing feautures for rapid development if you have time and patience.</p>
<p><em>Cons </em></p>
<ol>
<li>Backward incompatibility</li>
<li>No documentation, but improving</li>
<li>It is still PHP 4 framework</li>
<li>If you don&#8217;t have database you still must create dummy model</li>
</ol>
<p><em>Pros</em>:</p>
<ol>
<li>Active record pattern</li>
<li>Friendly community</li>
<li>MVC / Model - View - Controller /</li>
</ol>
<p><a class="headings" href="http://codeigniter.com/"><strong>Codeigniter</strong></a></p>
<p><a href="http://www.martinrusev.net/blog/wp-content/uploads/2008/06/ci_logo_flame.png"><img class="alignnone size-medium wp-image-10" title="ci_logo_flame" src="http://www.martinrusev.net/blog/wp-content/uploads/2008/06/ci_logo_flame.png" alt="" width="105" height="115" /></a>Codeignter is my personal favourite for small and medium sized web sites. It has great documentation, great and responsive community and in 80% of the cases,  it is the perfect tool for the job.<br/><br />
But when I tried to build some advanced features using two-dimensional array I had to overwrite some code in Codeigniter&#8217;s core.<br/><br />
Finally Codeigniter is using one CI super object, that is carying a lots of stuff all the time. If I have to develop web applications where speed and performance are critical I will think very carefully about implementing Codeigniter .</p>
<p>Cons:</p>
<ol>
<li>Again - it is not native PHP 5 framework</li>
<li>CI super object</li>
</ol>
<p><em>Pros</em>:</p>
<ol>
<li>Great documentation</li>
<li>Very easy for developing web sites</li>
<li>Short  learning curve</li>
</ol>
<p><a class="headings" href="http://www.symfony-project.org/"><strong>Symfony</strong></a></p>
<p><a href="http://www.martinrusev.net/blog/wp-content/uploads/2008/06/symfony-logo.png"><img class="alignnone size-medium wp-image-11" title="symfony-logo" src="http://www.martinrusev.net/blog/wp-content/uploads/2008/06/symfony-logo.png" alt="" width="100" height="100" /></a>Symfony is the so called enterprise framework. It has almost perfect documentation, but for me it has too many third party modules that are slowing up development process and the overall framework performance<br/><br />
If you want to use Symfony you must gain additional knowledge in <a href="http://propel.phpdb.org/trac/">Propel </a>and <a href="http://creole.phpdb.org/trac/">Creole</a> . Symfony automates some of our development tasks with its  great PHP code generator.<br/><br />
After a little research about Symfony overall performance <a href="http://www.alrond.com/en/2007/feb/04/in-addition-to-the-test-of-mvc-frameworks/">here </a>and <a href="http://wiki.rubyonrails.com/rails/pages/Framework+Performance">here</a> i decided not to use Symfony for now.</p>
<p><em>Cons</em>:</p>
<ol>
<li>Low Performance</li>
<li>Long learning curve</li>
</ol>
<p><em>Pros:</em></p>
<ol>
<li>Great documentation</li>
<li>Active community</li>
<li>Great code generator</li>
</ol>
<p><a class="headings" href="http://framework.zend.com/"><strong>Zend Framework</strong></a></p>
<p><a href="http://www.martinrusev.net/blog/wp-content/uploads/2008/06/zend-framework_logo.png"><img class="alignnone size-medium wp-image-12" title="zend-framework_logo" src="http://www.martinrusev.net/blog/wp-content/uploads/2008/06/zend-framework_logo.png" alt="" width="100" height="101" /></a>As you can guess Zend Frameworks is created by Zend - the PHP company. Zend is loosely coupled component library and you can use as many components as you wish.<br/><br />
If you stay away from Zend autoloader you can easily achieve great application performance. Zend framework can be extended very easily.</p>
<p><em>Cons:</em></p>
<ol>
<li> Requires intrermediate PHP knowledge, cannot achieve anything out of the box</li>
</ol>
<p><em>Pros</em>:</p>
<ol>
<li>Again Great documentation</li>
<li>Full PHP 5 support</li>
<li>Great performance</li>
<li>Web Services support</li>
</ol>
<p>Right now I am developing my applications using customized  Zend Framework for big projects and Codeigniter for the smaller projects.<br/><br />
In my next post i will write about Full stack vs. Loosely coupled frameworks, so stay tooned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinrusev.net/blog/2008/06/popular-php-frameworks-for-everyday-use/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Under Construction !</title>
		<link>http://www.martinrusev.net/blog/2008/06/hello-world/</link>
		<comments>http://www.martinrusev.net/blog/2008/06/hello-world/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 06:44:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Blog News]]></category>

		<guid isPermaLink="false">http://www.martinrusev.net/blog/?p=1</guid>
		<description><![CDATA[I am currently designing my blog. Very soon it will shine with full glory !
]]></description>
			<content:encoded><![CDATA[<p>I am currently designing my blog. Very soon it will shine with full glory !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.martinrusev.net/blog/2008/06/hello-world/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
