Tuesday, December 29, 2015

Vacation break in 2015 - from Dec. 28 to 31, 2015

Dec. 29, 2015

 Try to have a good vacation. So, plan to learn skiing this winter, go out to do sports. Swimming, tennis, skiing, and all other activities.

 Julia went out the Lonsdale Quay on Dec. 29 to catch a free shuttle to mountain Seymour, but she missed the shuttle. She had great time to enjoy beauty of city of Vancouver. She took the skytrain, seabus, and walked in the city.

  Then, she decided to learn something about real estate, money, and Julia likes the teaching from Canadian business guru Kevin O'Leary.

  Here are the list of videos watched:

http://www.chatelaine.com/living/budgeting/why-kevin-oleary-doesnt-plan-to-leave-any-money-to-his-kids/

The Hour: Kevin O'Leary
  https://www.youtube.com/watch?v=0TZ__3iuQU4

Kevin O'Leary on Occupy Wall Street
https://www.youtube.com/watch?v=JR6aCl7cZyg

Kevin O'Leary on men, women, and money
https://www.youtube.com/watch?v=PkbWBDeLrJ4

Kevin O'Leary's 'Cold, Hard, Truth' on Gold Investing

https://www.youtube.com/watch?v=aZ0T6RwJYPc

O'Leary: No cracks in Canada's housing, condos show insatiable demand

https://www.youtube.com/watch?v=9etKaSeBpxg

Kevin O'Leary Real Estate Investment Advice Canadian TV

https://www.youtube.com/watch?v=35wZ-dda1a0

