摘要:Hi guys, I am happy to tell you that I am moving to the open source world. And Java is the 1st language I have chosen for this migration. It's a nice chance to read some great books like "Effective Java 2nd Edition" and share the note for what I learned from it with you just as what I did before with CSharp. Here is the index of the notes. Hope you like it :) 阅读全文
Big O Complexity Chart (From: bigocheatsheet.com)
2020-10-19 09:56 by 小郝(Kaibo Hao), 367 阅读, 0 推荐, 收藏, 编辑
摘要:The Big O cheat sheet for data structure and Array sorting algorithm. 阅读全文
Machine Learning Note - Note 1
2017-05-18 10:15 by 小郝(Kaibo Hao), 220 阅读, 0 推荐, 收藏, 编辑
摘要:I am working on the Andrew Ng's course on Machine Learing. I have a question on the week2 session. Is there anybody can tell me why there is a 1/2m in 阅读全文
JavaScript Patterns 7.1 Singleton
2014-07-23 22:53 by 小郝(Kaibo Hao), 640 阅读, 0 推荐, 收藏, 编辑
摘要:The idea of the singleton pattern is to have only one instance of a specific class. This means that the second time you use the same class to create a new object, you should get the same object that was created the first time. 阅读全文
JavaScript Patterns 6.7 Borrowing Methods
2014-07-22 11:48 by 小郝(Kaibo Hao), 266 阅读, 0 推荐, 收藏, 编辑
摘要:You want to use just the methods you like, without inheriting all the other methods that you’ll never need. This is possible with the borrowing methods pattern, which benefits from the function methods call() and apply(). 阅读全文
JavaScript Patterns 6.6 Mix-ins
2014-07-21 10:58 by 小郝(Kaibo Hao), 486 阅读, 0 推荐, 收藏, 编辑
摘要:This post introduces how to combine different parent's properties into one child object. 阅读全文
JavaScript Patterns 6.5 Inheritance by Copying Properties
2014-07-19 12:53 by 小郝(Kaibo Hao), 286 阅读, 0 推荐, 收藏, 编辑
摘要:This post introduces how to implement the shallow and deep copy in JavaScript. 阅读全文
JavaScript Patterns 6.4 Prototypal Inheritance
2014-07-18 23:42 by 小郝(Kaibo Hao), 320 阅读, 0 推荐, 收藏, 编辑
摘要:Use an empty temporary constructor function F(). Set the prototype of F() to be the parent object. Return a new instance of the temporary constructor. 阅读全文
JavaScript Patterns 6.3 Klass
2014-07-17 08:18 by 小郝(Kaibo Hao), 297 阅读, 0 推荐, 收藏, 编辑
摘要:There’s a convention on how to name a method, which is to be considered the constructor of the class. Classes inherit from other classes. There’s access to the parent class (superclass) from within the child class. 阅读全文
JavaScript Patterns 6.2 Expected Outcome When Using Classical Inheritance
2014-07-16 17:05 by 小郝(Kaibo Hao), 212 阅读, 0 推荐, 收藏, 编辑
摘要:This post introduces how to use the JavaScript feature to implement the Java style inheritance. 阅读全文
JavaScript Patterns 6.1 Classical Versus Modern Inheritance Patterns
2014-07-06 23:23 by 小郝(Kaibo Hao), 333 阅读, 0 推荐, 收藏, 编辑
摘要:When it comes to adopting an inheritance pattern for your project, you have quite a few options. You should always strive for picking a modern pattern, unless the team is really uncomfortable if there are no classes involved. 阅读全文
JavaScript Patterns 5.9 method() Method
2014-07-04 13:11 by 小郝(Kaibo Hao), 399 阅读, 0 推荐, 收藏, 编辑
摘要:This post introduces how to use the method() method to extend the function object. 阅读全文
JavaScript Patterns 5.8 Chaining Pattern
2014-07-03 23:20 by 小郝(Kaibo Hao), 273 阅读, 0 推荐, 收藏, 编辑
摘要:This post introduces how to implement the Chaining pattern and the pros and cons of this pattern. 阅读全文
JavaScript Patterns 5.7 Object Constants
2014-07-01 23:01 by 小郝(Kaibo Hao), 307 阅读, 0 推荐, 收藏, 编辑
摘要:The principle to create Object Constants is that make variables shouldn't be changed stand out using all caps and add constants as static properties to the constructor function. 阅读全文
JavaScript Patterns 5.6 Static Members
2014-06-30 22:52 by 小郝(Kaibo Hao), 358 阅读, 0 推荐, 收藏, 编辑
摘要:This post introduces how to implement the public or private static members in JavaScript. 阅读全文
JavaScript Patterns 5.5 Sandbox Pattern
2014-06-28 12:09 by 小郝(Kaibo Hao), 423 阅读, 0 推荐, 收藏, 编辑
摘要:This post introduces Sandbox pattern to avoid the namespace drawbacks(1. Reliance on a single global variable to be the application’s global. 2. Long, dotted names to type and resolve at runtime, for example, MYAPP.utilities.array.). 阅读全文
JavaScript Patterns 5.4 Module Pattern
2014-06-26 09:41 by 小郝(Kaibo Hao), 397 阅读, 0 推荐, 收藏, 编辑
摘要:This post introduces how to use the module pattern to limit the access scope of the methods of object or constructor in the module. 阅读全文
JavaScript Patterns 5.3 Private Properties and Methods
2014-06-25 12:31 by 小郝(Kaibo Hao), 429 阅读, 0 推荐, 收藏, 编辑
摘要:This post introduces how to limit the access scope of the field and method of the object. 阅读全文
JavaScript Patterns 5.2 Declaring Dependencies
2014-06-24 17:48 by 小郝(Kaibo Hao), 356 阅读, 0 推荐, 收藏, 编辑
摘要:This post introduces the benefits of the Declaring Dependencies on the top of the function or module. 阅读全文
JavaScript Patterns 5.1 Namespace Pattern
2014-06-22 23:16 by 小郝(Kaibo Hao), 449 阅读, 0 推荐, 收藏, 编辑
摘要:This post introduces how to maintain the namespace in JavaScript gracefully. 阅读全文
JavaScript Patterns 4.10 Curry
2014-06-18 23:01 by 小郝(Kaibo Hao), 287 阅读, 0 推荐, 收藏, 编辑
摘要:When you find yourself calling the same function and passing mostly the same parameters, then the function is probably a good candidate for currying. You can create a new function dynamically by partially applying a set of arguments to your function. The new function will keep the repeated parameters stored (so you don’t have to pass them every time) and will use them to pre-fill the full list of arguments that the original function expects. 阅读全文