Searched for ""

Ouch! That Code Hurts My Brain.

Notes for my talk in Rubyfuza 2018 and Bath Ruby 2018. (video) Welcome to this talk: Ouch! That code hurts my brain. Raise your hands if the following scenario sounds familiar to you. After a day of work, you feel exhausted and have a headache. You get back home feeling so tired that you don’t want to say a single word. You close your eyes and feel the pain inside of your head. Anyone? This talk is about how to turn code from brain-hurting to brain-friendly. I’m Sihui. I work at a startup called I blog at sihui.io. I share lessons… Continue reading

Design Pattern: Prototype and Pizza

Design patterns in life and Ruby — gain an intuitive understanding of OO design patterns by linking them with real-life examples. The prototype pattern is the last creational pattern we will look at in the series. Here is its definition: Before we dive into the details of the pattern, let me tell you a story about a pizza store. Once upon a time, a wise young lady, Sihui, owned a minimalistic pizza store. The store only offered three types of pizza: pepperoni pizza, chicken pizza, and cheese pizza. The code for the Pizza class was straightforward. class Pizza attr_reader :name,… Continue reading

From Hello World to Six Job Offers From Facebook, Airbnb, Salesforce…

I first came to the U.S. for college in 2012 knowing nothing about programming. Three and a half years later, I received six software engineering job offers, from Facebook, Airbnb, Salesforce, Gusto, Bloomberg, and Groupon. I want to share my story because I’m sick of the illusion that programming is complex, difficult, and only for smart, young kids. I’m tired of how all programing stories start with: “I started to code when I was 6 and then built my first video game…” My story is different. It’s the journey of how an average person went from knowing nothing about programming… Continue reading

Design Pattern: Builder and Car

Design patterns in life and Ruby — gain an intuitive understanding of OO design patterns by linking them with real-life examples. The builder pattern is a very commonly used pattern. But its definition can be a bit confusing at first glance. Fear not. The definition will become much clearer after we build some cars. ? ? ? ? Let’s start by building a standard car. class StandardCarBuilder def build car = ” # 1. build car frame car << “This is a standard car\n” # 2. add an engine car << ” with an engine\n” # 3. add front wheels… Continue reading

Design Pattern: Proxy and Agent

Design Patterns in life and Ruby — gain an intuitive understanding of OO design patterns by linking them with real-life examples. Imagine yourself as a movie star, a big one. You are so famous that everyone in Hollywood wants to work with you. You never lack acting opportunities. So many requests come to you that you need an agent to handle them. Here is what you want your agent to do. When a new filming request comes, the agent first checks to see if it fits your schedule. If so, the agent then checks your preferences. (For example, you have… Continue reading

Design Pattern: State and Combination Locks

Object-Oriented Design Patterns in Life Series – gain an intuitive understanding of OO design patterns by linking them with real-life examples.   The State Pattern is a beautiful example of how combining simple classes with clean interfaces can produce great power. This is a long post. But stay with me. We are going to witness the beauty and power of object-oriented design together. Build a combination lock We will learn the State pattern by building a combination lock. According to WikiHow, opening a combination lock involves three steps: Spin the dial three times clockwise to clear any previously entered numbers… Continue reading

Design Pattern: Composite and Group Messaging

Design Patterns in life and Ruby – gain an intuitive understanding of OO design patterns by linking them with real-life examples.   The Composite Pattern gives the ability to treat grouped objects and individual objects the same. Let’s look at its definition:   A Real Life Example: Group Messaging Let’s look at the definition in light of group messaging. There are six people on my contact list: Mom, Dad, Uncle Bob, Cousin Nick, Aunt Julia, and Amy Kinser. The Parents group is composed of Mom and Dad, whereas the Uncle Bob’s Family group is composed of Uncle Bob, Cousin Nick, and… Continue reading

To self-doubting developers: are you good enough?

Does any of the following sound familiar? You constantly worry that you are not good enough. Look at the developers around you. They seem to have everything together. Their code is cleaner than yours. They debug much faster than you do. They merely glance at the documentation before knowing what they need. They are confident. They enjoy coding. But you, you are worried. You worry that you don’t know enough about the framework and the language you are using. You worry about introducing bugs. You worry about catching up with the hottest technologies. You worry that you are not talented… Continue reading

18 Months at Gusto: The “Unhappy” Paths

TL;DR A big part of programming is about handling the “unhappy” paths. As is the case in life. Lower your expectations and expect the unexpected.     Time flies by when you are busy with one task after another. A lot happened in the past six months since my last retrospection, 1 Year at Gusto — the 15 things I learned. Among all, one thing, in particular, stands out. It’s related to a bug — an expensive, painful, and soul-sucking bug. I introduced the bug and caught it a few weeks after it went live. The bug was dead stupid,… Continue reading