I’ve been really busy lately, hence the lack of posts. I won’t apologise as by now you’re probably really bored of me writing “sorry I haven’t written anything in a while” posts. Instead, I’ll give you this brain-squelcher of a problem I’m currently solving. It might seem simple, and it’s something that a lot of web developers have to do a lot, but the complexities when you get into the nitty-gritty are pretty … complex.
So what is this? Well, you know when you’re placing an order online and you get to a page where you have to type in your address details? My page does a little bit more than that; you can log into your account from there, and supply a password if you want to create an account as well as placing your order. Let’s think about some of the possibilities for processing this page.
1) If the user is logging in, is their username and password correct?
2) Is the users supplied email address valid?
3) If the user is just placing an order, have they filled in the required fields (address, email address etc)?
4) If the user is just placing an order and their email address belongs to a registered account, do you display a message to say this order has been placed on behalf of their account and also send them a password reminder email?
5) If the user wants to create an account, have they filled in the required fields?
6) If the user wants to create an account, have they supplied a valid password (and password confirmation)?
7) If the user wants to create an account and their email address already belongs to a registered account, do you display a message to say this order has been placed on behalf of their account and also send them a password reminder email?
And then of course there’s all the usual filling of the form with the users details if needed, checking the form has actually been submitted (is the request POST), protecting the database from rogue input and all the rest of it.
Something I think the job of a developer is as much about thought processes as it is about technology.