To get our feet wet, when you follow tutorial, We strongly recommend typing code by hand as you’re working through the tutorial and not using copy/paste. This will help you develop muscle memory and a stronger understanding.

编程语言类型

OOP VS FP

https://codeburst.io/declarative-vs-imperative-programming-a8a7c93d9ad2 1: Imperative Programming 1.A: Procedural Programming 1.A.1: Structured 1.A.2: Object-Oriented (OOP) 1.A.3: Modular 1.A.4: Page Description 2: Declarative Programming 2.A: Query/Database Programming 2.B: Functional Programming

编程语言术语

Class and Object

Static templates and Objects

Functions/Methods, anonymous Functions/Methods, or lambda expressions.

First-class function https://en.wikipedia.org/wiki/First-class_function

Type safe

Thread safe

举例:

Scala 的 function 类型:

.NET

LINQ, LAMBDA

###########

委托 (参数,返回=>协变,逆变)

Delegate

Extend=> Business Delegate pattern VS OO.ProxyPattern

Well, the idea of the Proxy pattern is that you have an object that stays in front of another object and has the same interface as this object. So, if some operation has to be performed before another operation, you can make use of a proxy, to abstract the caller and simplify its code. For example, we have an object that has a getter method that retrieves a list of Strings, but we have to go to the database to retrieve this list. If there’s a proxy, the caller simply invokes this getter method on the proxy object, and the proxy verifies whether the target object already has the list. If not, it goes to the database, retrieves the list, sets it on the target object and returns to the caller. Therefore, the proxy object can execute code before and after the code of the actual targeted object.

The original idea of the Business Delegate was to abstract the presentation layer from knowing how to look EJB objects up. The presentation layer (i.e. a Servlet) would have to know how to retrieve EJB objects that would execute business logic. You could then make use of a Business Delegate, so the Servlet could simply invoke a method on it, which would then retrieve the appropriate EJB object and delegate the execution of the business logic to it, simplifying the code of the presentation layer.

I have to confess that I have worked 95% of the time with Spring, but I believe that the Business Delegate pattern is retired nowadays. And yes, both patterns delegate the execution of things to other objects, but their purpose are different.

https://coderanch.com/t/637844/Difference-Proxy-Delegate

OO.ProxyPattern

http://www.php5dp.com/php-proxy-design-pattern-protect-your-assets/

##############

Delegate is a very powerful feature available in the .NET Framework

https://www.codeproject.com/Articles/741064/Delegates-its-Modern-Flavors-Func-Action-Predicate

https://stackoverflow.com/questions/4317479/func-vs-action-vs-predicate

https://stackoverflow.com/questions/11009890/delegate-pattern-vs-delegate-keyword-in-c-sharp

http://www.infoworld.com/article/3057152/application-development/how-to-work-with-action-func-and-predicate-delegates-in-c.html

Action<> Func<> general delegate

http://www.c-sharpcorner.com/UploadFile/ff0d0f/action-and-func-delegates-in-C-Sharp-net/

event delegate

http://www.tracefact.net/CSharp-Programming/Delegates-and-Events-in-CSharp.aspx

https://msdn.microsoft.com/en-us/library/orm-9780596516109-03-09.aspx

delegate observer pattern

FileSystemWatcher

watcher.Created += (sender, e) =>

CallBackFunction(sender, e);