Andela Boot Camp XV Daily Journal — Day 2
With much excitement as usual , I already know some faces and names of boot campers, someone like Moyo, Nkem, Faith, Sheyi, TJ, Ose, Demilade, Obitech and many others. I was able to relate with them.
The morning starts with the last day food for thought. Everyone basically had something to say, a lot of us went too deep discussing the importance and reasons for code sharing as Bukky (our trainer) spotted out. Personally, I did some digging and I found the following platforms that allow code sharing.
- GitHub Gist
- Snippets Mania
There are many others, just to mention a few.
In the afternoon, we continued the Codecademy Ruby course and I was able to go 100% of the course outline and projects. How could I omit the fact that lunch was served on day 1 and 2, Just pardon me. Bukky also explained some of the keywords and syntax of Ruby to the class for better understanding.
After the lunch, we were given two assignments
- Write a code to accept user input and detect if it is a prime number
- Write a code to accept user input and generate times table of the entered value from 1 to 12.
I was excited to get my hand dirty with code. My first solution for item one was floored by Bukky’s tricky number 15, of course no perfect code. I have to improve on it and the final solution was able to handle any number, but not efficient in term of speed for larger numbers. See my solution https://github.com/mightys/bootcampXV/blob/master/src/check_prime.rb
Talking Efficiency, I had to dig and I found out that Ruby has a module called Prime that does the job but Bukky wants us to do it ourselves.
Remember my first question of why woke up 4:00 AM on day 1, did you guess right?
I went through the Prime.prime? Implementation and I was like “hey! What formula is this?” while sleeping my brain was doing the calculations, once it hits answer, it powers up all my body systems which includes my eyes. I had to transfer that calculation into Ruby and feel like I should share this excitement. See my optimized code https://github.com/mightys/bootcampXV/blob/master/src/prime_optimized_no_module.rb
Generating times table was a piece of cake, everyone in the class seems to finish the task in a few minutes. Unlike detecting prime numbers, this one is limited to 12 so I did not worry about efficiency. You can check out my solution https://github.com/mightys/bootcampXV/blob/master/src/times_table.rb
The day ended with another food for thought “how to make sure our code works”
I’m looking forward to day 3. It seems that as the number increments so the excitement, I can’t wait to tell you about it.
Day 3 loading in progress…