Tuesday, 22 June 2010

Facebook Broadening Their Horizons

Unless you've been living under a rock for the last few years you'll have heard of Facebook, the world's largest social network. The idea is simple, you add your friends to your profile, this then enables you to message them both publically and privately, share photos with them and organise events together easily.

The next in the Facebook evolution was the launch of the Facebook platform. This allowed developers to tap into the wealth of data that Facebook had and create a huge magnitude of applications that ran within Facebook. At a time when many believed that Facebook had saturated the market and left many people asking "so what now?", the platform opened doors for everyone involved. Facebook now has hundreds of thousands of applications, from games, to quizes, to social platforms within Facebook itself.

Next came Facebook Connect. Facebook Connect allowed website owners to link their websites to Facebook so that users didn't have to sign in at various places, and keep re-entering their data. Mainly large sites took this on at first, and it soon took off. Now it's not uncommon to see the 'Facebook Connect' logo next to the traditional login areas of a website, and most people tend to opt for the ease of it's use over the traditional saga of logging in or signing up.

Now we're at the next stage; social widgets. The social widgets are simple plug-ins for websites that can add functionality very quickly and very easily. Website owners can show lists of friends so that users logged into Facebook can quickly begin chatting or get to their friends profiles. One of the main features is the simple 'Like' button. This bit of technology gets placed on the website owners pages, and when clicked by someone logged into Facebook the page will be shared in the user's feed, "Mike Griffiths likes Blogger", where 'Blogger' is a clickable link to the liked page. If set up correctly the 'Like'd page is also categorised in Facebook's own systems, appearing under the interests of the user and within Facebook's search results.

Whole websites have sprouted up around Facebook's Like button, such as Like It where users are encouraged to make their own pages to Like, and then Like others'.

Not all of Facebook's evolutionary steps have been a success though. 'Beacon' was made a big fuss of by Facebook, and never lasted more than a few months. Beacon was a widget placed on website owners' sites that published to the user's feeds when they did something of note. It quickly became popular on games websites where users could share how they've just 'played xyz on abc'. The automity of this action soon led to privacy fears though, and lots of users didn't like how the website could just post to their profile without expressed permission (although initial permission is required). It also led to some anger as website owners were very rarely excepted, and only the largest of sites got access to the tool, which could have easily led to monopolies in traffic.

Where to next? Facebook has been rumoured to be integrating email fully into its systems, possibly to rival Gmail, Google's answer to email. We'll all be excited to see that. Is Facebook trying to take over the world, or just after more of a chunk? I guess we'll have to wait and see.

Wednesday, 16 June 2010

CodeIgniter - The next natural step

Most web developers have their own code base that they refer back to on a regular basis. Many have even developed their own simple platforms that do a lot of the leg work for them, that they know inside out and can easily deploy on a new project.

More recently though, at least in the last 4-5 years, frameworks have been popping up left right and centre. From CakePHP, which is generally considered to be a little unstable, to the super-reliable ZendFramework, built by Zend - the PHP company.

Zend and Cake are not he only frameworks though. After trying a lot, I find my personal favourite to be CodeIgniter, which is built by EllisLabs.

CodeIgniter comes with libraries and helpers that can be activated at any point within the framework. These helpers try and simplify many tedious tasks involved with making web applications. Things like form validation is a breeze, and the functions used are much more powerful than something that can be drummed up quickly in any normal PHP app. Image manipulation is made easy, and emailing through PHP can be done well without needing to load in the bloated PEAR, which the documentation recommends.

CodeIgniter uses standard MVC (Model > View > Controller) to create it's systems. Although at first glance this can seem a little silly and over-thought, but it makes life a lot easier for everyone involved. The MVC structure is standardised, reliable and fast, and every developer should follow suit with it very easily.

CodeIgniter also makes debugging applications very easy. The built-in profiler shows all of the POST, and GET data, aswell as all database queries. I used a customised version of the profiler that I tweaked to also show SESSION data.

When working with lots of small, simple queries CodeIgniter also makes life easy with active records, their database library. It allows queries to be written with a fraction of the amount of code. Let's say we want to pull off everything from a table, simple: db->get('table') - no need to write a full query to do it. Active records do support large queries with unlimited amounts of JOINs, but my personal preference is to compile these myself and throw them into a normal query using the DB library's db->query() method - probably because I'm used to the structure of the queries and the syntax so I can spot errors more easily. If you're not hot on SQL though, you'll probably benefit massively.

My personal framework recommendation is definitely CodeIgniter, but make sure you check out all of the others available too. CodeIgniter has a massive community that helps solve any problem you may have, the community includes forums and live chat rooms, which the EllisLabs developers often frequent.