Sunday, September 27, 2015

ASP.NET framework

August 28, 2015

开发网站问一问自己,ASP ASP.NET区别, .NET framework解决了哪些问题学习理论知识, 一点一点积累.

 Read the webpage: (Sept. 2, 2015)

Watch MVC videos if I have a few of hours.

Saturday, September 26, 2015

Object oriented principles - S.O.L.I.D.

August 28, 2015

SOLID principles:

S – Single-responsiblity principle

O – Open-closed principle

L – Liskov substitution principle

I – Interface segregation principle

D – Dependency Inversion Principle

Read the article: 

Here are my focus from Jan. 2014 - Sept. 2015, JavaScript -> Leetcode -> .NET framework -> OO design. 

Nov. 11, 2015

Here is the video studying on this remembrance day of Canada holiday, 

Spent 60 minutes to watch this video:

Bob Martin SOLID Principles of Object Oriented and Agile Design

video 1:12/1:23

Nov. 12, 2015

book chapter from uncle bob:

Lecture notes to read 

Videos ( Julia's favorite) 

Friday, September 25, 2015

Study time - watch videos, and read articles


REST+JSON API Design - Best Practices for Developers

How To Design A Good API and Why it Matters (Julia's rating: A+)

-- more notes: How To Design A Good API and Why it Matters
Watched again on 10/21/2015, notes taken to share:
Use Appropriate Parameter and Return Types
. Favor interface types over classes for input
- provides flexibility, performance
. Use most specific possible input parameter type
- Moves error from runtime to compile time (Julia's comment: Great tip, reduce time on debugging, fix things in compiling time!)
. Don't use string if a better type exists
- Strings are cumbersome, error-prone, and slow
. Don't use floating point for monetary values
- Binary floating point causes inexact results!
- Use double (64 bits) ranther than float (32bits)
-Precision loss is real, performance loss negligible

watched again on 10/21/2015, notes take to share:
Don't violate the Principle of Least Astonishment

Read more on this article:

-- end of notes for

Josh Bloch, Lord of the APIs - A Brief, Opinionated History of the API

SQL injection Myths & Fallacies: Best practices of defense

Quickly go over the book "SQL antipatterns" in short future.


Effective Java - Still Effective After All These Years

Julia’s favorite time: first 15 minutes with two great coding examples; watch again later.


Back to my life without writing code, enjoy the videos to catch up things about internet and technology, my favorite topic in the video: google CEO comment about competition, company vs. government, what the differences, How CEO thinks. 

Eric Schmidt & Jared Cohen: The impact of Internet and Technology

Get curious about .net framework - work on .NET framework and enjoy benefit last 5 years; should spend 10 hours to watch the .NET framework videos. Will spend more time when I take vacation from Oct. 2 - Oct. 16, 2015

first time using search in github, and seach Sudoku, and find some code to read:

Leetcode: Convert sorted array to binary search tree


First practice on 08/25/2015

108  Convert sorted array to binary search tree (No. 108)

Julia's C# implementation: top-down approach 

9/25/2015 Try to add some fun memory about top-down approach for binary search tree construction, then, present some diagrams. 

my task is to make the coding practice more fun, and some funny part with naive drawing. Maybe, Julia could use the drawing to bring some comic style to serious coding challenges. 

Julia's favorite blogs about this leetcode question: 

Read this blog (1) and like the analysis, first time see the comment: "Conquer" above the return statement:
return node; Learn Divide and Conquer in this simple illustration. 

Because this blog's popularity, it is one of my favorites. One thing I like to discuss is about the base case, how this base case is making sense, and then mimimum/ no redundancy. Let Julia argue about it. 

Here is the code in the above blog:
  1. private TreeNode helper(int[] num, int l, int r)  
  2. {  
  3.     if(l>r)  
  4.         return null;  
  5.     int m = (l+r)/2;  
  6.     TreeNode root = new TreeNode(num[m]);  
  7.     root.left = helper(num,l,m-1);  
  8.     root.right = helper(num,m+1,r);  
  9.     return root;  
  10. }  

Have some base case debates, and make this algorithm more entertainment: 

why base case is: 
 if(l>r) return null, 

if l==r, the above function will perform: 
 root = new TreeNode(num[l]), and also, 
set up 
root.left = RecursiveFunctionCall()  -> go to base case, return null, 
root.right  is the same as root.left, 
and then return root; 

how come it is not: 
 if(l==r) return new TreeNode(num[l])

then, need to add checking before the helper call:
  root.left = helper(num, l, m-1)
  root.right = helper(num, m+1, r)

So, better to leave this if conditional checking to base case; at least there are 2 if checking, anyone of them implies l<=r, so duplicate checking. 

julia's comment: 
the base case has redundant line:
Java code:
if(start == end) return new TreeNode(num[start]);

Here is the Java code: 

public class Solution {
11    public static TreeNode sortedArrayToBST(int[] num) {
12        if(num == null || num.length == 0return null;
13        return sortedArrayToBST(num, 0, num.length-1);
14    }
16    public static TreeNode sortedArrayToBST(int num[],int start, int end){
17        if(start > end ) return null;
18        if(start == end) return new TreeNode(num[start]);
19        int mid = start + (end-start)/2;
20        TreeNode root = new TreeNode(num[mid]);
21        root.left = sortedArrayToBST(num, start, mid-1);
22        root.right = sortedArrayToBST(num, mid+1, end);
23        return root;
24    }

Remind me the BST, the left and right subtree difference is maximum 1. 

Look into the leetcode solution later. Should be a great one for me to catch up some programming tips.