I have just finished inventing a new game I call "Checkers," so I may keep this short.*
Today's theme is the title: "There's always a better way," whether you're creating a database or writing a bunch of if/else statements for Checkers.
In today's lesson, the better ways include
- a) using ActiveRecord as a programming interface between you and the database, so that you don't have SQL language in the middle of your Ruby program;
- b) why you don't need to check if either array is empty in your MergeSort (because if you just attach the two original arrays to your solution array, whichever array is empty will just disappear); and
- c) how you can always make your life easier by not trying to make it complex too soon (i.e., if you're programming Checkers, start with moving a piece, then work your way up to jumping).
Also, I'd like to note that I went out after school to meet with my mentor and we had a very pleasant conversation. He also laid out the number of ways he can assist me in preparing for the job market--everything from code reviews to mock interviews (oh, how we will mock those interviews! That's what that means, right?). So now I'm really excited for our next meeting.
Perhaps he would like to play this brand new game I invented.
*Claims of inventing Checkers not fact-checked. I did, however, write a bunch of functions that allows Checkers to be played; and now I have to just slap some interface together and it'll be playable in the console or in a webpage (according to the assignment instructions).**
**Note: Slapping together an interface isn't as fun as it sounds.