Sunday, December 20, 2015

Book reading: Head first Design pattern

Dec. 20, 2015

 Start to read the book "Head first design pattern" - 600 pages book. Plan to spend 10 hours to read the book first.

 Head first series books are my favorite ones. This time, I will document how I learn, what my favorite parts through the book. Encourage myself reading more of this book, I like to enforce myself to read first 200 pages first.

Dec. 20, 2 hours
Read page 1 - Page 38, reviewed strategy pattern, example:
client:
duck

Encapsulated fly behavior
FlyBehavior Interface -> 1. FlyWithWings   class  2. FlyNoWay class

Encapsulated quack behavior
QuackBehavior -> 1. Quack class 2. Squeak class 3. MuteQuack class

Duck has-a feature, not is-a  since HAS-A can be better than IS-A

Design Principle: Favor composition over inheritance

So, Duck client class is designed:
Duck
---------
FlyBehavior flyBehavior
QuackBehavior quackBehavior
--
setFlyBehavior()
setQuackBehavior()

Dec. 27, 2015
Spent 2 hours to read the book, went through the 300 pages quickly.

Motivation to read more pages of the book (Dec. 28, 2015):
1. The book is well written, Julia, you will not forget the examples in each pattern.
2. The reading takes your some time, but later, when you develop the software, you will save the time.
3. Just relax, and have some reading, you will not get lost, cannot understand, or get bored easily, the learning is fun.
4. If you cannot understand the book, then, you will have a lot of trouble down the road. OO design is a must skill to have your career as a programmer.
5. Find some videos - courses in pluralsight, watch first, and then, get other people's help first; come back to read the book slowly.

https://www.youtube.com/watch?v=acjvKJiOvXw&feature=share&fb_ref=share

No comments:

Post a Comment