In object-oriented programming, the command pattern is a behavioural design pattern in which an object is used to encapsulate all information needed to perform an action or trigger an event at a later time. This information includes the method name, the object that owns the method and values for the method parameters. - Wikipedia To summarise the Command pattern is a way of separating methods from
How does SAM work? SAM is built on one of the most robust foundation of computer science (TLA+). SAM recommends factoring application state management along three building blocks, actions, model, and state that are invoked in well defined "steps". Actions are triggered by events, their role is to translate events into proposals to mutate the model The Model is solely responsible for the decision o
If you have ever used Express or some other web framework you are likely familiar with the concept of middleware. It is something that allows us to shape given input before moving into actual logic. Sometimes it may be beneficial to set up a post middleware as this allows you to define triggers based on what has happened. You can see this sort of solution at Mongoose for instance. A while ago I fi
organize your code in a way that doesn’t pollute and exposes only what is necessary Larger interactive d3 programs can be difficult to organize. After all your elements are on the screen you want to glue them together inside event callbacks. The conventional methods of calling d3.selectAll() against a large DOM tree end up resulting in a lot of additional code to make sure your selections are accu
¶ Classifying Asynchrony For a while, I've been looking for a good way to explain the relationship between promises, streams, callbacks, and event emitters. Handily, Domenic Denicola recently illustrated the problem well on IRC. To paraphrase him here: there are two axes, plurality and synchrony. Plurality means "how many times will the operation be executed." Synchrony is divided between "synchro
The web frontend scene is witness to many new frameworks and ways of working. It can be quite annoying when software becomes legacy quicker than ever. But actually, it's just good old innovation happening as it should, because the opportunities for improvement are there. Frameworks come and go, but what remains are the good ideas that they brought to the world. We're going to talk about the good i
Sooner or later every developer finds the beauty of the design patterns. Also, sooner or later the developer finds that most of the patterns are not applicable in their pure format. Very often we use variations. We change the well-known definitions to fit in our use cases. I know that we (the programmers) like buzzwords. Here is a new one – Black Box Driven Development or simply BBDD. I started ap
The document covers modern JavaScript application development, focusing on achieving well-structured code through various methods such as object-oriented programming, module patterns, and MVC frameworks. It discusses key principles like dependency management, design patterns, and the importance of separating concerns in code structure while highlighting patterns for creating scalable and maintaina
Promises are very simple once you get your head around them, but there are a few gotchas that can leave you with your head scratching. Here are a few that got me. Nested Promises You get a whole bundle of promises nested in eachother: loadSomething().then(function(something) { loadAnotherthing().then(function(another) { DoSomethingOnThem(something, another); }); }); The reason you’ve done this is
I want to document an interesting pattern we’ve seen emerge in some recent web platform specs, including promises and streams. I’m calling it the revealing constructor pattern. The Promises Example Let’s take the case of promises first, since that may be familiar. You can construct a new promise like so: var p = new Promise(function (resolve, reject) { // Use `resolve` to resolve `p`. // Use `reje
“One of the most important aspects of writing maintainable code is being able to notice the recurring themes in that code and optimize them. This is an area where knowledge of design patterns can prove invaluable.” – Addy Osmani In modern day JavaScript, it’s easy to pursue the development of large scale JavaScript applications. We are constantly writing more and more complex web apps that thrive
Basic JavaScript programming knowledge. Additional required other products (third-party/labs/open source) Query Library Download / Learn この記事は、JavaScriptでよく使用されるデザインパターンに関するシリーズ記事の第1部です。デザインパターンはプログラミングにおける実証済みの手法であり、特に、大規模なJavaScriptアプリケーションを大きなグループで作成する場合に不可欠なコードの保守性、スケーラビリティ、分離性を向上させます。 このシリーズ記事の第2部では、さらに、アダプター、デコレーター、ファクトリという3つのデザインパターンを紹介します。第3部では、さらに、プロキシ、オブザーバー、コマンドという3つのデザインパターンを紹介します。 シング
JavaScriptの人気とともに、JavaScriptでのデザインパターンの利用局面も増えています。本書ではGoFのデザインパターンに沿って、その実装例やパターンの適用事例を網羅的に示し、デザインパターンをJavaScriptにも応用したいというニーズに応えています。モジュール、オブサーバ、ファサード、メディエータといったGoFの代用的なデザインパターンだけでなく、リビーリングモジュールパターンや擬古典的デコレータパターンといった、新しいパターンも取り上げています。美しく、かつ構造化され、メンテナンス性の高いJavaScriptを書くために有用な一冊です。 まえがき 1章 デザインパターンとは? 1.1 はじめに 1.2 パターンとは? 1.2.1 既に日常的にパターンを使っている 1.3 「パターン」性検査、プロトパターン、3の法則 1.4 デザインパターンの構造 1.5 デザインパタ
A JavaScript pattern and antipattern collection that covers function patterns, jQuery patterns, jQuery plugin patterns, design patterns, general patterns, literals and constructor patterns, object creation patterns, code reuse patterns, DOM and browser patterns (upcoming). Patterns collected while developing 喜感网. General Patterns Function Declarations - creating anonymous functions and assigning t
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く