Kevin O'Leary's Top 10 Rules For Success (Julia's favorite: No. 6, No. 8, No. 4)

https://www.youtube.com/watch?v=ItMr7vxvekU

10 rules -
1. You have to sacrifice a lot
2. Trust your gut
3. Have diversification
4. Have a backup plan
5. Be a leader
6. Admit your weakness
7. Buy stocks with dividends
8. Differentiate between family, friends & money
9. Get outside of North America
10. Go with simple ideas

Kevin O'Leary on how to get ahead in the workplace

https://www.youtube.com/watch?v=bG6L5z7fMxE
1. How to calculate the worth to the company?
Answer from Kevin:
 Can you get the job done?
 How fast can you get the job done?
 How much ripple effect you create?
 Can you work with others? Do you create hassle with other employees? These are matrix employer uses.

2. Can you brag your accomplishment to the superior?
Answer from Kevin:
1. What keep you employed is to keep your boss looks great. Pass your manager to brag yourself, it is like passing a car in free way.
2. Got to be a politician. When to take, when to give, when to say, when not to say.
    Make your boss looks good. Help boss achieve his goal.

3. Go to work to make money, not make friendship
4. Code ethics - Dressing, people does not notice - people do not remember what you wear yesterday

KEVIN O'LEARY How To Nail a Job Interview ADVICE

https://www.youtube.com/watch?v=VvVUvWwUrzI
1. Do not cut people off, let people finish talk; answer the question.
2. Do not be anxious. Be confident. You are in the interview, supposing that you will get the job. Look them in the eyes when you are asked a question.
3. What is weakness? Do not know what you need from me. I will work hard to figure out.

Kevin O'Leary Keynote at Notre Dame

https://www.youtube.com/watch?v=XBUQNYczj4A
What makes a great entrepreneur?
1. Prepared to make life/balance sacrifices.
2. Have a little knowledge about everything, but a lot about what they are selling.
3. Put shareholders first.
4. Love what they sell.
5. Use technology to make work more efficient.
6. Understand the business is a global competition.

Sunday, December 27, 2015

Think Fast, Talk Smart: Communication Techniques

Dec. 27, 2015

 Take a break, and watch the video:

 Think Fast, Talk Smart: Communication Techniques
 https://www.youtube.com/watch?v=HAnw168huqA


 Take some notes:
http://www.singjupost.com/think-fast-talk-smart-communication-techniques-by-matt-abrahams-full-transcript/

Techniques:
1. Greet anxieties - it is normal, and then, take deep breathe, and think that it is a conversation, not performance. There is no a right way to do presentation.

2. First, start with a question.
Count how many 'f', and answer the questions.

3. Write down a series of questions to answer. Instead of a lot of bullets notes.

4. Use conversational language.

    Bring ourselves into present moment, instead of future consequences

My favorite way to get present-oriented is to say tongue twisters.

Repeat after me. It’s only three phrases. "I slit a sheet. A sheet I slit. On that sheet I sit. "Focus on saying right, in the presence moment. 

"I slit a sheet. A sheet I slit. And on that slitted sheet I sit". Very good, no shits. Excellent. Very good. 

the first two steps of our process. First we get out of our own way, and we can reframe the situation as an opportunity.

The next phase is also hard, but very rewarding, and that is to slow down, and listen

The first useful structure: problem-solution-benefit structure
Another structure: what? So what? Now what? Structure. 

Julia's favorite notes:


"So what does this all mean? It means that we have, within our ability, the tools and the approaches, to help us in spontaneous speaking situations. The very first thing we have to do is manage our anxiety, because you can’t be an effective speaker if you don’t have your anxiety under control. And we talked about how you can do that by greeting your anxiety, reframing as a conversation, and being in the present moment.
Once you do that, you need to practice a series of four steps, that will help you speak spontaneously. First you get out of your own way. I would love it if all of you, on your way from here to the football game, point at things and call them the wrong name. It’ll be fun. If most of us do it, then it won’t be weird. If only one and two of us do it, it’ll be weird. Right.
Second. Give gifts. By that I mean see your interactions as ones of opportunity, not challenges.
Third, take the time to listen, listen. And then finally, use structures. And you have to practice these structures. I practice these structures on my kids. I have two kids. When they ask me questions, I usually answer them in what, so what, now what. "
Book: Speaking Up Without Freaking Out

More videos:
1. https://www.youtube.com/watch?v=5naThX63pF0

2. 

Matt Abrahams Workshop Compelling and Confident Communication 1

https://www.youtube.com/watch?v=ENLZfjLoPEY

Notes:
Knowlege
Domain and Audience knowledge means you...
Speak to benefits instead of features.

What do they know?
What do they expect?
What are their area of concern?

Relevant to audience - Reveal the relevance - 25% of all the world money, into the bank, for example

Advance Analogies - Buy you a lot, link thing they already know

Invoke Imagination - Rember an event in the past, or in the future

Use "You" - use conversational language, engage them to what they know, using inclusive language

Kevin O'Leary Keynote at Notre Dame

https://www.youtube.com/watch?v=XBUQNYczj4A








Code School: courses study

Dec. 28, 2015

Spent hours (Dec. 23 - 3 hours, Dec. 27 - 3 hours) to watch courses on code school from Dec. 22, 2015 . Website:  https://www.codeschool.com/

Path HTML/CSS

Get Started With HTML and CSS
Course: Front-end Foundations
Course: Front-end Foundations

Intermediate CSS
course: CSS Cross-Country
course: Journey into Mobile
course: Adventures in Web Animations

CSS Preprocessors
course: Assembling Sass
course: Assembling Sass Part 2

CSS Frameworks
course: Blasting Off with Bootstrap

Design
course: Fundamentals of Design


Paths: JavaScript

Client-side Frameworks
course: Shaping up with Angular.js
course: Staying Sharp with Angular.js
course: Warming Up With Ember.js

More review:

Google I/O 2013 - Design Decisions in AngularJS

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



Tuesday, December 22, 2015

OO principles - The Open / Closed Principle

Dec. 22, 2015

Three Approaches to Achieve OCP

  1. Parameters (Procedural Programming)
  2. Inheritance / Template Method Pattern
  3. Composition / Strategy Pattern
1. Parameters (Procedure Programming)
Allow client to control behavior specifics via a parameter
Combined with delegates/lambad, can be very powerful approach

2. Inheritance / Template Method Pattern
Child types override behavior of a base class (or interface)

3. Composition / Strategy Pattern
Client code depends on abstraction
Provides a "plug in" model
Implementations utilize inheritance; Client utilizes Composition

Read the blog:
http://code.tutsplus.com/tutorials/solid-part-2-the-openclosed-principle--net-36600
http://www.objectmentor.com/resources/articles/ocp.pdf
http://stackoverflow.com/questions/59016/the-open-closed-principle

A friend told me that he subscribes
https://www.pluralsight.com/

So, Julia subscribed code school first starting this Dec. 2015, and later pluralsight.com. Two schools are different.

Video watch:

https://www.youtube.com/watch?v=MvyG_ODng3w

Code School Live: JavaScript Best Practices Q&A

https://www.youtube.com/watch?v=k9xwJoprEMY

Principles of Object Oriented Design (2 - The Open-Closed Principle) 28 minutes 

https://www.youtube.com/watch?v=qP6MroshYvM&index=8&list=PLD4GnSXHpkQ2_eKG5fKzszXs5hYcEsft7

I Learned HTML and CSS, Now What?

http://blog.codeschool.io/2014/09/30/learned-html-css-now/

http://support.pluralsight.com/knowledgebase/articles/491274-what-s-offered-at-code-school-vs-pluralsight

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

Thursday, December 17, 2015

Book Reading: Effective Java

Dec. 17, 2015

Effective Java is such a great book, I had wonderful time to read 1-2 hours while enjoying the travel on train back to my home  town this October, 2015.

But, Julia had to motivate her more to complete reading the book - at least spend over 10 hours this holiday break to catch up some best ideas about programming.

Dec. 17, 2015  (20 minutes reading)
Item 52: Refer to objects by their interfaces (julia's rating 1-10: 10)

Dec. 18, 2015 ( 2 hours reading 8:00pm-10:00pm)
Item 23: Don't use raw types in new code
Item 24: Eliminate unchecked warnings
Item 25: Prefer lists to arrays
Item 40: Design method signatures carefully
Item 45: Minimize the scope of local variables
Item 46: Prefer for-each loops to traditional for loops

Dec. 19, 2015 ( 2 hours reading 8:30am-10:30am)

Item 6: Eliminate obsolete object reference (read the item twice)
Actions: take sample code, and think about similar example, write a one in C#, check in github
Notes:
3 cases for memory leaks:
1. whenever a class manages its own memory,
2. caches  - WeakHashMap
3. listeners and other callbacks
Careful code inspection or with the aid of a debugging tool known as a heap profiler
Action item 2: Try heap profiler in C#

Item 8: Obey the general contract when overriding equals (read again, 30 minutes)

Further reading:
WeakHashMap
http://www.ibm.com/developerworks/library/j-jtp11225/

Read some code, and then, go back to the book.
http://www.codeproject.com/Articles/595160/Understand-Liskov-Substitution-Principle-LSP

http://www.codeproject.com/Articles/648987/Violating-Liskov-Substitution-Principle-LSP

http://www.codeproject.com/Articles/597870/Liskov-Substitution



Book Reading: 97 Things Programmer Should Know (IV)

Dec. 17, 2015

  Review my favorite book chapter:

  Wet Dilutes Performance Bottlenecks - Kirk Pepperdine

  Julia's notes:
  Don't Repeat Yourself - it codifies the idea that every piece of knowledge in a system should have a singular representation. The antithesis of DRY is WET (Write Every Time).

  Favorite use case of violating DRY principle - use of collections

  Action item:
  1. Put similar code example in Github, and get the idea of DRY violation analysis
  2. Read "Java Performance Tuning" Book - 4 hours in December, 2015

  https://github.com/jianminchen/DRY_Principle_Examples/blob/master/DRYPrinciple_Collections.cs

  Julia likes to review the JVM - Java virtual machine, performance tuning again; the programmer should care about performance tuning. 

  Watch the video:


Kirk Pepperdine — The (not so) Dark Art of Performance Tuning
  https://www.youtube.com/watch?v=5XWgjSHZlQw


Building and Tuning High Performance Java Platforms (Julia's comment: Vmware, only watch first 40 minutes)

https://www.youtube.com/watch?v=IGS-rqSjmFk

Writing Quick Code in C++, Quickly

https://www.youtube.com/watch?v=ea5DiCg8HOY&list=PLGvfHSgImk4ZbhoiE6OXQREiLrHV9FPJH




Book Reading: 97 Things Every Programmer Should Know (III)

Dec. 17, 2015

 Today Julia reviewed the topic of "Continuous Learning", written by Clint Shank.

 Here is the chapter web link:



Continuous learning is such a great topic, and Julia likes to write down some notes:

1. Write some code. 
2. Get to know the frameworks and libraries you use. (Julia's comment: learn more about Asp.net framework)
3.  A really good way to learn something is to teach or speak about it.
4. Learn a new programming language every year. 

Julia's ideas:

1. Continuous learning should also be creative. Should involve some code writing, algorithm problem solving, and good documentation - blogs, and good spirit - sharing through the blogs etc. 

2. The learning should also be full of challenges. Go back to school is great, but learn to love what you do, learn by yourself, prepare your own curriculum - data structure, foundation core, design principles/coding standards, top conferences, outstanding lecturers top of world - interested area. Keep yourself motivated, determined. You can work on it over 16 hours a day if you love to be a programmer/research/IT worker. Cherish time and limited resource, and find top-quality material to work on. 

For example, Julia found out that CppConf is a great conference with great talks. She just found out that in Nov. 2015, and started her own study on C++ again, and then, she was amazed to find out that those materials she works on are best of quality and surprisingly rewarding, and she also knew a lot of top engineers and top scholars through videos, and she learns great things about design etc.  

Julia subscribed code school and pluralsight.com to study a lot of quality courses to catch up technologies starting Dec. 2015. 

3. Learn to master programming languages, but also, go for beyond basics, such as, OO principles - S.O.L.I.D., C++ coding standards, when you apply those principles, code standards, save time to develop/ debug / maintain the software. 


Tuesday, December 15, 2015

OO principle - S.O.L.I.D., Single Responsibility, Open/ close principle drill

Dec. 15, 2015

Review the video about the testing, and try to get more from this lecture:

"The Clean Code Talks -- Inheritance, Polymorphism, & Testing"

https://www.youtube.com/watch?v=4F72VULWFvc

action items:
1. put sample code in C#, and then, check in git;
2. write down key words, and easy for review and follow as rules.

Julia's sample code in C#:
Problem statement: 1 + 2*3, how to implement in OO design (using C# language)

Three solutions are provided, naive one, better one, optimal solution to apply S.O. principles.

1. Represent this as a tree

   +
/     \
1     *
    /    \
  2      3

Most of people come out solution like the following:
 Using conditionals

  class Node{
     char operator;
     double value;
     Node left;
     Node right;
     double evaluate(){
       switch(operator){
        case '#': return value;
        case '+': return left.evaluate() + right.evaluate();
        case '*" return left.evaluate() * right.evaluate();
        case ...  // edit this for each new operator
       }
    }
 }

 Big problem on this:
  graphic representation,
  Node
  op:char
  value: double
  left: Node
  right:Node
 --------------
   evaluate():double

Julia could not figure out the analysis here <- first time to memorize this analysis, and also try to learn reasoning

    Analyzing attributes

                           #      +        *
function                      yes     yes
value                  yes
left                              yes     yes
right                            yes     yes

Two different behaviors are fighting here, (see the above table), not matching Single Responsibility Principle.
if you are the operation node, then you need your left and right child; whereas value node, you just need value.

C# code using conditional implementation, one class Node

Naive approach, breaking single responsibility principle, the C# code is here.

Clean code talk - conditional version written down based on the talk, C# code is here.


2.
Let us break it up:
     Node
   --------------
   evaluate(): double
         |                                  |
ValueNode                         OpNode
  value: double                   op: char
---------------                       left: Node
 evaluate: double                right: Node
                                          ----------------
                                          evaluate(): double
As showing above, break Node into ValueNode and OpNode, so ValueNode does not have left and right child because of no meaning over there.

Tree looks like:

          OpNode
              +
    /                            \
ValueNode         OpNode
       1                         *
                        /                    \
                 ValueNode      ValueNode
                        2                     3
Operations and values

abstract class Node{
   abstract double evaluate();
}

class ValueNode extends Node{
    double value;
    double evaluate(){
           return value;
    }
}

class OpNode extends Node{
   char operator;
   Node left;
   Node right;
   double evaluate(){
         switch(operator) {
             case '+': return left.evaluate() + right.evaluate();
             case '-':  return left.evaluate() + right.evaluate();
             case ...   // edit this for each new operator
         }
    }
}

better solution: Node, OpNode, ValueNode, the C# code is here.


3. How to extend this? Every time you add a new operator, need to hold on source code, and add code in switch statement, how to make it better?

OpNode divides into AdditionNode  and MultiplicationNode

           OpNode
         ------------------
         left: Node
         right: Node
        ------------------
         evaluate(): double

 AdditionNode                                 MultiplicationNode
----------------------------                    --------------------------
   evaluate(): double                           evaluate(): double


  abstract class Node{
           abstract double evaluate();
  }

  class ValueNode extends Node{
       double value;
       double  evaluate(){
          return value;
       }
 }

  class abstract OpNode extends Node{
  Node left;
  Node right;
  abstract evaluate();
  }

 Operation classes
  class AdditionNode extends OpNode{
      double evaluate(){
         return left.evaluate() + right.evaluate();
      }
}

  class MultiplicationNode extends OpNode{
     double evaluate(){
          return left.evaluate() + right.evaluate();
     }
 }

 Now, the new tree diagram:

      AdditionalNode
              +
    /                            \
ValueNode         MultiplicationNode
       1                         *
                        /                    \
                 ValueNode      ValueNode
                        2                     3

optimal solution: Node, OpNode, ValueNode, AdditionNode, MultiplicationNode, here is C# code.


Perfect examples of 1 + 2*3, 3 implementations, Julia learns O of S.O.L.I.D. OO principles, open for extension, close for change.

More detail, the above optimal solution does not have any if statement, and any new arithmetic operation just needs a new class, no need to touch existing code: Node, OpNode, AdditionNode, MultiplicationNode. For example, minus '-' operation, just add MinusNode. For easy to demo, all classes are in one .cs file, but each class should have it's own .cs file. :-)

Share the learning of Open/Close principle - great examples. Cannot wait to move on to next one, Liskov substitution principle!

Reference:
Blog:
http://juliachencoding.blogspot.ca/2015/11/the-clean-code-talks.html

Follow up


Sept. 9, 2018

The project is documented in my github folder, here is the link.



Sunday, December 13, 2015

Book reading: 97 thing every programmer should know (II)

Dec. 13, 2015

Continue to review the book "97 thing every programmer should know"

"Make Interfaces Easy to Use Correctly and Hard to Use Incorrectly" by Scott Meyers.


And then, plan to spend time to watch the videos:
Scott Meyers – The Most Important Design Guideline


CppCon 2014: Scott Meyers "Type Deduction and Why You Care"  (Julia: study this topic, and then, more foundation knowledge about OO languages. A++ )

Scott Meyers - Effective Modern C++ part 1 (6 videos)

Modern C++: What You Need to Know (Julia: watch this video first! Excellent talks with good data about data structures - List, map, set etc. )



Swift vs Modern C++  (Julia:  this is fun; learn a new language in one hour, swift, and get ideas how languages are different in the design)