<?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>Juozas devBlog &#187; framework</title>
	<atom:link href="http://dev.juokaz.com/tag/framework/feed" rel="self" type="application/rss+xml" />
	<link>http://dev.juokaz.com</link>
	<description>Random ideas, scripts and facts</description>
	<lastBuildDate>Mon, 22 Mar 2010 10:48:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Zend Framework is NOT bloated</title>
		<link>http://dev.juokaz.com/php/zend-framework-is-not-bloated</link>
		<comments>http://dev.juokaz.com/php/zend-framework-is-not-bloated#comments</comments>
		<pubDate>Fri, 12 Mar 2010 17:14:21 +0000</pubDate>
		<dc:creator>Juozas</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[apc]]></category>
		<category><![CDATA[bloated]]></category>
		<category><![CDATA[features]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[padraic]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[slow]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[zf]]></category>

		<guid isPermaLink="false">http://dev.juokaz.com/?p=993</guid>
		<description><![CDATA[ Zend Framework is always considered as being the slow/bloated one. I don&#8217;t think this is right, so I decided to prove that it&#8217;s not correct and in fact ZF is as good as other frameworks are. This post doesn&#8217;t cover any benchmarks though; this is more like a architecture review and some misconceptions disproof. [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-460" title="Zend Framework" src="http://dev.juokaz.com/wp-content/uploads/2009/04/logo-zend-framework.jpg" alt="Zend Framework" width="169" height="114" /> Zend Framework is always considered as being the slow/bloated one. I don&#8217;t think this is right, so I decided to prove that it&#8217;s not correct and in fact ZF is as good as other frameworks are. This post doesn&#8217;t cover any benchmarks though; this is more like a architecture review and some misconceptions disproof.  </p>
<p>Before we go any further, let&#8217;s check with <a href="http://en.wikipedia.org/wiki/Software_bloat">Wikipedia</a>:</p>
<blockquote><p>Software bloat is a term used to describe the tendency of newer computer programs to have a <strong>larger installation footprint</strong>, or have many <strong>unnecessary features</strong> that are not used by end users, or just generally <strong>use more system resources</strong> than necessary, while offering little or <strong>no benefit</strong> to its users.
</p></blockquote>
<p>So what I need to provide is <em>contra</em> arguments that Zend Framework doesn&#8217;t do those.</p>
<h5>&#8220;Large installation footprint&#8221;</h5>
<p>25.8 MB and 2338 files. This is how much ZF <em>weights</em> and this is usually quoted as the main factor of bloatedness. First of all, 25.8 MB is a joke &#8211; full application takes maximum 50 MB. So unless you want to squeeze in 100&#8217;s of projects into a shared hosting, size of ZF shouldn&#8217;t matter at all. Price of hard-drive and RAM (for APC caches) is so low nowadays, that I don&#8217;t even remember last time I checked how much space my project takes up.</p>
<p>Same applies with files count &#8211; why would anyone even care how much files it has? As you probably know, PHP doesn&#8217;t compile your project into one binary, thus making it a big file. What it does, is it loads external code using include/require statements. Hence, from those 2338 you usually going to use around 300 (based on my tests). One can argue that this is still a lot of files, but this <em>big </em>number of files comes from ZF extensibility. A lot of functionality is separated into plugins, adapters etc. </p>
<h5>&#8220;Unnecessary features&#8221;</h5>
<p>ZF has massive amount of functionality: starting from web framework components and finishing up with services classes (I have written more about this <a href="http://dev.juokaz.com/php/why-zend-framework">here</a>). There is a big chance that you are not going to use all of them, but because all components are decoupled (as much as possible) and as mentioned above, you don&#8217;t even notice them if you don&#8217;t include those files. </p>
<p>I&#8217;m one of those people who think that ZF has too much components, but this is rather my own personal preference rather than a problem. Nevertheless, I haven&#8217;t used only a few of available components as once you need something, it&#8217;s always very quick to just <em>use</em> it. No need to download anything more or look for available components. For serious components like <a href="http://dev.juokaz.com/php/zend-framework-and-doctrine-part-1">Doctrine</a>, you probably want to look around, but just for some regular code Zend provides all required features.</p>
<h5>&#8220;Use more system resources&#8221;</h5>
<p>This one is <strong>hot</strong> topic in ZF world. But the point here is that &#8220;features = slow&#8221;, especially in PHP. This happens because PHP as a language is not <em>that</em> fast and as you start adding more features and code, you get slower code. This where framework&#8217;s benchmarks are born, but as Pádraic mentions in his <a href="http://blog.astrumfutura.com/archives/421-PHP-Framework-Benchmarks-Entertaining-But-Ultimately-Useless.html">post</a> about benchmarks: </p>
<blockquote><p>To create a positive benchmark, you need to understand that all frameworks were born as festering piles of unoptimised stinking crap. They were all born bad and get worse with age. This sounds quite sad, but actually it&#8217;s an inevitable compromise between performance and features. It&#8217;s also a compromise between performance and ease-of-use</p></blockquote>
<p>It&#8217;s inevitable to provide those features that ZF provides and still work faster than other frameworks. So considering the speed of development you need to know how much performance you actually need. Maybe rapid development is much more important? At least it&#8217;s for me, and by sacrificing some tenths of a second I can roll out projects in a few days. And as &#8220;bloated&#8221; definition states, something is not bloated if it provides benefits while using more system resources.</p>
<h5>How to make it not bloated?</h5>
<p>If you still consider ZF as bloated framework, let me give you some ideas how to make it work for you. First of all &#8211; <a href="http://en.wikipedia.org/wiki/Software_performance_analysis">profile</a>, profile, profile! I keep mentioning this every time I talk about performance, but don&#8217;t judge performance of something without actually knowing <em>why</em> it&#8217;s not performing well. <a href="http://xdebug.org/">Xdebug</a> helps here as it can provide profiling data, which you then can use to detect slow parts of code. From my experience this is usually I/O &#8211; DB calls, file reads etc. Get rid of those and you have some decent performance increase. </p>
<p>A lot of other performance factors come from knowing how framework works internally or <em>really</em> reading manual. For example <a href="http://framework.zend.com/manual/en/zend.application.html">Zend_Application</a> is kind of slow, but it can be easily optimized by just getting rid of it. But this is only needed if you are running very big application, where every millisecond of execution matters, for normal application you&#8217;d hardly get any benefit. This is very ZF&#8217;s decoupled components start to shine, as you can just use those which work well and add some special sauce for other parts.  </p>
<h5>Conclusion</h5>
<p>I use Zend Framework extensively, so I&#8217;m biased a lot here, but having this much of experience, I can at least judge it objectively (up to some degree). And what I can say is that ZF is not bloated, it can be slower than some other available frameworks, but widely popular method to judge its performance by the number of files it has is just wrong. Of course it&#8217;s not the easiest framework to get working with (and get it to perform efficiently), but don&#8217;t get put off just by archive size it comes in. </p>
]]></content:encoded>
			<wfw:commentRss>http://dev.juokaz.com/php/zend-framework-is-not-bloated/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Why Zend Framework?</title>
		<link>http://dev.juokaz.com/php/why-zend-framework</link>
		<comments>http://dev.juokaz.com/php/why-zend-framework#comments</comments>
		<pubDate>Mon, 07 Dec 2009 21:01:18 +0000</pubDate>
		<dc:creator>Juozas</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[cla]]></category>
		<category><![CDATA[comparison]]></category>
		<category><![CDATA[consulting]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[scaffolding]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://dev.juokaz.com/?p=937</guid>
		<description><![CDATA[ As you might have noticed I mostly write about Zend Framework and related content. This has a lot of underlying reasons, so I decided to wrap up my thoughts about it and why to (not)use Zend Framework for your own projects. This is not a comparison of frameworks though, because I don&#8217;t feel like [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-460" title="Zend Framework" src="http://dev.juokaz.com/wp-content/uploads/2009/04/logo-zend-framework.jpg" alt="Zend Framework" width="169" height="114" /> As you might have noticed I mostly write about <a href="http://framework.zend.com/">Zend Framework</a> and related content. This has a lot of underlying reasons, so I decided to wrap up my thoughts about it and why to (not)use Zend Framework for your own projects. This is not a comparison of frameworks though, because I don&#8217;t feel like having enough experiences with other frameworks to make a fare comparison, that&#8217;s why this is going to be only a Zend Framework analysis. </p>
<h5>History</h5>
<p>First time I have actually built an application with <a href="http://dev.juokaz.com/tag/zend-framework">Zend Framework</a> was about a half year ago, if I remember correctly version 1.8 was already around. Although my first applications were more than two years ago, but hey were more than tests and playing with at that time new features. So as I said above, not that long ago I switched most of my company&#8217;s code to use Zend Framework, contributed some code and have also started working as Zend Framework consultant (drop me an email if interested), so I think I have a pretty decent experience to judge it.</p>
<p>Before diving in to the analysis, I would like to clarify, that the reasons why I&#8217;m not using other frameworks are mainly caused by the fact that I didn&#8217;t had a chance to do that. Since I&#8217;m usually working with projects lasting more than 3 months, I need to be confident enough to know that after 2 months I don&#8217;t need to throw everything away and start from scratch. Also to test a framework for me is not to create a <a href="http://en.wikipedia.org/wiki/Hello_world_program">Hello World application</a>, I need to build something serious to know what features are missing and what problems can be a big issue. Nevertheless, I&#8217;m planning to do some research sometime.</p>
<h5>Advantages</h5>
<p>For me the most important piece of software: how <strong>customizable</strong> it is. As you might have noticed from the posts like <a href="dev.juokaz.com/programming/service-layer-in-web-applications">this</a>, I usually work with complex web application and would like to have ability to built it from ground up. Zend Framework was perfect for this, because everything is just a collection of building blocks, literally (or <a href="http://en.wikipedia.org/wiki/Loose_coupling">loosely coupled</a> in proper terms). I really liked that there is no <em>default</em> or even worse required structure and everything can be configured very easily.</p>
<p>Because I&#8217;m also in a position responsible for a whole project, <strong>quality</strong> for me is very important. I don&#8217;t know how other frameworks handle this, but <a href="http://www.zend.com">Zend</a> is pretty serious with what&#8217;s in framework and how the code is maintained. Starting from requirement to sign Contributor License agreement (known as <a href="http://framework.zend.com/wiki/display/ZFPROP/Contributor+License+Agreement">CLA</a>) and requirement of 80% unit-tests coverage, ending with <a href="http://devzone.zend.com/article/10049">bug hunt days</a>. Somehow it helps me to have a confidence to rely on the framework, and backwards compatibility has never been an issue (it&#8217;s <a href="http://devzone.zend.com/article/11364-DevZone-updated-to-Zend-Framework-v1.9.5">surprisingly good</a>).</p>
<p><a href="http://dev.juokaz.com/wp-content/uploads/2009/12/zend2.gif"><img class="alignnone size-medium wp-image-950" title="Zend Framework components" src="http://dev.juokaz.com/wp-content/uploads/2009/12/zend2-300x219.gif" alt="Zend Framework components" width="210" height="153" /></a><strong>Variety of components</strong> and libraries makes development faster because I do not need to search for another library (there is also coding standards problem and a lot of smaller libraries are just a bunch of files, without any clear structure). As of today, I probably have used more than 90% of available components and because they tend to share the same configuration style or just work style, it didn&#8217;t took long to start using them. For example, just last night I converted whole application to use custom routes (one custom route per action) in about 4 hours, without having done it before at all.</p>
<p><strong>Community</strong> is number one best thing of Zend Framework. Apart from contributors, there are thousands of people willing to help and share their knowledge. Usually I hangout in twitter (<a href="http://www.twitter.com/juokaz">here</a>), but there are also IRC channels, mailing lists, forums and many more. I&#8217;m subscribed to hundreds of PHP blogs and from what I can see, Zend Framework articles are most common and usually in a very good quality. For me web applications development is not just writing code, so having a wonderful community really helps.</p>
<h5>Disadvantages</h5>
<p><a href="http://dev.juokaz.com/wp-content/uploads/2009/12/sequence_globale.jpg"><img class="alignnone size-medium wp-image-943" style="float: right; margin-left: 5px;" title="Zend Framework dispatch" src="http://dev.juokaz.com/wp-content/uploads/2009/12/sequence_globale-300x201.jpg" alt="Zend Framework dispatch" width="210" height="141" /></a><strong>Hard to learn</strong>. This is not a problem (any more) for me, but can be tricky when working with others, especially with things like form decorators. Even though Zend Framework has a very good <a href="http://framework.zend.com/manual/en/zend.form.elements.html#zend.form.elements.decorators">documentation</a>, I would say, that used techniques are sometimes not straightforward for starters and can lead to a very bad code. As with example with form decorators, once you <em>get</em> them, work with forms will be a joy, however at first they seem as pointless complication. I guess the best thing is just read the manual properly (<a href="http://en.wikipedia.org/wiki/RTFM">RTFM</a> in more rude words) &#8211; you will benefit later.</p>
<p>For some an issue can be that Zend Framework has <strong>no <a href="http://en.wikipedia.org/wiki/Scaffold_(programming)">scaffolding</a></strong>. In short, scaffolding is a user interface and logic generation based on database description and business logic definitions. If you have used frameworks like <a href="http://www.djangoproject.com/">Django</a> (my favorite for Python, has perfect <a href="http://docs.djangoproject.com/en/dev/intro/tutorial02/">scaffolding</a>), you will miss these things and it can be a first &#8220;brick wall&#8221; for your learning. Zend Framework has <a href="http://framework.zend.com/manual/en/zend.tool.project.html">Zend_Tool</a> component which provides basic project generation (you can customize it easily), but this is pretty much everything.</p>
<p>Connected to the both issues outlined above, Zend Framework in general is sometimes <strong>too much loosely coupled</strong>. Because all the components are just separate classes and out of the box you don&#8217;t get any sort of web application, one might have problems trying to understand what to do with all this <em>stuff</em> at all. It&#8217;s a great feature for me, but for someone not having any experience with Zend Framework it is probably impossible to build application without a help of blogs, books or (my recommendation) manual.</p>
<p>As you might have guessed, the fact that Zend Framework has lots of components also means that there should be enough developers to support them. However, this is not always the case and some components are really <strong>lacking new features or updates</strong>. For example <a href="http://framework.zend.com/manual/en/zend.pdf.html">Zend_Pdf</a> is quite out-dated and not moving as fast as a lot of us would like to. But hey, it&#8217;s an open-source framework, so if you have ideas of how to improve things &#8211; you are free to do, believe <a href="http://framework.zend.com/wiki/display/ZFPROP/Zend_Db_Adapter_Sqlsrv+-+Juozas+Kaziukenas+and+Rob+Allen">me</a>, it&#8217;s a great fun to contribute to such a influential software application. Nevertheless, always evaluate available components and choose what&#8217;s best for your project.</p>
<p>There is also the funny part &#8211; misconceptions and myths. I&#8217;ve just started working on a new article about these, so expect some interesting things very soon.</p>
<h5>Conclusion</h5>
<p>I hope it&#8217;s clear, that most of the advantages and disadvantages are coming from the same root &#8211; depending on what experience you have and what you are looking for Zend Framework can be a good or absolutely awful choice. For me it&#8217;s a perfect tool and currently I have no plans (even though <a href="http://www.symfony-project.org/">Symfony</a> is in my todo list) to use something else, and if you look at things which are coming in version 2.0 of both Doctrine and Zend Framework (yes, they will have integration)&#8230; Simply a good solution for serious work.</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.juokaz.com/php/why-zend-framework/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Zend Optimizer and PHP comments</title>
		<link>http://dev.juokaz.com/php/zend-optimizer-and-php-comments</link>
		<comments>http://dev.juokaz.com/php/zend-optimizer-and-php-comments#comments</comments>
		<pubDate>Wed, 04 Feb 2009 17:50:17 +0000</pubDate>
		<dc:creator>Juozas</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[optimizer]]></category>
		<category><![CDATA[production]]></category>
		<category><![CDATA[reflection]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[xmlrpc]]></category>
		<category><![CDATA[zend]]></category>
		<category><![CDATA[zend framework]]></category>

		<guid isPermaLink="false">http://dev.juokaz.com/?p=3</guid>
		<description><![CDATA[Zend Optimizer is nice product, but I can&#8217;t make it work with PHP&#8217;s Reflection. Reflection is very good functionality which allows script to read and extract information from it-self&#8217;s source code. For example, Zend_XmlRpc_Server component checks functions signatures (which are phpdoc comments) to determine if given parameter(s) is valid type, etc.
I have been using Zend [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.zend.com/en/products/guard/optimizer/">Zend Optimizer</a> is nice product, but I can&#8217;t make it work with PHP&#8217;s <a href="http://uk3.php.net/oop5.reflection">Reflection</a>. Reflection is very good functionality which allows script to read and extract information from it-self&#8217;s source code. For example, <a href="http://framework.zend.com/manual/en/zend.xmlrpc.server.html">Zend_XmlRpc_Server</a> component checks functions signatures (which are <a href="http://en.wikipedia.org/wiki/PHPDoc">phpdoc</a> comments) to determine if given parameter(s) is valid type, etc.</p>
<p>I have been using Zend Framework for some time now, and found that only possible way to use XmlRpc Server package is to delete all functions signatures checking. My production server has Zend Optimizer installed and it just breaks Reflection functionality.</p>
<p>For tests I created simple reflection example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 *  My Class
 */</span>
<span style="color: #000000; font-weight: bold;">class</span> test <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$oClassReflect</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ReflectionClass<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Test&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">print</span> <span style="color: #000088;">$oClassReflect</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">getDocComment</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>First time script outputs:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">/**
 *  My Class
 */</pre></div></div>

<p>Next times there is <strong>no output</strong> at all &#8211; all comments are gone (in Optimizer&#8217;s cache). I still can get methods of class (source code is not gone), but I cannot use comments to mark params/return types and later use them to validate I/O.</p>
<p>I don&#8217;t know yet if it&#8217;s a problem with my production server, but Zend manuals are not very clear and I can&#8217;t find any information about comments stripping issue. Has anyone had similar problems?</p>
]]></content:encoded>
			<wfw:commentRss>http://dev.juokaz.com/php/zend-optimizer-and-php-comments/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
