Agile Methodology vs classical development

Please do realize that for the sake of brevity, I am oversimplifying at least half a dozen techniques (such as extreme programming , SCRUM or Feature Driven Development)  about which books have been written to a bullet point list... This article is more meant as a way to create an interest. You can read the manifesto in full at http://agilemanifesto.org/ .   Traditionally, software was written in a big cycle that started with planning, continued to implementation, testing, deployment of all features at once and then the software development was considered done. The feature set was decided in advance and in that context moving one tiny bit from that feature set was frowned upon. There was no requirement to have intermediary release and feedback came only after the application was finished. Agile methodology is en vogue and it really offers interesting concepts to programming, namely: The idea stems from the fact that often, the developer ends up knows about implementing the product only after having done the whole process a first time and by using this method, you get to optimize what works as you go along. You also have the client more productive immediately by rolling out updates as you go along. Further, you can rectify wrong turns as you go along because you get constant feedback from the customer... indeed, this is a particularly seductive method. Ideally all is well in wonderland. However, keep in mind that with this method, it is very easy to go astray from the original development goals... which is fine as long as the client goes along with the direction the project is taking. It is ideal in case of inhouse development. Developers must be careful when using Agile methods while on a contract because the client can always go, "this is not what we originally convened". For this cases, it is good to put in place processes to track the changes and client validation. In my humble opinion, it is also good to have a set of general guidelines, a direction to get to in mind that does stay constant or you may end up with tons of nice features that are fully functional due to the nature of agile method but not necessarily as useful. Further, Agile is criticized by some as a way to simplify programming... it is not if done right. Indeed, by having constant testing, constant shipping versions and progressive deployment, I would argue that more complexity is introduced and in the end it does bring about a positive change... ie better code and avoiding of costly mistakes. One thing is certain, spend time on picking a methodology to formally structure your development, especially in group development. Also one method may work best for one project and slow down the development of another... be agile, even about your development method Happy programming

General Tips

This is a section that will contain tips that are applicable to more than one platform and related aspects of Web Development such as good practices and things like that. [sb_child_list]

ami ec2 quick LAMP install

This is what I run when I want to quickly create an AWS instance running apache, mysql and php:
yum install -y php-mysql php-xml php-mcrypt php-mbstring php-gd yum install -y php-pear yum install -y mysql-server yum install -y php-devel yum install php-pecl-apc yum install -y php-pear php-devel httpd-devel chkconfig --levels 235 httpd on chkconfig --levels 235 mysqld on service mysqld start service httpd start echo max_allowed_packet=16M>>/etc/my.cnf echo delayed_insert_timeout=10000>>/etc/my.cnf echo connect_timeout=100000>>/etc/my.cnf
Note: if you need pretty url, make sure that mod_rewrite is enabled (Enabled by default on centos and Ubuntu: a2enmod mod_rewrite). Then make sure the httpd config /etc/httpd/conf/httpd.conf allows overrides AllowOverride all) Then, if I need drush, I install it with the following 2 lines:

pear channel-discover pear.drush.org pear install drush/drush

Installing an ssl host

in /etc/httpd.conf <virtualhost *:443> ServerName secure.webdevpower.com ServerAdmin webmaster@webdevpower.com SSLEngine On SSLCertificateFile /etc/certs/webdevpower.com.crt SSLCertificateKeyFile /etc/certs/webdevpower.key SSLCertificateChainFile /etc/certs/gd_bundle.crt Options FollowSymLinks DirectoryIndex index.html index.php DocumentRoot "/var/www/html/secure" </virtualhost>

Create linux swap file

Adding a swap file helps with performance, especially on machines with low memory. Here is my way to create one: dd if=/dev/zero of=/swapfile1 bs=1024 count=4524288 #df -k mkswap /swapfile1 chown root:root /swapfile1 swapon /swapfile1 echo '/swapfile1 swap swap defaults 0 0' >> /etc/fstab

useful shell one liners

The following are a few one liner shell commands I occasionally use:

Node.JS+MongoDB on CentOS

Another selling point is that if you use node.js with a database server like mongodb, it allows to code the whole web application in Javascript. Though most developers have a love/hate relationship with Javascript that varies depending on the day, it simplifies code writing by using javascript all the way from the Server side to the client Side. Because it is relatively recent, it does not run out of the box on Centos Installs. Here are the steps I used:
#Install the EPEL/ IUS repositories from http://iuscommunity.org/ wget http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/epel-release-6-5.noarch.rpm wget http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-11.ius.centos6.noarch.rpm yum localinstall epel-release-6-5.noarch.rpm yum localinstall ius-release-1.0-11.ius.centos6.noarch.rpm #Install Mongo DB: yum install mongodb-server #install build tools yum install openssl-devel gcc-c++ gcc #Download node.js wget http://nodejs.org/dist/node-latest.tar.gz tar xzvf node-latest.tar.gz #change to node directory - version 0.10.5 as of this writing #your actual directory name may be slightly different cd node-v0.10.5 #build node ./configure make make install

