WDI Day Nineteen: Sinatra

We played around with Sinatra, which is a framework for quickly creating web applications in Ruby. Other ways include Rails, Express/Node.js, and Django. We reviewed how to set up routing, which tells the application what the URLs should be for different pages. You can also pass variables into the URLs for more dynamic URLs.

There’s different ways of working with data on the server, which include:

  • GET – for ‘getting’ info (no data is changed)
  • POST – for ‘creating’ new data (usually by submitting a form)
  • PUT – for ‘updating’ existing data (usually by submitting a form)
  • DELETE – for ‘deleting’ data

To create views in Sinatra, you let it know which pages you want to route to with erb files, which are files that include a mixture of HTML and Ruby code. You even can share variables in different views.

Later in the day we met with Outcomes where we had someone come in to speak to us about networking on Linkedin. We also worked on our brand statements and then did an exercise where everyone went around the room and said what the good qualities were of our different classmates. Here’s what everyone had to say about me:

  • good eye for design
  • picks up things quickly
  • understands development
  • ahead of the game
  • quick learner
  • quickly dissect a problem
  • a leader
  • focused
  • detail-oriented
  • humble
  • perfectionist
  • resourceful

WDI Day Eighteen: Bootstrap and Active Record

We started off with a mini lesson in Bootstrap, which was mainly a review for me since I’ve used it a number of times for my day job. I did learn a few things about the JavaScript functions that are included in Bootstrap, like Affix and Scrollspy, which are definitely a couple of things I should look into more.

The rest of the day we delved into Active Record which was actually a lot of fun, where we learned about object-relational mapping. We played around with making queries and setting up new databases. Setting up Active Record does involve a number of steps that are somewhat confusing like putting together the models and database connections. In general it was pretty interesting seeing how to set up database schemas and seeding the databases.

We used AR to perform CRUD actions that include create, new, save, all, find, find_by, where, update, and destroy. I learned about how to connect to the database with postresql in order to actually get the queries to work. And the instructors discussed how convention is more important than configuration, and the conventions are a bit odd, it will take some time to get used to which ones are singular, plural, snake case, and camel case. Here’s an overview of the conventions covered:

  • Model file names are singular and snake case
  • Model class names are singular and camel case
  • Database schema is plural

Overview of the methods covered:

  • Class methods include all, new, first, last, and find
  • Instance methods include attr_accessors, destroy, save, and update

WDI Day Seventeen: Object-Oriented Programming in Ruby

It’s been an exhausting week packed with tons of assignments, hands-on work, and lectures. Today we continued our work with Ruby, focussing on object-oriented programming. We learned about classes for making different instances, initializing arguments when a new instance is created, and methods.

Later in the afternoon we looked at inheritance and how we can set up classes that inherit methods of other classes. Everything made sense to me, but when it comes to tackling hands-on projects, sometimes I have trouble figuring out where to start. Since we’re covering so much information every day, it’s easy enough to stumble here and there.

After class, I attended a talk held by GA’s JavaScript Guild. The speaker focused on regular expressions, which is a very powerful way to find and replace text in strings. I thoroughly enjoyed learning more about these powerful patterns that I’ve somehow managed to use in a couple of my projects thus far. Now that I understand them a little better, I’m looking forward to playing around with them even more.

Resources

WDI Day Sixteen: SQL Review and a Ruby Lab

Last night I only got about two or three hours of sleep because I was determined to figure out our homework assignment. However, I ended up giving up, and turned in an incomplete assignment. This morning I got to GA pretty early, and was still determined to figure it out. Eventually I did. The problem? I was having trouble wrapping my mind around mapping arrays in Ruby. Eventually I figured it out, and although the struggle took hours, finding a solution made me feel incredibly satisfied.

During the day we focused a large chunk of time on SQL and making database queries, what relationship databases are, and figuring out the relationships between different databases. I thought SQL queries were actually pretty fun.

In the afternoon we worked on a Ruby lab, which involved creating a command line game that quizzes the user on their knowledge of the state capitals. Surprisingly enough, it was a lot easier to put together. I suppose a night of struggling with the language really paid off in the end – I even played around with using a Ruby regular expression.

This course definitely has its fair share of highs and lows, but I’m excited to see how my skills shape up in the next few weeks.

WDI Day Fifteen: Intro to Ruby

Wow, right when you’re beginning to feel comfortable with one language, your world gets flipped upside-down. Today we started working with Ruby, and although I took General Assembly’s back-end web development class a few months ago, I realize I never really quite absorbed the information.

We reviewed how Ruby is different than JavaScript, how the syntax is a bit different as well as the way to debug the language (i.e. using puts instead of console.log) and gathering user input (i.e. gets).

