Coding Project
This project came from a Java focused programming course from the IAT program during my Spring 2020 semester. It was an individual project where I had 4 weeks to plan and create a multimedia interactive program. I created a simplified simulation of a human immune system, with cells being attacked by bacteria or viruses and the body’s response. I will be going through how this project was developed and delving into its technical aspects whenever possible.
For technical requirements, I needed to utilize:
In the first week, I planned out the system and how it would meet the requirements. I was fairly set on the immune system because of the rising COVID-19 pandemic, and I thought it would be interesting to make. With a concept in mind, I thought about the objects I needed, their roles and thinking of connections for hierarchies. I decided to feature immune cells such as macrophages, helper t-cells and antibodies because their roles seemed simple to program.
Though I did not fully plan out the system this early in development, this section is to explain the program’s components and procedure. The program starts off with a few cells infected by virus or bacteria and it will try to spread to the other cells. The intruders drift in random directions and infect animal cells they come into contact to. Macrophages actively target the intruders to consume them and if the problem persists, helper t-cells and antibodies will come to assist. Helper t-cells supply macrophages with more energy and antibodies drift around the body, stopping any invaders they touch. The program ends when the vital organ cells have died, or all the intruders have been eliminated and the body returns to normal.
During this phase of development, I created the program’s foundation. I decided I would have 4 packages: main, intruder, immune system, and body cells. Cells that had similar purposes were grouped up together to make the file structure more organized. For example, the intruder package contained classes for bacteria, virus, and their shared abstract superclass. By the second week, many of the cells were functionally complete with only a few tweaks needed. It wasn’t difficult to make cells move in a direction and bounce off walls. I also already figured out how to make objects track another object from a previous assignment in the same course. With the project being close to functional, I just needed to implement the graphics which would implement the perlin noise, fractals, and decorators.
I planned to use the iterator at the start of the program to go through an arraylist which held the body cells and have it pick out a few cells to be infected. However, this arraylist is dynamic and having an iterator go through the collection caused concurrent modification exception errors. To work around this issue, I created an organ cell wall, an arraylist of objects with a set number of objects. The iterator would to go through this arraylist to check each cell’s status and change them from a dead or alive state on intervals.
In program’s final iteration, I completed the rest of the requirements. I had two weeks to work since the first milestone and I incorporated GUI buttons, perlin noise to appear as DNA strands, fractals to create capillaries, decorators to show cell infection, and an FSM to control the program’s states. I also made the system respond differently depending on how many cells are alive, but this was implemented somewhat late into development and I didn’t have much time to make it more complex.
I am really happy how this project turned out. I finished most things I set out to do, it visually looks good and there aren’t too many bugs (at least ones that I know of). I also got a really good grade on this too, getting a 37/33 because I fulfilled all of the coding requirements and a lot of bonus points for my effort. Working on this project really shows my capabilities and potential with creating software.
You can run the program by downloading the zip file, unzipping and running the .jar file. This project is also on GitHub so you can also download the project files and see my code.
Download files GitHub