Sunday, January 29, 2012

Implementation of Online Application

As discussed in the Analysis/Research, the issues regarding the online application were what language to use, the layout of the website, and the colours to use.

Firstly, the language had to be decided on. After some research into scripting languages, it was between two, JavaScript and PHP. JavaScript is primarily used in the form of client-side JavaScript for the development of dynamic websites, and PHP is a server-side language used for designing dynamic websites.

As both languages have plenty of advantages and disadvantages, it had to be decided whether to use a client-side or server-side language. The decision was finally made on PHP, which would be imbedded in HTML scripts, mainly for the reason that it’s a server-side language. The reason for this was because it is straightforward to access and alter the database, which was needed for the project. Even though JavaScript can be used as a server-side language, it is complicated compared to PHP.

The next issue was the layout of the interface. There are two parts to the online application, the user application and the administrator application. The decision was made to implement the two applications the same way, with the same layout and colour scheme.

Firstly, a HTML page was designed, using a standard layout of tables and divisions. Then, a Cascading Style Sheet (CSS) was designed to give the HTML page some colour and design.

Once the layout and colour scheme was decided on, the PHP scripts were introduced into the HTML pages.

Here’s the layout eventually decided on, without any PHP scripts. The logo would appear on the top of the page. The five header links, as well as the 5 bottom links, would be links to other pages on the website, depending on the user application and administrator application. The picture in the centre is to resemble a fairway of a golf course. The grey section below it will give an explanation of the page, and the white section is where all the information will go, such as user details, events, scorecards, etc. The page here looks a bit empty but when the PHP scripts are included, as well as all the other information, the page fills out and looks very well.

The decision was to use dark colours for the online application. The reason for this is that dark colours, and mainly black, add a contemporary style and a sense of sophistication to a website. The dark blue where the logo appears will add tradition and loyalty. Also, dark colours reduce the amount of energy used by computer monitors.

The section in the middle was left white so that the user can easily read the information on the page.

From here a user can register, log in or view the help pages. An administrator can also log in from here.

Once a user has logged in, he/she is presented with the following page.

The inclusion of PHP scripts can be seen here. Firstly, you need to connect to the database. This is done with the following code.

This needs to be included in all scripts that are connecting to the database.

The next PHP script is in the ‘Welcome’ field which is the following.


This gets the user’s first name from the database and inserts into the page.

The final PHP script on this page is the information field. The users name, gender, handicap and course is displayed for the user to see.

This PHP code will vary, depending on what information is to be displayed on the screen.

One of the hardest coding aspects of this project was that Update Handicaps function. This is in the administrator application of the system. The updating of handicaps is a complex formula, due to different handicaps, standard scratch scores (SSS), and categories. A buffer score is also used, where your buffer score is the total number of shots minus the standard scratch score for that course.

Handicaps vary from 0.1 to 28.4 for men, and for women, it can reach anything. These handicaps are broken down into 4 categories for men, and five for women.

  • Category 1 – handicap of 0.1 to 5.4

  • Category 2 – handicap of 5.5 to 12.4

  • Category 3 – handicap of 12.5 to 20.4

  • Category 4 – handicap of 20.5 to 28.4

  • Category 5 – above 28.4 (only women)

For a category 1 golfer, their handicap gets increased by 0.1 times their buffer score. So if a golfer scores a 66 on a course with the SSS 62, their buffer score is 4 and therefore their handicap will increase by 0.4.

For a category 2 golfer, their handicap gets increased by 0.2 times their buffer score, 0.3 for category 3 and 0.4 for category 4. The same values are used for decreasing handicaps.

The formula produced for this was very long and complex, and needed to be perfect.

Below is part of the code as all the code would be too long.


No comments:

Post a Comment