In the afternoon we reviewed Ruby enumerables, also known as methods to search, sort, and manipulate collections. We learned that Ruby deals with arrays as well as hashes (which are like JavaScript objects) and went over the various ways of looping that include:

  • for … in
  • while
  • until
  • loop do
  • .times

Afterwards, the class jumped on the homework assignments, and it was definitely a struggle. For the first time, it looks like I won’t be able to complete mine. However, I’m refusing to give up just yet. Hopefully I can make sense of this soon…

Resources

WDI Day Fourteen: Project Refactor

Today we worked on refactoring the code for our first project, or in other words, cleaning up the code. I found myself feeling a bit exhausted from working on the Flash Cards project, so I delved into my Hangman project a little bit and made quite a bit of progress. You can see my Hangman project here.

The biggest takeaway from our first project week is that it’s important to find something to work on that you can be passionate and excited about. Otherwise, it’s all too easy not to feel too dedicated about what you’re working on, which is something you never want to have happen.

WDI Day Thirteen: Project Presentations & Object-Oriented Programming

In the morning we presented our projects in a science-fair style, where several of us had our laptops set up on boxes. I realized I was way more excited to talk to people about the logic behind my incomplete Hangman project than I was about the logic behind my Flash Cards. It just goes to show that it’s better to work on something that you can get excited about because you’ll work even more at getting it right.

After projects, it was a day focussed on object-oriented programming with constructor functions and prototypes. I’m realizing I’m understanding the concepts a lot better now, but certain concepts are still a bit of a struggle, like when to use return statements.

Nevertheless, I’m excited to see how things pan out with this program. Next week we start working with the back-end, so that shall be interesting.

hangman

Resources

WDI Day Twelve: Project Week 1, Part 3

This week has been utterly exhausting! I started the day off tackling Hangman and was pretty proud of the progress I made. I was pretty ambitious and wanted to finish everything today, however, that’s somewhat ridiculous since I already completed one of the other projects for project one. Nevertheless, I did manage to get most the of logic coded. The main problem I ran into was figuring out how to get the masked word to show up, letter by letter, based on what the user guessed.

I’m excited to figure out drawing the frames of the Hangman as well, and figuring out the logic for how many guesses the user has until it’s a game over. Although I wasn’t able to complete the project today, I’m hoping to make some progress either tomorrow night or Friday. Interestingly enough, even though the day was filled with a lot of frustration, I was pretty proud of the small wins I achieved on my own, even when they were when I figured out what was wrong in the code and didn’t necessarily have an answer just yet.

Tomorrow we’re presenting our projects, so I plan to present my flash card application, and plan to also show off the canvas drawing element that I just got started with for Hangman.

This afternoon was a lot of fun since we met with the Outcomes team and had a career coach run a workshop with us where we did a couple of exercises to help us write our brand statement for who we are all about when it comes to being an employee. We broke off into groups where one of us pretended to be the interviewer, the other was the interviewee, and the third was the scribe who wrote down any words and phrases that described the qualities of the interviewee based on his/her responses to the interviewer. It was a fun exercise and I really enjoyed hearing more about my classmates’ stories.

WDI Day Eleven: Project Week 1, Part 2

This morning consisted of several hours of pure frustration, as I couldn’t figure out one particular issue. In the future, I really need to learn how to let some issues go and revisit them later, since today I ended up realizing the problem I wanted to solve, wasn’t a problem at all. In fact what I initially set out to do, didn’t make much sense!

I wanted to work on event listeners for keypresses, so users could move to the front and back of cards with the enter and right-hand arrow key. Then I realized that the enter key was sufficient enough for when users are adding input, but that the right arrow key wasn’t intuitive enough. Instead, I made the entire cards clickable, so users could navigate that way.

I also learned how important it is to really plan out the logic behind your applications before you start coding. If I had thought through more of the main functionalities I wanted, I may not have run into as many issues as I did, where I had to readjust my code along the way. However, I suppose you can’t always plan out everything. Sometimes your coding will unfold organically.

WDI Day Ten: Project Week 1, Part 1

Today was the first day of our project week. This week, we’re all expected to get to GA bright and early and work away all day long on our first major project. Our task is to complete a familiar game with HTML and JS. We had the following games to choose from:

  • Tower of Hanoi
  • Trivia
  • Flash Cards
  • Simon
  • Hangman

I decided to go with flash cards, simply because creating a game on its own will be a challenge enough. I’m still struggling to figure out the logic when I start projects, and I’m hoping that will change over time.

Over the weekend I managed to complete most of the project’s functionality, so for the most part I worked on compiling the content for the cards, finding images for the front and back of the cards, and working out some of the styling issues. I kept running into issues with event listeners, since my game involves users guessing the answer to a card in an input, then clicking to view the back of the card, then clicking once more to see the next card. The game includes scoring, a timer, and the option to play again when the game is over.