I have recently been tasked with making some changes to the central ‘library’ of code that an E-Commerce platform is based on. Essentially, the ‘models’ for this application are all in a central, shared location, and all of the ‘installations’ of the e-commerce platform have their own set of controllers and views that interact with these models. The changes I am making involve making the deletion of products reversible; so instead of actually deleting products and associated assets, a flag is merely set in the database; is_deleted = 1. This, at first glance, seems to be quite a simple task; alter the database tables to add the extra column in, and make a change to the central models in Model_Product::deleteProduct and any product ‘getter’ functions, eg Model_Product::getProductsByCategoryId. However, due to the way that the platform has been developed and individual customisations to the installations of that platform have been made, things aren’t quite so simple.
Coding things the quick way – often a false economy
August 4th, 2010Some simple steps on the “front end” to reduce web page download time
July 14th, 2010A few years ago, page download time was a big focus for most web developers, as the majority of people connected to the internet were accessing through “dial up” connections, which we all remember for their awful connection noises and the horrific download speeds. But with the development of faster internet connections in the developed world, the focus on page load times has been sacrificed for nice looking graphics, chunky javascript libraries and massive CSS files. But there are some quick, simple steps that can be taken to keep all of the improved functionality and look of a web site but reduce the page load time a little.
Read the rest of this entry »
Are we there yet?
June 24th, 2010I recently stumbled upon a blog post at Joel on Software about ‘The Iceberg Secret‘ – put simply, Joel explains that non technical people will judge the completeness and effectiveness of an application on the GUI alone. You can write an amazingly complicated and involving application, put a basic unstyled page as the GUI and it will be assumed to be a very very early instance or to be simply terrible. Similarly, your user interface guy can put together a beautiful page littered with graphics – not linked to anything processing wise – and the project will be assumed to be ‘almost finished’ or at least ‘not far off’.
Collective Ownership of Code: Anyone should be able to fix anything that is broken!
May 7th, 2010In reading up on programming practices and ideals, I have stumbled across a concept called “Collective Code Ownership”. This essentially means that *any developer* can fix bugs or write any new feature in *any project*. Bug fixing and project development should not be limited to the person that wrote the code in the first place. This introduces both advantages and disadvantages in to project management.
Simple steps towards accurate project estimates
May 5th, 2010A mistake that many developers (including myself) have made in the past is to over-promise and under-deliver in terms of the absolute deadline or the number of hours taken on a project. Getting to the “missing the deadline” or “being over budget” stage can be especially demotivating – you’re costing yourself (or your company) time, which is valuable, and also the client is likely to be getting slightly irritated (if you are late). The steps or methods to reduce the chances of this happening in the first place are simple, and easy to use.
Read the rest of this entry »
Should you sanitise your HTML before or after you save to your database?
April 19th, 2010In starting a new project completely from scratch we need to decide whether to sanitise html (that is, convert & to &, < to <, and strip out blacklisted html) before or after we saved to database. In projects I’d worked on in the past this had been done inconsistently in different areas of the application – ie, pre save in some areas and on select in others. After having thought through the problem I think I’ve decided on which option I prefer: Sanitise after selecting from the database, rather than before saving to the database.
How I organise my project information to save time.
April 12th, 2010It shouldn’t be news to anyone, but organising your projects (and assets within those projects) in an efficient manner will save you a load of time. Perhaps not immediately, but at some point in the future you’ll be thanking yourself hundreds of times over that you took the time to organise things in the first place.
PHP Developers (and Web Design companies): Consider using someone else to check your work!
March 22nd, 2010We’ve all been there. Working flat out on a project for day after day, to finally see the light at the end of the tunnel and start to consider launching. But wait! This is a dangerous situation to be in. Having looked at the same site for so long, you’re not going to be able to spot the mistakes that you’ve made. It’s worth spending an extra couple of hours to double-check your work – rather than have the embarassing situation of launching a site with mistakes present.
The obligatory development tools post
March 22nd, 2010I’ve seen pretty much every other web developer with a blog do this, so why not jump on the bandwagon and do it too? This is a list of the tools I favour when doing my job – including my web-browser of choice, my favoured text editor and preferred FTP client.
Save your script some time: Remember to index those foreign keys!
March 22nd, 2010In my infancy as a web developer, I was often caught out by a lot of really simple problems. One of these really simple problems was slow SELECT queries on a MySQL database when using “JOIN” or “WHERE”. I was quite often baffled; the site seemed really quick when I first launched it, and I hadn’t made any code changes, so what could have changed that made the “News Listing” page so slow? The answer was staring me in the face, but it still took me a bit of time to find it. The problem? The database table had a higher number of records in it, and when JOINING or searching, the application was forcing MySQL to do what are called “full table scans”. Once I discovered this was the problem, I was amazed at the difference in performance something so simple could result in. Read the rest of this entry »