Tag: framework
CodeIgniter – The best framework for the job?
by Mike on Jun.18, 2010, under Findings, General, Web Development
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.
Facebook Framework
by Mike on May.20, 2009, under Findings, Web Development
As you may be aware from reading this blog I have recently been using the Facebook Framework to develop two applications, Football Badges and University Badges. At time of writing both applications are doing reasonably well – Football Badges has 1,100 users and University Badges has 30 – but University Badges was only accepted into the application directory a few days ago.
While using the framework the main issue I found with it, as with a lot of frameworks and APIs, is the distinct lack of documentation. I have experience developing with a lot of different web applications, and it’s never normally a suprise to find something poorly documented, but I thought something as mainstream as the Facebook Framework would be an exception. Although there is documentation available, it is in the form of a wiki – which can work fine, but this wiki is clearly not maintained very well and is left up to developers to guess a lot of the frameworks functionality. Take for example the page that is aimed at helping developers to create a box on users profile pages, the majority of the wiki page is taken up by a huge conversation had on the Facebook IRC help channel on Freenode where a user was trying to update their profile box. Where this may be a little helpful, it’s highly unprofessional. All Facebook needs to do is to donate a few days of one of their framework developers time to properly write up the documentation and they will likely attract hundreds of new developers and successful applications.
One problem I have also found with the framework is the way it handles user profiles. Everything is cached on Facebook’s servers before it is shown on the users profile page, this greatly limits the kind of applications that you can create. For example, if I want to create an application that keeps track of how many visitors a user has had on their profile, I would normally display a 1×1 transparent gif and track how many times it is loaded from my server, but because everything is cached on Facebook’s servers it will only ever be loaded once from my server. You can only use set HTML items too, I fully understand the reasoning for this, as otherwise applications would go overboard and Facebook would soon turn into MySpace, but perhaps Facebook could grant additional privledges to trusted developers to try and enhance the users experience.
Another problem is that users must actively choose to add an application to their profile page. This is probably for the best as otherwise all applications would add huge boxes to user profiles to generate more traffic. It does, however, pose problems for applications like mine that are based around the profile page. It can be very mis-leading to a user, let me explain: A user see’s my application and adds it. Any normal user would now think they have a Football Badge on their profile page, they’d be wrong. The user then has to click the ‘Add to profile’ button on my applications pages. I have made it blindingly obvious what to click to try and ensure 100% of my users do it, but it does divert attention away from the application itself and is an unnessesary step for applications like mine.
I have also noticed some problems with the frameworks deployment. My applications are relatively small in comparison to a lot of the applications out there, but I too have noticed problems. The servers don’t seem to be kept up-to-date, especially recently. I have around 1,100 users on my Football Badges application, normally I get around 15 new users a day. Last week there were reported to be no new users, then this week there were 150 users added in a day. I doubt this is an anomally, especially after scanning the forums and finding a lot of others having the same problem, some of whom are developing applications with millions of users, not thousands.
A lot of people have raised concerns about privacy issues with the platform. Anyone can apply for a developers license and it’s all automated so there is no vetting. You only need 20 users in order to submit the application to the app directory so that it is searchable and addable by all. Once you have your developer key you gain access to nearly every piece of data Facebook has on their users, this seems like a massive concern. However, I don’t see it that way. Users must grant privledges to the application before it can access anything. The user can also limit what the app can see and use. Even if the user grants the application full access, it will only be able to use what friends can see on their profile so for the majority of users, this isn’t even an issue. I can, however, see a problem for the security conscious. Facebook allows users to pick whether their profiles are crawlable or not by Google and other search engines. I personally chose to hide mine. If an application is granted privledges to access that user data there is no telling what they can do with it. The developers can easily create an application that stores your information on their servers when you access one of their application’s pages and there is no way of stopping them.
With all that said the Facebook Framework is very fersatile and does allow developers access to user data in a relatively safe way. The amount of applications that could be developed are endless, even with the profile restrictions in place, and the platform has paved the way for many new businesses. I myself have made money from these two small applications, so it clearly works. I just hope that Facebook decides to put some time into their documentation sooner rather than later.