タグ

JavaScriptとOOPに関するefclのブックマーク (7)

  • GitHub - ryanmcdermott/clean-code-javascript: Clean Code concepts adapted for JavaScript

    Software engineering principles, from Robert C. Martin's book Clean Code, adapted for JavaScript. This is not a style guide. It's a guide to producing readable, reusable, and refactorable software in JavaScript. Not every principle herein has to be strictly followed, and even fewer will be universally agreed upon. These are guidelines and nothing more, but they are ones codified over many years of

    GitHub - ryanmcdermott/clean-code-javascript: Clean Code concepts adapted for JavaScript
    efcl
    efcl 2017/01/10
    クリーンコードをJavaScriptで行うガイドライン。 読みやすいコードの書き方やオブジェクト指向プログラミング、SOLID、ES2015以降の機能使って分かりやすく書く話など
  • OO Relationships

    In this small note we recap concepts of objects relationships in Object-Oriented programming. Recently Allen Wirfs-Brock raised an interesting topic for distinguishing and abstracting a concept of “an open set of objects that share a common interface and implementation”. A first possible definition that comes in mind can be a “type”, or a “class”. However, objects relationships in object-oriented

    efcl
    efcl 2016/01/26
    JavaScriptとオブジェクト指向プログラミングについて。 static/dynamic dispatch、prototypeベース、縦/横の継承、 class、mixin、traits、ダックタイピング、compositionなどについて
  • ECMAScript 6: new OOP features besides classes

    This blog post is outdated. Please read chapter “New OOP features besides classes” in “Exploring ES6”. Classes [1] are the major new OOP feature in ECMAScript 6 [2]. However, it also includes new features for object literals and new utility methods in Object. This blog post describes them. New features of object literals  # Method definitions  # In ECMAScript 5, methods are properties whose values

    efcl
    efcl 2014/12/21
    ES6の機能、短縮記法を使った書き方について。 `Object.assign`を使ったオプションのデフォルト値の適応、`Object.is`などについて
  • Understanding the four layers of JavaScript OOP

    JavaScript OOP is baffling: on one hand, there is a simple core, on the other hand, there are some really weird things going on. I’ve been pondering for a long time how to explain it well and I think the best way to do so is via four layers: single objects, prototype chains, constructors, constructor inheritance. The first two layers are JavaScript’s simple OOP core, layers 3 and 4 are where the c

    efcl
    efcl 2014/05/19
    JavaScriptとオブジェクト指向について
  • Javascriptのオブジェクト指向 - ひよこ3分07秒のはてなブログ

    Javascriptのオブジェクト指向は気持ち悪い!」 みたいな意見を聞くことがあるけれど、 そういうのはたいてい慣れの問題だと思っています。 「オレオレオブジェクト指向」を作って使っちゃうのも、 自分ひとりだけならいいけど多人数が見るコードでやるのは迷惑かなと。 だいたい「オレオレクラス」を分かりやすいと思っているのは作った人だけだったり。。。 でもJavascriptのオブジェクト指向に問題があるのは事実だし 対策は必要なので自分がベストだと思っている方法を書いておきます。 newをつけなくても呼び出せちゃう問題 function Point(x, y){ this.x = x; this.y = y; } var o = new Point(0, 0); // 問題なし var p1 = Point(1, 1); // p1はundefinedだし、グローバルオブジェクトが汚染され

    Javascriptのオブジェクト指向 - ひよこ3分07秒のはてなブログ
    efcl
    efcl 2011/05/20
    newの省略、prototype面倒くさい問題 Object.defineProperties
  • new を不当に貶める陰謀と JavaScript におけるクラスの継承構造の話 - vivid memo

    私は陰謀論者じゃないですし JavaScript の new 演算子が大好きなわけでも大嫌いなわけでもないです。 念のため。 記事は Hiraku さんが書かれた下記記事への言及です。 newを封印して、JavaScriptでオブジェクト指向する(1) newを封印して、JavaScriptでオブジェクト指向する(2) newを封印するべき4つの理由 new 演算子は使うな!? 「newを封印するべき4つの理由」 でも new がいかに糞であるかが書かれていますし、その記事からも言及があるように Crockford さんが書かれた書籍 『JavaScript: The Good Parts ―「良いパーツ」によるベストプラクティス』 でも new 演算子は Bad Parts に分類されています。 new 演算子が忌避される理由はいろいろあるみたいですが、Hiraku さんの記事では n

    new を不当に貶める陰謀と JavaScript におけるクラスの継承構造の話 - vivid memo
    efcl
    efcl 2011/05/17
    new 演算子について。 クラスとインスタンスとオブジェクト
  • オブジェクト指向なJavaScriptプログラミングのススメ(1) | ゆっくりと…

    どちらも物事を的確に捉えようと努力することに変わりはありません。現在ではオブジェクト指向の方に軍配が上がるわけですが、そもそも問題領域を構造化して捉えようというアプローチは、人間の論理的な思考にとって自然な事ですし、歴史的に見ても、構造化分析・設計の手法は一定の成果を上げてきたといえるでしょう。 しかし、システムの規模と量の拡大に伴い、構造化分析・設計手法には次のような問題点が出てきました。 検証が困難、バグがなくならない 典型的にはデータフローやフローチャートを用い、次々に変わり行く様をモデリングするため、 複雑になればやがて人間には追跡が困難となります。さらに仕様変更が加われば、予期せぬバグ が発生するのも仕方のないことでしょう。 再利用できる範囲が非常に狭い 上位のプロセスが下位のプロセスを手続き的に呼び出すため、構造的に上位が下位に依存します。 再利用できるのは最下位の、それ以上依

    efcl
    efcl 2010/12/12
    Functional vs. Object-Oriented JavaScript Developmentの訳文 オブジェクト指向型]クロージャー、プロトタイプ、関数型:jQuery
  • 1