-
Why dynamic resource loading is so important for web application?
When I finished matrix.js 0.1, I asked for feedback from my friends. But the general response seems that I am trying to solve a problem which does not exist, so the library is useless. But I am not disappointed. I make it not because we have a pain point in my current projects, but because I see it is the way that we need to build future web application. It is better to explain what the problem is as I see, before I propose on a solution. I believe that, as we are developing web application, dynamic resource loading will be a essential function. The current way to import resource using <link> <script> tag statically and tools like combres will not be able to meet the needs of building web application.
-
What does the size of a JavaScript Library say about it?
When people introduce a JavaScript library, they often mention that the size of the library is very small, like "it is small and light weight, xx K minified, in fact is about yy k when gzipped". Does this means a library runs fast or use less memory? Neither. We know that 1k size virus can use up all your machine resource, and make it dead slow, right? What it means the library can be transported to client side faster. Normally the more features a library provide, the bigger the size. You can use profiler (like the one built in Chrome) to collect data when using the library in real life scenario.
-
The design principle of viaProxy
[update: the library is now in github, and the sample code discussed in this post is here]
viaProxy is a client side JavaScript library that can be used to build complex, fast and fluid web UI yet in a manageable code complexity. It is a set of low-level api which is built on top of jQuery and enable you to synchronize your view and model using imperative programming (code only) or declarative programming ( mark-up only) or both. You can use it to write testable views, modules, plugins, and aggregate them into complex view.
-
f# essential - part 14 - object oriented without class
JavaScript is duck type language, if you expect a object has a method, you just call object.method. It supports Polymorphism very well, but you don't need implementation inheritance, and you don't need prototype, constructor at all. F#'s record type has similar concept. It is not a class, but it is strongly type, and it is super easy to create, it is like javascript object in strongly type. I think it is the one of best features in F#. Its syntax is as following
type YourRecordType = { member1: type1; member2: type2 }
-
f# essential - part 13 - pattern matching over .net type
f# use unique syntax to match type like the following,
let divide1 x y = try Some (x / y) with | :? System.DivideByZeroException -> printfn "Division by zero!"; None