Friday, July 17, 2015

Software Process

  Two months ago I decided to modify my chess website to allow users to sign up for my fall tournaments and see who has signed up for the tournaments. I worked on this project a few hours every weekend. I thought the process of making these changes to an existing web site was interesting enough to write a post about and I also get to kill two birds with one stone since I needed to provide an instruction sheet for prospective users. Creating the sign up option is simple in and of itself. The part that required a lot of thought was trying to make the signup process as easy as possible.

  I don’t charge more than $5 for any of my tournaments and saw no need to collect payment in advance but I wanted to validate the people who were signing up for my tournaments as opposed to popping up a text box for anyone to put any name into. I had a signup link for my email list at the bottom of each web page that fed into an email table. I modified my email list table into a user table and changed my email sign up link to a ‘Login’ link that I placed at the top of each web page.

To sign up for a new account, click the login button...

...and choose to signup for a account.

  When the user clicks the login link they can enter their email address and password, request a new password, or sign up for a user account. I thought about adding exotic features like challenge questions for a lost password or a username instead of the email address. After some reflection I came to the conclusion that I could add them later if the need arises. One scenario that could make me take this step would be if someone starts requesting new passwords for people by guessing their email accounts. I don’t think this will happen but it only takes one bad apple to spoil the barrel.

Enter your basic information and click 'Save'.

  Once a user signs up or logs in, the login link is replaced by ‘Logout’ and ‘Edit Profile’ links. The ‘Edit Profile’ brings a user to an Edit Profile web page that looks similar to the ‘Signup’ page with the addition of a ‘Family Member’ list users can add, edit, or delete. It is a simple little function but it meets my purpose for connecting players to a user.

To change your profile or add family members (including yourself), click the 'Edit Profile' link.

Click the 'Add New Family Member' link...

  Not every tournament I have on my website will allow signups so my next step was to add a flag to my tournament table that lets the website know whether the tournament allows user entries and an additional table that assigns sections to each tournament. Then I had a number of changes to my tournament page. When a tournament has sections I display a link that allows any viewer to see who has signed up for the tournament and what sections they have signed up for. I didn’t want to reroute users to an entirely new web page so I show the participants in a pop up box that can be discarded in one click.

...enter the name and click 'Save'.

Family members can enter selected tournaments on the 'Upcoming Events' page.

  The final step was to enable a tournament sign up link. I only show the link when a user that has at least one family member is logged in, the tournament allows manual user entry, and the current date is before the tournament date. That last step sounds odd but if I’m having a tournament where I don’t have internet access I don’t want people signing up for a tournament online when I have no way of knowing about it. When the user clicks the link I do some SQL (Structured Query Language) to perform a ‘cross join’ between the tournament sections and the user’s family members and I have a nice popup with a check box for every possible combination of users and sections. To test my changes I created a test tournament, signed myself as a user on four separate accounts, added family members to each account, and started signing up for tournaments. I created an email module and sent the user an email whenever they save a tournament signup and sent myself emails whenever a user signed up, changed their profile, did anything with a family member, or signed up for a tournament. Not only will I know who signs up for a tournament but I will also be the first to know if anyone adds profanity laced family member names and signs them up for tournaments. Last week I added a ‘shutoff’ switch to all the users and family member records that would allow me to block anyone I deemed abusive from signing up for tournaments.

Tournaments that allow for user signup will have a 'Sign up for the tournament' link. Click on the link and a popup box will display each family member and each section. Check the appropriate box(es) to enter the tournament.

  I ran tests from my computer using the production database. My tests were all successful and I promoted my changes to the production server that is hosted by GoDaddy over the July 4th weekend. I then repeated my tests and found that 10% of the emails would error out when using the GoDaddy email server.

You can see who has signed up for a tournament (and verify your entry) by clicking the 'Tournament sign up list' link.

  The emails that errored out gave the very cryptic “Failure sending email” message with no further information. I changed the routine that sends emails to retry up to three times in case of failure. That fix worked out well enough but I realized that I had no way of knowing when an email errored out. That led me to my last change which was to log every email my website attempts to send into a database table and flag successful sends. For now I will check the table periodically and resend any emails that fail. If manually resending the emails turns out to be a too common occurrence I’ll write an automated program to resend failed emails or send duplicate emails in case I find emails that mysteriously get lost in the internet.

  I expected to finish these changes by the end of July and I’ve finished three weeks early. My next project is to create a 21st century version of my basketball prediction program. I expect that to be an easier project than adding a tournament signup sheet because I will only have one user – myself.