JBerczel's Notes on learning Web Development

Build Your First Ruby Gem

After working through the Ruby section of the Odin curriculum, you might want to try writing your own gem. It’s good practice and helps get you familiar with the structure of the code you include in your Rails applications.

I found this tutorial helpful. It’s short and to the point. Follow along, and try to build something simple.

For me, I built a poker ranking library inspired by the rubyquiz. Feel free to take a look to get an idea on how to get started.

Example of holdem gem, a poker ranking library

require 'holdem'

deck = Deck.new
deck.shuffle!

hand1 = PokerHand.new(deck.deal(7))
hand2 = PokerHand.new(deck.deal(7))
hand3 = PokerHand.new("4c Kc 4h 5d 6s Kd Qs")

puts hand1
# => 5♦ K♣ T♠ J♥ 8♥ 8♠ 2♥ -> Pair of 8s
puts hand2                     # => Q♦ 6♦ 2♦ 6♣ 5♥ 6♠ T♦ -> Three of a Kind (trip 6s)
puts hand3                     # => 4♣ K♣ 4♥ 5♦ 6♠ K♦ Q♠ -> Two Pairs (Ks and 4s)

puts hand1 > hand2             # => false
puts hand2 < hand3             # => false
puts [hand1, hand2, hand3].max # => Q♦ 6♦ 2♦ 6♣ 5♥ 6♠ T♦ -> Three of a Kind (trip 6s)

OOP Problem from Cracking the Code Interview

This is a practice problem to think about object oriented design. I wasn’t sure how far to go wtih the solution. I have a basic working solution and an example. Feel free to solve and compare, or simply discuss.

Question

Imagine you have a call center with three levels of employees: fresher , technical lead (TL), product manager (PM). There can be multiple employees, but only one TL or PM. An incoming telephone call must be allocated to a fresher who is free. If a fresher can’t handle the call, he or she must handle it, then the call should be escalated to PM. Design the classes and data structures for this problem. Implement a method getCallHandler().

Continue reading

Books to supplement the Odin Curriculum

Practical Object-Oriented Design in Ruby (POODR) by Sand Metz

I’ve seen this book recommended on numerous forums and blogs. It was written with the goal of being accessible to novices. Chapter by chapter, Sandi Metz takes you through designing an application of a Bicycle Touring Company. By the end of the book, you’ll have finished reading a story, not a reference book, that’ll provide a clear way of thinking about design.

Continue reading

Portfolio Page

Well, it’s been awhile since I’ve blogged anything here. I’ve finished the Odin Curriculum, which was an invaluable tool for self-study. Being one of the first people to post solutions to the projects, it was sometimes quite challenging figuring things out. But in the end, it was very rewarding.

In the future, I hope the Odin communities grows, and opens avenues for more collaborative coding experiences. I’m thinking exercism at the level of small projects, not small problem sets.

Finishing Odin felt similar to when I first picked up a guitar. It’s only the beginning of a long journey. I’m excited to see what I build next.

In the meantime, I’ve restructured this website to include a portfolio on the home page. I hope you enjoy.

Web Scraping Project - Guitar Forum Search

agf example

Currently, there are no web-scraping projects in the Odin Curriculum. But, there’s a great web-scraping article from The Bastards Book of Ruby, an online book we’ve read in previous lessons.

Continue reading