<?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>Giedrius Majauskas blog &#187; Programming</title>
	<atom:link href="http://www.majauskas.com/tag/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://www.majauskas.com</link>
	<description></description>
	<lastBuildDate>Thu, 29 Jul 2010 08:34:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Do you really need that powerful cms for simple projects?</title>
		<link>http://www.majauskas.com/do-you-really-need-that-powerful-cms-for-simple-projects</link>
		<comments>http://www.majauskas.com/do-you-really-need-that-powerful-cms-for-simple-projects#comments</comments>
		<pubDate>Wed, 09 Dec 2009 22:41:11 +0000</pubDate>
		<dc:creator>Giedrius</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://www.majauskas.com/?p=247</guid>
		<description><![CDATA[Last month I took over support of one project that inspired this post. It is a website with couple static pages, news and galleries that was created with Joomla. The problem was that site owners could not support it. They are not computer savvy and the internal structure of admin panel is way too complex [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.majauskas.com%2Fdo-you-really-need-that-powerful-cms-for-simple-projects"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.majauskas.com%2Fdo-you-really-need-that-powerful-cms-for-simple-projects&amp;source=giedrius&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6b70a2205c1a0ba9dbc37392e42c745d" height="61" width="50" /><br />
			</a>
		</div>
<p>Last month I took over support of one project that inspired this post. It is a website with couple static pages, news and galleries that was created with Joomla. The problem was that site owners could not support it. They are not computer savvy and the internal structure of admin panel is way too complex for them to understand.</p>
<p>Funny enough, I would have gone to completely opposite direction with that site design. Based on site requirements, I would install WordPress and code additional functionality. WordPress handles many things better than Joomla:</p>
<ul>
<li>Image upload and resize to sane sizes</li>
<li>Article/news organization</li>
<li>Simpler admin interface</li>
</ul>
<p>And a lot of clients do not need anything more – they do not want to resize media prior uploading, or searching for missing plugins to do that resize on upload time. Also, content and organization is tragic in Joomla, and it is really difficult to comprehend for person that does not work with such systems daily.</p>
<p>Now Joomla has its own uses and I would not create complex sites on wordpress. However, how often developers think about customer needs instead of their development speed and “Power” of the application? Many of us want to show off with powerful options, lots of customizability as we cannot brag about nice code inside to the customer.  Often it is not what customer needs.</p>
<p>Thus it is important to write down requirements of project before putting everything on most powerful CMS you know. Think what user wants to see and make it easy for user to navigate through admin panel to do the tasks he needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.majauskas.com/do-you-really-need-that-powerful-cms-for-simple-projects/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programmer mindset: 5 traits of programmers that have a chance to become good ones</title>
		<link>http://www.majauskas.com/programmer-mindset-5-traits-of-programmers-that-have-a-chance-to-become-good-ones</link>
		<comments>http://www.majauskas.com/programmer-mindset-5-traits-of-programmers-that-have-a-chance-to-become-good-ones#comments</comments>
		<pubDate>Tue, 01 Sep 2009 16:10:32 +0000</pubDate>
		<dc:creator>Giedrius</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.majauskas.com/?p=219</guid>
		<description><![CDATA[Sometime we get a new inexperienced guy in a company as a programmer. Typically, we test them beforehand; however they are rarely perfect when started. Sometimes they are very new to programming or have bad habits from previous programming jobs. Thus it is my goal to help them to improve. And sometimes it gets really [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.majauskas.com%2Fprogrammer-mindset-5-traits-of-programmers-that-have-a-chance-to-become-good-ones"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.majauskas.com%2Fprogrammer-mindset-5-traits-of-programmers-that-have-a-chance-to-become-good-ones&amp;source=giedrius&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6b70a2205c1a0ba9dbc37392e42c745d" height="61" width="50" /><br />
			</a>
		</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Sometime we get a new inexperienced guy in a company as a programmer. Typically, we test them beforehand; however they are rarely perfect when started. Sometimes they are very new to programming or have bad habits from previous programming jobs. Thus it is my goal to help them to improve. And sometimes it gets really hard to integrate the guy into company. However there are some criteria that allow recognizing people with potential on becoming programmers and ones that are better left behind.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">1.<span style="white-space: pre;"> </span>Persistence and knowing how to learn. Even more, urge to try and learn new things. I love programmers that know how to look for information on a problem.  Everyone can do a task they learned, but the best programmers know where to look for an answer and never give up without a good reason. The best way is to give a task they have no experience in and look how they are trying to solve it. If a person gives up prior googling for an answer, he will not be a programmer.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">2.<span style="white-space: pre;"> </span>Ability to integrate various things he learned in different environment. Few programmers learned MVC or frameworks at universities here. However, they have learned FSMs or some other paradigms that can be successfully applied in web development as well. Few try it though <img src='http://www.majauskas.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  (Note: knowing more than one programming paradigm is a bonus).</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">3.<span style="white-space: pre;"> </span>Ability to create a concise logical algorithm for solving a problem. You can be entry level web programmer without that, but that’s it.  Ability to draw these using some popular schematics like UML state diagram is a bonus.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">4.<span style="white-space: pre;"> </span>Ability to debug code of other person. A programmer is unable to learn if he can’t dive into code of someone else and understand how it works. Sooner or later you will have to implement a similar algorithm where you will not be able to use that code as it is. This is closely related to ability to create algorithm.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">5.<span style="white-space: pre;"> </span>Ability to write code other people understands. I loved one programmer that wrote nice functions for everything while coding a trivial task in PHP. Also, he commented a lot. Sadly, his interest was not web programming.</div>
<p>Sometime we get a new inexperienced guy in a company as a programmer. Typically, we test them beforehand; however they are rarely perfect when started. Sometimes they are very new to programming or have bad habits from previous programming jobs. Thus it is my goal to help them to improve. And sometimes it gets really hard to integrate the guy into company. However there are some criteria that allow recognizing people with potential on becoming programmers and ones that are better left behind.</p>
<ol>
<li>Persistence and knowing how to learn. Even more, urge to try and learn new things. I love programmers that know how to look for information on a problem.  Everyone can do a task they learned, but the best programmers know where to look for an answer and never give up without a good reason. The best way is to give a task they have no experience in and look how they are trying to solve it. If a person gives up prior googling for an answer, he will not be a programmer.</li>
<li>Ability to integrate various things he learned in different environment. Few programmers learned MVC or frameworks at universities here. However, they have learned FSMs or some other paradigms that can be successfully applied in web development as well. Few try it though <img src='http://www.majauskas.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  (Note: knowing more than one programming paradigm is a bonus).</li>
<li>Ability to create a concise logical algorithm for solving a problem. You can be entry level web programmer without that, but that’s it.  Ability to draw these using some popular schematics like UML state diagram is a bonus.</li>
<li>Ability to debug code of other person. A programmer is unable to learn if he can’t dive into code of someone else and understand how it works. Sooner or later you will have to implement a similar algorithm where you will not be able to use that code as it is. This is closely related to ability to create algorithm.</li>
<li>Ability to write code other people understands. I loved one programmer that wrote nice functions for everything while coding a trivial task in PHP. Also, he commented a lot. Sadly, his interest was not web programming.</li>
</ol>
<div>Your thoughts ?</div>
]]></content:encoded>
			<wfw:commentRss>http://www.majauskas.com/programmer-mindset-5-traits-of-programmers-that-have-a-chance-to-become-good-ones/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>7 tips on web programming code analysis</title>
		<link>http://www.majauskas.com/7-tips-on-web-programming-code-analysis</link>
		<comments>http://www.majauskas.com/7-tips-on-web-programming-code-analysis#comments</comments>
		<pubDate>Sat, 22 Aug 2009 16:00:51 +0000</pubDate>
		<dc:creator>Giedrius</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[analysis]]></category>

		<guid isPermaLink="false">http://www.majauskas.com/?p=204</guid>
		<description><![CDATA[Quite often I am hired to perform modifications in other web projects done by someone else.  This might be an unmaintained website bought ages ago, or when programmers mess up. It is tough to analyze your own code after couple of years from creation. It is much harder to analyze code of someone else. There [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.majauskas.com%2F7-tips-on-web-programming-code-analysis"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.majauskas.com%2F7-tips-on-web-programming-code-analysis&amp;source=giedrius&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6b70a2205c1a0ba9dbc37392e42c745d" height="61" width="50" /><br />
			</a>
		</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Quite often I am hired to perform modifications in other web projects done by someone else.  This might be an unmaintained website bought ages ago, or when programmers mess up. It is tough to analyze your own code after couple of years from creation. It is much harder to analyze code of someone else. There are so many different programming styles. And most often the code is documented poorly. So, how to do it properly and save the time?</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">1.<span style="white-space: pre;"> </span>Gather all documentation of code if it is available. What framework or library was used? Was a CMS used? If so, you are in luck as these are more or less documented. Not always, though. If the basis used is branded as “software”, the documentation is typically lacking. It is assumed that you don’t need to modify ready to go software.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">2.<span style="white-space: pre;"> </span>Try to map code on some known framework/pattern/approach. If there is clear separation from business logic, database tables and visual representation, you can try to approach the code using MVC. If there is separation between data processing and representation, then it is template based approach. Maybe the system is hook based? This will help to understand how programmers think. Worst kind of code is when business logic calls representation logic which calls some different business logic and so on. Then it might be a mess, especially if you can’t get why programmers decided to do so. Usually there is a different separation taking place between first and second layers of business logic, though sometimes this can be called “quick hack to output specific info” only.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">3.<span style="white-space: pre;"> </span>Try to identify file deployment structure and write it down. Where are configuration files, templates, classes located? What is structure based on?</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">4.<span style="white-space: pre;"> </span>Draw a basic request scheme on paper. What files/modules the request passes till result is send to the user? This will help you to better understand the software.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">5.<span style="white-space: pre;"> </span>Identify places you need to make modifications. The best help is simply stopping execution in various places of file and seeing what data you have at these places. Die(), echo and print_r are the best friends.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">6.<span style="white-space: pre;"> </span>Stick to commenting out old code and commenting changes you make. Make it easy to undo your changes, and make it easy to understand what you have done.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">7.<span style="white-space: pre;"> </span>Last, but not least, test everything.</div>
<p>Quite often I am hired to perform modifications in other web projects done by someone else.  This might be an unmaintained website bought ages ago, or when programmers mess up. It is tough to analyze your own code after couple of years from creation. It is much harder to analyze code of someone else. There are so many different programming styles. And most often the code is documented poorly. So, how to do it properly and save the time?</p>
<ol>
<li>Gather all documentation of code if it is available. What framework or library was used? Was a CMS used? If so, you are in luck as these are more or less documented. Not always, though. If the basis used is branded as “software”, the documentation is typically lacking. It is assumed that you don’t need to modify ready to go software.</li>
<li>Try to map code on some known framework/pattern/approach. If there is clear separation from business logic, database tables and visual representation, you can try to approach the code using MVC. If there is separation between data processing and representation, then it is template based approach. Maybe the system is hook based? This will help to understand how programmers think. Worst kind of code is when business logic calls representation logic which calls some different business logic and so on. Then it might be a mess, especially if you can’t get why programmers decided to do so. Usually there is a different separation taking place between first and second layers of business logic, though sometimes this can be called “quick hack to output specific info” only.</li>
<li>Try to identify file deployment structure and write it down. Where are configuration files, templates, classes located? What is structure based on?</li>
<li>Draw a basic request scheme on paper. What files/modules the request passes till result is send to the user? This will help you to better understand the software.</li>
<li>Identify places you need to make modifications. The best help is simply stopping execution in various places of file and seeing what data you have at these places. Die(), echo and print_r are the best friends.</li>
<li>Stick to commenting out old code and commenting changes you make. Make it easy to undo your changes, and make it easy to understand what you have done.</li>
<li>Last, but not least, test everything.</li>
</ol>
<div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.majauskas.com/7-tips-on-web-programming-code-analysis/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to make really unsafe session management (that is still used today)</title>
		<link>http://www.majauskas.com/how-to-make-really-unsafe-session-management-that-is-still-used-today</link>
		<comments>http://www.majauskas.com/how-to-make-really-unsafe-session-management-that-is-still-used-today#comments</comments>
		<pubDate>Sun, 16 Aug 2009 16:00:15 +0000</pubDate>
		<dc:creator>Giedrius</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.majauskas.com/?p=193</guid>
		<description><![CDATA[Today I want to talk about really unproductive topic – that is how to code poorly. Or, more exactly, I am going to pick on my unfavorite  piece of social site again, that is Boonex. We will talk about how one should not implement user sessions and how to do it better. Boonex uses unencrypted [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.majauskas.com%2Fhow-to-make-really-unsafe-session-management-that-is-still-used-today"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.majauskas.com%2Fhow-to-make-really-unsafe-session-management-that-is-still-used-today&amp;source=giedrius&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6b70a2205c1a0ba9dbc37392e42c745d" height="61" width="50" /><br />
			</a>
		</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Today I want to talk about really unproductive topic – that is how to code poorly. Or, more exactly, I am going to pick on my unfavorite  piece of social site again, that is Boonex. We will talk about how one should not implement user sessions and how to do it better.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Boonex uses unencrypted cookies to store session data, that is member ID and hashed member password. Each request Boonex checks database for memberID and password combination. This is to ensure that the person would be logged off the system if password is changed by someone else.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Thus, what is the problem with this approach?</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Well, what about making hashed passwords save on PC user logs in? These passwords remain available till user explicitly logs out.  And the hash used is a simple md5 hash which is fast one-way function. You cannot reverse it, but it is susceptible for dictionary or brute force attacks. There are databases for such md5 strings as well.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">You could partly solve that problem by using a seed with the hashed password. However, it would make the password guessing game more complex but not impossible. Also, you do not need the password for being logged in, just the cookies. And it is quite simple to change values in them with Firefox.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Another problem we had is with effectiveness of this password checking. It is one of multiple requests that are done on each page load. Even when they are fast, they affected boonex performance, which is quite bad anyways. But caching this information makes a security hole open:  ID could be changed and your system could be compromised.</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">It is much safer to save session information on server side.  PHP native session management is much better than what boonex has to offer, thus you should switch to it in the code (I have demo version of boonex  7 on August, it still has this problem).   It is quite some work, but it is worth it. Or, even better, look for some other social network script.</div>
<p>Today I want to talk about really unproductive topic – that is how to code poorly. Or, more exactly, I am going to pick on <a href="http://www.majauskas.com/boonex-bad-programming-example">my unfavorite  piece of social site again, that is Boonex</a>. We will talk about how one should not implement user sessions and how to do it better.<img class="size-thumbnail wp-image-197 alignright" title="boonex" src="http://www.majauskas.com/wp-content/uploads/2009/08/boonex-150x150.jpg" alt="boonex" width="150" height="150" /></p>
<p>Boonex uses unencrypted cookies to store session data, that is member ID and hashed member password. Each request Boonex checks database for memberID and password combination. This is to ensure that the person would be logged off the system if password is changed by someone else.</p>
<p>Thus, what is the problem with this approach?</p>
<p>Well, what about making hashed passwords save on PC user logs in? These passwords remain available till user explicitly logs out.  And the hash used is a simple md5 hash which is fast one-way function. You cannot reverse it, but it is susceptible for dictionary or brute force attacks. There are databases for such md5 strings as well.</p>
<p>You could partly solve that problem by using a seed with the hashed password. However, it would make the password guessing game more complex but not impossible. Also, you do not need the password for being logged in, just the cookies. And it is quite simple to change values in them with Firefox.</p>
<p>Another problem we had is with effectiveness of this password checking. It is one of multiple requests that are done on each page load. Even when they are fast, they affected boonex performance, which is quite bad anyways. But caching this information makes a security hole open:  ID could be changed and your system could be compromised.</p>
<p>It is much safer to save session information on server side.  PHP native session management is much better than what boonex has to offer, thus you should switch to it in the code (I have demo version of boonex  7 on August, it still has this problem).   It is quite some work, but it is worth it. Or, even better, look for some other social network script.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.majauskas.com/how-to-make-really-unsafe-session-management-that-is-still-used-today/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>5 things to look at when comparing php frameworks</title>
		<link>http://www.majauskas.com/things-to-look-at-when-comparing-php-frameworks</link>
		<comments>http://www.majauskas.com/things-to-look-at-when-comparing-php-frameworks#comments</comments>
		<pubDate>Thu, 11 Jun 2009 15:38:13 +0000</pubDate>
		<dc:creator>Giedrius</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.majauskas.com/?p=152</guid>
		<description><![CDATA[I had read a post at sitepoints about 16 php 5 frameworks. I will not argue the fact that frameworks are good and you should use one. What saddens me is that the key points of comparison are omitted in the post. So, how to compare different php 5 frameworks? Let us see. 1. Paradigms [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.majauskas.com%2Fthings-to-look-at-when-comparing-php-frameworks"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.majauskas.com%2Fthings-to-look-at-when-comparing-php-frameworks&amp;source=giedrius&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6b70a2205c1a0ba9dbc37392e42c745d" height="61" width="50" /><br />
			</a>
		</div>
<p>I had read a post at <a href="http://www.sitepoint.com/blogs/2009/06/09/16-php-frameworks/">sitepoints about 16 php 5 frameworks</a>. I will not argue the fact that frameworks are good and you should use one. What saddens me is that the key points of comparison are omitted in the post.</p>
<p>So, how to compare different php 5 frameworks? Let us see.</p>
<p>1.	Paradigms used. Although MVC is mainstream now, it is not a single paradigm in php development. There are frameworks that are event based only. Additionally, there are different paradigms for different application layers, for example <a href="http://en.wikipedia.org/wiki/Create,_read,_update_and_delete">CRUD</a> for database (model) layer, pretty well supported in php cake.  Zend does not have module layer at all, you need to use your own database access, as example.</p>
<p>2.	Modularity and reusability of framework. Although MVC provides modularity on controller- basis, additional modularity is required to re-use code between applications. This is important for developing bigger project that share modules.</p>
<p>3.	Php version support.  Some frameworks require specific versions of php5. This means that you have limited options for hosting.</p>
<p>4.	Shared hosting support. You might need that before project kicks in. Some frameworks behave weirdly on shared hosting, as they need specific setup.</p>
<p>5.	Proof of concept and maturity. Have you seen applications developed with the framework? Is framework developer community active or dormant? I would shun a framework without some real-world example sites.</p>
<p>Have something to add? Comment bellow!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.majauskas.com/things-to-look-at-when-comparing-php-frameworks/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Specifications – you need them for web project as well</title>
		<link>http://www.majauskas.com/specifications-%e2%80%93-you-need-them-for-web-project-as-well</link>
		<comments>http://www.majauskas.com/specifications-%e2%80%93-you-need-them-for-web-project-as-well#comments</comments>
		<pubDate>Fri, 29 May 2009 19:57:49 +0000</pubDate>
		<dc:creator>Giedrius</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[specifications]]></category>

		<guid isPermaLink="false">http://www.majauskas.com/?p=143</guid>
		<description><![CDATA[My blog post is inspired by a meeting where I had a role of mediator between web developing company and customer. The issues were quite simple and common: increasing costs due to neglected specifications and some badly described features. Customer and web development company are in the same boat, although this fact is often forgotten [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.majauskas.com%2Fspecifications-%25e2%2580%2593-you-need-them-for-web-project-as-well"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.majauskas.com%2Fspecifications-%25e2%2580%2593-you-need-them-for-web-project-as-well&amp;source=giedrius&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6b70a2205c1a0ba9dbc37392e42c745d" height="61" width="50" /><br />
			</a>
		</div>
<p>My blog post is inspired by a meeting where I had a role of mediator between web developing company and customer. The issues were quite simple and common: increasing costs due to neglected specifications and some badly described features.</p>
<p>Customer and web development company are in the same boat, although this fact is often forgotten once it is time to show the work and pay the money. The typical problem is lack of signed specifications. There are several reasons why specifications were not prepared:</p>
<ol>
<li>&#8220;The project is too simple for specifications&#8221; FALSE &#8211; there is no project too simple for specifications</li>
<li>&#8220;The project is too complex to specify it in one go&#8221; FALSE &#8211; There should be specifications made for separate parts of the project and compiled into whole document.</li>
<li>&#8220;xxx development model  does not requires specifications because it is superior&#8221; FALSE. I hear this quite often from &#8220;fans&#8221; of Agile-alike development model. Although the whole spec is not prepared, you have to write down what are you making right now.</li>
<li>&#8220;The customer will not understand the specification&#8221; YOUR PROBLEM &#8211; customers are not dumb.  As long as you use human language, they will understand you. The goal of specification is to explain for both sides what to build and what to expect</li>
<li>&#8220;They haven&#8217;t asked for one!&#8221; They need one, though. And in fact, you need a specification too. I have seen customers using awkward terminology that can be very confusing for people outside their company. The web project specification helps in cases client refuses to pay because they expected something else.</li>
</ol>
<p>Typically, lack of specifications is assisted by pay-per-hour payment model. This is quite useful short term for the company which wants to make money from the customer, but is quite bad long-term strategy.  Specification saves time used for redoing project, which leads to customer frustration. And frustrated customer is not a customer that is happy to pay and hire you again.</p>
<p>Furthermore, good explanation of things between client and developer saves lots of time that would be used to develop too complex and completely useless things. During the discussion I mentioned above customer had to explain to developer lead that all they needed for particular attribute was a simple manual checkbox instead of complex automated state machine (and couple other problems). That would not have happened if they took care to update a specification.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.majauskas.com/specifications-%e2%80%93-you-need-them-for-web-project-as-well/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top tricks for reducing server loads on image-heavy site</title>
		<link>http://www.majauskas.com/top-tricks-for-reducing-server-loads-on-image-heavy-site</link>
		<comments>http://www.majauskas.com/top-tricks-for-reducing-server-loads-on-image-heavy-site#comments</comments>
		<pubDate>Wed, 14 Jan 2009 09:06:39 +0000</pubDate>
		<dc:creator>Giedrius</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[images]]></category>

		<guid isPermaLink="false">http://www.majauskas.com/?p=96</guid>
		<description><![CDATA[For 4 years I work on some image heavy projects. I started clueless. Now, when I look at first works they are not so good, though I have seen far worse implementations of such sites. Such sites have quite a lot common bottlenecks that can be solved using some of the &#8220;design patters&#8221;. The top [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.majauskas.com%2Ftop-tricks-for-reducing-server-loads-on-image-heavy-site"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.majauskas.com%2Ftop-tricks-for-reducing-server-loads-on-image-heavy-site&amp;source=giedrius&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6b70a2205c1a0ba9dbc37392e42c745d" height="61" width="50" /><br />
			</a>
		</div>
<p>For 4 years I work on some image heavy projects. I started clueless. Now, when I look at first works they are not so good, though I have seen far worse implementations of such sites. Such sites have quite a lot common bottlenecks that can be solved using some of the &#8220;design patters&#8221;.</p>
<p>The top problems in no particular order are as follows:</p>
<ol>
<li>Disk space</li>
<li>Throughput</li>
<li>Speed </li>
<li>Memory</li>
</ol>
<p>Although disk space is cheap nowadays, it is still important for couple reasons, namely in shared/vps hosting it is limited, or when considering backup solutions.  So you should not store images bigger than needed, though you will need creating various formats used for site.</p>
<p>These additional formats are needed to save from one of the biggest bottlenecks in the image heavy websites, that is image processing. I have seen lots of websites that scale the images dynamically on each image view. That&#8217;s flawed approach. You will need lots of processing power, and the pages will always load slower. Converting images should be done once, either on upload or on specific event.</p>
<p>Should you save original images is up to you, but I would recommend stripping unnecessary information from them and compressing to ~70% quality or so if they are JPEG. That would not impact their visual appearance too much, but will save lots of space. In some cases this is not applicable.</p>
<p>You should never scale images using image tag attributes or styles, or the image will look like crap. Also, this will not save bandwidth.  Always create formats required for site, in the worst case you will regenerate images when you need them.</p>
<p>Another thing related to speed of image site is its disk access. Although there are RAIDs, on very busy sites that&#8217;s not enough. So sooner or later you will have to think how to serve images from another server than dynamically generated content (php scripts/db). This can be done in various ways, for example using network disks mapping your infrastructure, though the best way around is using separate subdomain for static content. </p>
<p>There is one more quite unexpected load -eater as well. That is logs. I would not recommends switching logs off, but you should minimize the amount you write to error log. We managed to reduce loads by 1/3  by just fixing single banner with wrong URL. Use full URIs if you have to. But check the logs after you code, please. </p>
<p>There is another reason having statical content served on separate sub domain. The reason is memory. A typical apache process takes around ~30-50m. And it serves both complex php scripts and tiny icons used in design. So, using lighthttpd or similar simple and very fast web server for static content is quite useful. Then you can focus on servers disk qualities than memory amount.  It is even useful keeping these 2 webservers running on same physical server through 2 IPs. On the long term you will notice significant load decrease, limited by disk access alone.</p>
<p>It is quite strange that most of the commercial server setups do not take this into account. Most usually, control panels use single web server (aka Apache) for hosting all the contents and you have to setup everything manually.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.majauskas.com/top-tricks-for-reducing-server-loads-on-image-heavy-site/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Boonex &#8211; bad programming example</title>
		<link>http://www.majauskas.com/boonex-bad-programming-example</link>
		<comments>http://www.majauskas.com/boonex-bad-programming-example#comments</comments>
		<pubDate>Wed, 26 Nov 2008 13:35:41 +0000</pubDate>
		<dc:creator>Giedrius</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[boonex]]></category>

		<guid isPermaLink="false">http://www.majauskas.com/?p=68</guid>
		<description><![CDATA[Boonex is an assembly of social site php scripts including chats, forum and the site itself. As we work on several social sites this year, we have chosen boonex as starting platform to build things upon and kinda regret it now.  I wrote a post about newscloud a year ago and about pligg. Well, boonex [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.majauskas.com%2Fboonex-bad-programming-example"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.majauskas.com%2Fboonex-bad-programming-example&amp;source=giedrius&amp;style=normal&amp;service=bit.ly&amp;service_api=R_6b70a2205c1a0ba9dbc37392e42c745d" height="61" width="50" /><br />
			</a>
		</div>
<p>Boonex is an assembly of social site php scripts including chats, forum and the site itself. As we work on several social sites this year, we have chosen boonex as starting platform to build things upon and kinda regret it now. </p>
<p>I wrote a post about <a href="http://www.majauskas.com/newscloud-media-platform-review">newscloud</a> a year ago and about <a href="http://www.majauskas.com/pligg-review">pligg</a>. Well, boonex is shittier than pligg and as newscloud as well. Why ? Lets tackle some of its problems<span id="more-68"></span></p>
<p style="color: red;">Boonex problem nr1. No coding standard </p>
<p>Boonex is writen by several people using different technologies. Its main base (Dolphin) is writen in pure php with its own template engine and forum  (Orca) uses xlst. That has large negative impact to integration of forum in site and site in forum. When coding, please use single technology and template system. </p>
<p>Whats even worser, different parts of dolphins code itself is writen by completely different people, and very in the hurry. So everyone has its own imagination how to interact with different parts of the code. It is very tricky to modify code that way to suit site needs. </p>
<p style="color: red;">Boonex problem nr2. Template engine and separation of code/design/database</p>
<p>This problem in dolphin/boonex needs a point on its own. Boonex uses custom template system ( that should be called layout system). The blocks of generated html code are pased to specific places in the template. That creates a big headache for programers as they need to search through code for the place where some box is generated. It might be generated in template, or in specific function in one of numerous includes. And so on. Even pligg has better templating than this. </p>
<p>It is very tricky to rip boonex templating apart, as whole coding is based on such poor programming practice. They would be better off using existing template system like smarty or similar one. </p>
<p>This leads to problem nr3</p>
<p style="color: red;">Boonex problem nr3. Crapy use of Database</p>
<p>We saw serveral other competing sites launched on boonex, but we did not care much. Why? Becouse when they reach 500-1000 daily visitors they will break apart. The reason for it is very bad programming and use of database. </p>
<p>For example, boonex uses profile builder which assigns fields to profiles. So the output of profile uses more than one table and is quite inefficient. </p>
<p>Also, there is a nice 20-30 query overhead on each page display to fetch all the configuration values from table. Silly, isn&#8217;t it ? They would be FAR better of using a file for configuring sofware or caching it in php file like it is done in most of the systems. </p>
<p>Another simple problem. When boonex wants to display a profile being online it additionally check database for its status. But that data was pulled from database already. So 20 useless queries again. </p>
<p style="color: red;">Resume</p>
<p>I would not suggest using boonex if you want to keep your programmers sane. We have have changed the code almost completely for now, and you will need to do that too.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.majauskas.com/boonex-bad-programming-example/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>
