GDC reflective post

--Originally published at richardctc201

Here is the very first coding activity of this semester (except for the HelloWorld activity), and is a program that outputs the greatest common divisor of two given numbers. The challenge of this assignment was to create the most objected-oriented code as possible. So that instead of doing a simple iterative solution, one number (defined as an object) would receive a message to give the greatest common divisor of it and another number passed as parameter.

In order to accomplish the task, I asked for help to a friend of my mom (she works at IBM and knows plenty of coding nerds). Her friend is teacher in ITESO, and he assigned me one of his best students to help with Java, his name is Alex Ramirez. I met Alex one Saturday morning, and he taught me a lot of basic stuff of Java.

The way we addressed this problem was basing our thoughts in Euclid’s algorithm. I created a main class, and another public class call ‘Number’. In Number, I created two different methods: the first was a void type named ‘setValue’, to assign a value to both of my objects; and another void type called ‘max’, this was the important method where all of the math operations were going to be made. In my main class, I created two objects, val1 and val2, and by using setValue, I assigned a quantity value to both objects (in this case 1160 and 2013 respectively). With my two objects, I called the method max in val1 passing as parameter val2. In max, I declared 3 variables: a (val1), b (parameter), c (remainder of a/b)… And thathaa… When running the code, the output was 29, and I had a big smile drawn in my face.

Later in class, my teammate Dustin (alias Finn) helped me with the synchronization of Eclipse and GitHub showing me an excellent video that clearly explain the steps to follow to achieve the synchro.  As you can see, I’m very good at getting help of others!

Here a I leave some screens of my code in GitHub:

GDC reflective post

GDC reflective post


GDC reflective post