Use version control

Source control systems like GIT are targeted at helping developer teams work together and indeed, they allow massive productivity gains in these scenarios. However, it is important to note that even working solo, source control systems like git can be extremely useful. Here are some of the key benefits Of course, when you are in a team, it helps even more

Optimize performance

You may think your site is too small for performance optimization... it is never true... with the nature of the web, it is always good to be ready for any inflow of visits after you get linked from a popular website. Further, the more responsive your site is, the more people will appreciate their visit (including you). A nonresponsive site will take more time to be indexed, more likely to be forgotten by users who will be less likely to come back. As a matter of fact, google did a study and if the web page takes more than 5 seconds to load, 25% people will leave the page... so if your page is taking too long to load, you are losing people already.

Optimization tip: Optimize database requests

Relational databases rock when it comes to extracting data but they are very resource hungry. Here are a few things you can do

Optimization tip: Consider a daemon process

Sometimes you need to access data or resources with a long init process. By offloading this to a daemon that stays in memory and optimizes calls, some long processes can make the query instantaneous.

Optimization tip:Consider a cron job

Some tasks such as caching, prefetching data can be offloaded to a cron job that would run at regular intervals, preferably to offpeak times

Optimization tip: Consider using specialized servers

Search engines are a good example. Some machines will crawl, others will index the data and others will serve the data... If you have limited web power resources such as a VPS. Consider running some processes at home where having a powerful machine is free for you.

Optimization tip: Optimize code

Optimization tip: Load balancing

Optimization tip: cache content

RSS feeds, databases and fetched data like social network interaction can bring lots of power to your site... but it can really slow your website. Make sure the cache refreshes enough yet refresh as little as possible (in some cases data can be cached for days). Either in a simple way or through specialized processes like memcache. This particularly holds true for anonymous access of the landing page which often contains non user specific content.

Optimization tip: Alternative servers

servers nginx like nginx can instantly boost your performance (though to be fair apache has done efforts to catch up). Consider alternatives to all server processes.

Optimization tip:  consider different/ simpler programs

Some great software is out which can do tons of stuff... yet at the cost of added resources. If all you need is a picture gallery, consider a simple gallery program and not a big complicated CMS that will have a picture feature

Optimization tip: consider static pages

Many times, dynamic pages are necessary... but sometimes, a simple html file will do, maybe offloading the dynamic part to a script

Optimization tip: Separate Static content

It is good to host static content on a separate server. Even if your server is under heavy load, the images/ css will load faster faster

Optimization tip: Only run the services needed

On development machines, it is tempting to enable tons of services that you will not use for fun and wow factor... on production machines, run only what is needed. Not only will your server be more responsive but it makes your installation more secure with less security holes.

Optimization tip: optimize images, css, preload

Good luck in making sites more responsive

Building your reputation

When you work as a consultant, especially if you are independent, it is good to look at the long run so a few things can help:

In the end it is about perceived value about your work and keeping the customer happy.

Kloxo: park many domains at once

With google retiring parked domains, you may want to host a parking page yourself... which is easy to do yourself but if you have hundreds of domains, what do you do? Assuming Kloxo is installed (which preassumes centos 5), with the following script, you can add all of them in one go parked to a parent domain with the following script:
#!/bin/bash
if [[ $# < 1 ]]; then
  echo "Mass Domain Add via Kloxo"
  echo Usage:
  echo "addparked parentdomain.com <1perlinedomainfile.txt"
  echo addparked parentdomain.com
  exit
fi
while read line
do
   /script/add --parent-class=domain --parent-name=$1 --class=addondomain --name=$line--v-type=parked
done

Document & script as much as you can

When a server is installed, many commands are typed. When an application is installed, many config files are changed and though you may get a working machine slightly faster, it is good to document the install process as you go along for several reasons: Ideally, going one step further, scripting the install process is good for several reasons As for the backup, automate it and have more than one copy

KISS Principle

A good way to be productive is the KISS principle (Keep ISimple & Sweet  or  Keep ISimple, Stupid depending on who you ask :) )

When you start a project it may appear tempting to implement all features with buzzwords bells and whitles, making everything perfect. Unfortunately, this may lead to tons of delays and end up with a very complex product that is not adapted to the real needs, especially if the product is at the proof of concept stage. 

The KISS principle says that it is good to have a working imperfect product deployed, get feedback and bring only the additional features. Structure your product into easy to master pieces and implement each one as simply as you can... you can always come back and improve on the pieces with missing functionality afterwards.