trees, forest, fog-975091.jpg

Projects

SIMPLE stopwatch

In my free time, I decided to try and program a simple stopwatch to further hone my programming skills. As a result, I successfully programmed the stopwatch in python using simplegui and also developed my problem solving skills as I had to think about several features. Some of the features that I had to implement included collisions between buttons and the mouse, how to make the timer stop / start, as well as a reset button that would reset the timer back to zero.

As I used an object oriented approach, a class for the Stopwatch was created which had many variables such as font size, location, image. This made it easier to adjust variables in the stopwatch; I only had to change the variable allocated to font size if I wanted to change how big the displayed numbers were. Using an object oriented approach also made it easier to add methods as I only needed to call Stopwatch’s specific method, this meant I could easily implement more features without needing to change other parts of the code.

Throughout this project, I learnt many things such as how to use python’s time module, improving my ability to adapt to using new modules as well as developing my python programming skills.

Python games project

As part of one of my modules “Programming laboratory”, our group decided to make a python platformer coded in simplegui. This project served to be more difficult than we expected as we needed many more collisions as well as to implement a scrolling camera and platforms which the player could stand on.

Initially, we first implemented basic features of a game including a background and eventually added a menu as well as an instruction screen. The platforms and the scrolling camera were the most challenging aspects of the game as we needed to have collision detection when the player was higher than the platform so the player’s velocity would be reset to zero and the player to be moved on top of the platform. This was achieved by checking if the bottom of the player sprite was higher than top of the platform. Some issues we ran into included the sprite not detecting when it was not on the platform anymore and continuing to move in mid-air. This however this was solved by calculating the ends of the platform and comparing it with the coordinates of the sprite in real time.

The scrolling camera was another tricky feature to implement as we needed all of the game objects to also scroll in opposition to the player. Our team decided to have a large background canvas that only showed a portion when the player moved. Some issues aroused as we implemented the scrolling feature: only one of the platforms moved when there were two platforms. To solve this issue, a Platforms class was created that handled the list of individual platforms, allowing all the platforms in the list to be moved simultaneously.

This project was definitely fun yet challenging to implement. As we had to follow some set criteria, our team had to decide which features to prioritise in order to allow smooth progress. Throughout working on the project, I have enhanced my programming logic skills as well as developed my communication with others.

Calculator project

Creating a calculator was part of one of my projects for a module “Software Engineering”, where the user was able to input a string expression and have the calculator return the result. This project allowed me to dive deep into learning about how tools help me program in a more efficient manner. This project was coded in eclipse with additional plugins such as google checkstyle and maven to ensure that my programming was following standards. Building a project in Maven also allowed the project to be exported onto different operating systems whilst still retaining the initial functionality. 

Implementing postfix was a great challenge as this required the string to be parsed in, and then handling of logic with respect to precedence. The program implemented the precedence (i.e. times and divide would take priority over addition and substraction) as a method. Sufficient javadoc was made on the different methods to allow the code to be more easily understood. In addition, to make sure that every line of code behaved as expected, the calculator was coded following test driven development. This means that before any line of code is written, a test is written initially then code is written to make the tests pass. I was also able to learn about the shunting yard algorithm and the logic behind how postfix works.

Infix method utilised postfix and pushed symbols onto a stack class. This allowed parts of an arithmetic solution to first be solved by passing the particular part into the postfix. To make the calculator feel more smooth to use, JavaFx was also used with eclipse. Notably, Scenebuilder handled building of scenes (in this case the calculator pane) and additional buttons were implemented to allow the user to select between infix and postfix.

I found this to be a very fun experience, although trying to make checkstyle work initially served some problems as sometimes, the checkstyle errors were not appearing. If I had to do this project again, I would definitely try and work on the UI more. For this project, I worked on the programming side and only started to implement the UI when I was more confident with my work when I should have balanced out between programming and UI  more.

team project – restaurant web application

In my second year, students were tasked to create a web application for a makeshift restaurant in teams. This was a relatively large project that involved implementing the frontend and backend.  The frontend was responsible for handling user input and involved what the user was able to visually see whereas the backend dealt with processing requests through different routes (such as POST/PUT/GET etc) also involving in interacting with the database. The project involved utilizing Javascript web development language, React for framework, Prisma to handle communication between MySQL and JavaScript.

Initially four students worked on the respective categories for the menu: starters, mains, drink desserts and I was responsible for implementing the code for the starters. As this was my first time using React and Javascript, there was a learning curve I had to tackle. In order to do so, I watched several different tutorials on the web and also coded the example along to really be able to get the deeper understanding, helping me develop my analytical skills. After the first two sprint cycles, my team members eventually moved onto different features and I opted to try and refactor the menu code. The menu code had to be refactored as having four people work on it meant that the categories used a different template and this became an issue when seeding (fetching and placing) the menu items from the database. To solve this, I created a general menu_item template that included the necessary attributes (ie item name, description, price, allergens); this template was later used for all of the items to allow them to display in the frontend properly.

In addition, I also worked on the payment page which involved several fields where the user could enter their details. The details would be checked against a card database to assess whether the card details entered match that in the database. To implement this feature, I tacked it by first creating a payment page and creating fields for the frontend. The difficulty in this problem lied in trying to connect the frontend and the backend, and I eventually solved this by utilizing different resources. In the frontend, whenever the user clicked the submit button, the method to invoke a POST request would be sent to that relevant route. The POST route also contained code to store those different values and compare them by first checking if there was a card number (as identifier) that matched. Then, the route proceeded to check if all the details match. If there was a match, it would bring the user to the payment successful page to inform the user it had been successful, otherwise if there was no matching identifier card number, it would return “invalid detail”. If there existed a matching identifier card number but the details were incorrect, it would return “incorrect details”.

I found this project to be quite challenging as this involved me utilizing different languages and framework, however after looking at online videos and coding parts of the code allowed me to adapt quickly. If I was to do this again, I definitely would have liked to scale the UI more appropriately for the payment page. Although this project was challenging, I also found it to be very interesting as actually implementing part of the frontend and backend was an eye opening insight and allowed me to gain a better understanding of how & why it worked.