You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
Whenever you do something like MyClass.new, Ruby creates a new object, which uses a little bit of memory. But that's not the only way you are creating objects. Many actions will create objects, including strings and arrays. Even if you don't say String.new or Array.new, it's still a new object that is being created for you. Because memory is not unlimited and memory allocation has an impact on per
According to GoF and their great book “Design Patterns: Elements of Reusable Object-Oriented Software”, builder pattern: „Separate the construction of a complex object from its representation so that the same construction process can create different representations.” and it’s a part of an object creational design patterns. Builder pattern is useful when the algorithm how to build an object is som
Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article? DDDを実践し始めてまだ日が浅いので、ドメインモデリング中に 細かい原則がすぐ出てこなくて迷うことがあります。 そこで、「エリック・エヴァンスのドメイン駆動設計」から 第2部「モデル駆動設計の構成要素」を中心に、モデルを表現する各要素(パターン)の 基本原則をまとめてみます。 第5章「ソフトウェアで表現されたモデル」 関連 ENTITIES(エンティティ) VALUE OBJECTS(値オブジェクト) SERVICES(サービス) MODULES(モジュール) 第6章「ドメインオブジェクトのライフサイクル」 AGGREGATES(集約)
ちと、小難しい話になります。DDDの話なんで、 コードで学ぶドメイン駆動設計入門 〜アグリゲート編〜 - じゅんいち☆かとうの技術日誌 でも取り上げたアグリゲートに関する考察です。どうあるべきかはちょっと分かっていません。これを読んでこうしたらよいのでは?と思う方、意見歓迎です。インターネットって一方だと面白くないので議論したいですね。 アグリゲートってライフサイクルの境界を扱うための設計パターンです。ライフサイクルで思い出すのはリポジトリとファクトリ。この二つのオブジェクトが扱うのがアグリゲートです。ライフサイクルは至るところに出てくるので、結構大事で、設計の根幹に影響するオブジェクトのひとつではないかと思います。 アグリゲートは、内部のエンティティやバリューオブジェクトを集約している境界で、その境界はエンティティであり、ルートエンティティと呼ばれる。 グローバルな同一性を持つエンティテ
Context In many applications, the business logic accesses data from data stores such as databases, SharePoint lists, or Web services. Directly accessing the data can result in the following: Duplicated code A higher potential for programming errors Weak typing of the business data Difficulty in centralizing data-related policies such as caching An inability to easily test the business logic in iso
The abstract factory pattern is one of the classic Gang of Four creational design patterns used to create families of objects, where the objects of a family are designed to work together. In the abstract factory pattern you provide an interface to create families of related or dependent objects, but you do not specify the concrete classes of the objects to create. From the client point of view, it
Abstract Factory パターン(アブストラクト・ファクトリ・パターン)[1]とは、GoF(Gang of Four; 4人のギャングたち)によって定義されたデザインパターンの1つである。 関連するインスタンス群を生成するための API を集約することによって、利用側がインスタンス群をまとめて変えられるようにし、さらに組み合わせ方を間違えないようにする[1]。日本語では「抽象的な工場」と翻訳される事が多い。 Kit パターンとも呼ばれる[1]。 Abstract Factory パターンのクラス図を以下に挙げる。 Product1, Product2 は抽象クラスであり、ConcreteProduct1, ConcreteProduct2 はそれぞれを継承した具象クラスである。抽象クラス AbstractFactory は、抽象クラス Product1, Product2 を生成
Factory Method パターン(ファクトリメソッド・パターン)[1]とは、GoF (Gang of Four; 四人組)によって定義されたデザインパターンの1つである。 Factory Method パターンは、他のクラスのコンストラクタをサブクラスで上書き可能な自分のメソッドに置き換えることで、 アプリケーションに特化したオブジェクトの生成をサブクラスに追い出し、クラスの再利用性を高めることを目的とする。 Virtual Constructor パターンとも呼ばれる[1]。 Factory Method パターンのクラス図は以下の通りである。 抽象クラス Creator は 抽象クラス Product を生成するメソッドを持つ。 クラス ConcreteCreator は Creator の具象クラスであり、ConcreteProduct を生成するメソッドを持つ。 Concre
Builder パターン(ビルダー・パターン)とは、GoF(Gang of Four; 4人のギャングたち)によって定義されたデザインパターンの1つである。 オブジェクトの生成過程を抽象化することによって、動的なオブジェクトの生成を可能にする。 enum Material{WOOD, CLAY, CONCRETE, SNOW} class Building{ private Material base; private Material frame; private Material wall; void setBase(Material m){ this.base = m; } void setFrame(Material m){ this.frame = m; } void setWall(Material m){ this.wall = m; } public String toSt
AppleのSwiftで Singleton Pattern を実装する方法について調べてみました。あちこちで言及されているみたいなので、今更感が強いですが。だから実装方法だけではなんなので、スレッドセーフなことを検証する XCTest も最後に書いてみました。 作ったコードは GitHub においておきます。Xcode 6 Beta4 で確認しています。 → https://github.com/tsntsumi/SingletonPatternInSwift (git@github.com:tsntsumi/SingletonPatternInSwift.git) 遅延初期化してスレッドセーフな実装方法には 3 つあります。 グローバル定数を使用する方法 ネストした構造体を使用する方法 dispatch_once を使用する方法 グローバル定数を使用する方法 グローバル定数を使用する方
設計を意識したコードが書けるようになる為に、デザインパターン修行しました。 他のDesign Patternもちょくちょく出していきます。 前置き 増補改訂版Java言語で学ぶデザインパターン入門をJavaからPythonにしてます。(Pythonは3.4.2) githubにコード置いてあります(まだ動かないものもある) デザインパターンをどういう時に、何を、どう使うのかを理解することが一先ずの目標。 (Javaというか静的型付言語は初めてで、且つpython歴もそんなに長くないので、Pythonistaぽっくないところがあると思います。ご指摘ございましたらご教授ください。) まず、そもそもデザインパターンってどういうものかってとこから。 デザインパターンとは ソフトウェア開発におけるデザインパターン(型紙(かたがみ)または設計パターン、英: design pattern)とは、過去のソ
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く