GOOS Book Distilled Part 12

A follow through of the great book Growing Object-Oriented Software, Guided by Tests with code

2 minute read

This is a series of blog posts going through the great book Growing Object Oriented Software Guided By Tests, typing in code chapter by chapter, trying to add some of my own understanding where things may not be easy to grasp in the book. I highly recommand you get a copy of the book and follow along with me. Happy coding. This post covers Chapter 19 Handling Failure, which is also the last chapter in the book related to this project.

Javascript and Prototype Design Pattern

Is Javascript's prototypal inheritance borrowed from prototype design pattern?

Guowei Lv

1 minute read

Javascript has prototypal inheritance. For example let’s create a constructor function: function Person(firstname, lastname) { this.firstname = firstname; this.lastname = lastname; } Person.prototype = { fullname: function() { return this.firstname + ' ' + this.lastname; } }; var bob = new Person("Bob", "Doe"); console.log(bob.fullname()); This is very similar to the Prototype Pattern. Whenever we want a new object, we always create it out of some prototype object. I find that it is easier to understand the JS’s prototype inheritance when comparing it with the Prototype Pattern.

Javascript the Weird Parts Distilled

Learn Javascript the Weird Parts

Guowei Lv

1 minute read

Javascript: Understanding the Weird Parts is a great course. Highly recommended if you are getting into JS from other programming languages. Much better than the book Javascript: the Good Parts in my opinion. Here I distilled all the source code with comments from the videos, for the impatients.

How to AssertThat Two Objects Are Equal

What does it mean that two objects are equal?

4 minute read

The answer to this question is easy: assertThat(a, is(b)) Done. Wait, before closing this web page, let me ask you a few questions. First, let’s make a concrete class Student. public class Student { public final String name; public final int age; public final String id; public Student(String name, int age, String id) { = name; this.age = age; = id; } } Very simple data class. Now let’s try the solution in the beginning of the article.

My Experience with First Day of JavaScript30

What happened when I tried to follow the first lesson in JavaScript30

2 minute read

It’s nice weather today, so I decided to give JS another chance. For thoes who don’t know yet(really, if you want to do JS you should know already, haven’t you been reading everything in JS weekly every week?). There is a free course called JavaScript30 offered by Wes Bos, in which you build 30 small project using vanilla JS. Since it is perceived pretty well in JS community, I decided to start from there.