勉強日記

チラ裏

2019-07-01から1ヶ月間の記事一覧

Laravel輪読会 ch3 アプリケーションアーキテクチャ

www.socym.co.jp 3-1 MVCとADR 3-1-1 MVC(Model View Controller) MVCとLaravel Laravelにおけるコントローラ Laravelにおけるモデル トランザクションスクリプトパターン ドメインモデルパターン Laravelにおけるビュー 3-1-2 ADR(Action Domain Responder)…

SQL Antipatterns ch18 Spagetti Query

pragprog.com Spagetti Query Objective: Decrease SQL Queries Antipattern: Solve a Complex Problem in One Step Unintended Products As Though That Weren't Enough... How to Recognize the Antipattern Legitimate Uses of the Antipattern Solution:…

SQL Antipatterns ch16 Random Selection

pragprog.com Random Selection Objective: Fetch a Sample Row Antipattern: Sort Data Randomly How to Recognize the Antipattern Legitimate Uses of the Antipattern Solution: In No Particular Order... Choose a Random Key Value Between 1 and MAX…

SQL Antipatterns ch15 Ambiguous Groups

pragprog.com Ambiguous Groups Objective: Get Row with Greatest Value per Group Antipattern: Reference Nongrouped Columns The Single-Value Rule Do-What-I-Mean Queries How to Recognize the Antipattern コラム: GROUP BY and DISTINCT Legitimate…

SQL Antipatterns ch14 Fear of the Unknown

pragprog.com Fear of the Unknown Objective: Distinguish Missing Values Antipattern: Use Null as an Ordinary Value, or Vice Versa Using Null in Expressions Searching Nullable Columns Using Null in Query Parameters Avoiding the Issue How to …

SQL Antipattern ch13 Index Shotgun

pragprog.com Index Shotgun Objective: Optimize Performance Antpattern: Using Indexes Without a Plan No Indexes Too Many Indexes コラム: Indexes Aren't Standard When No Index Can Help コラム: Low-Selectivity Indexes How to Recognize the Ant…

【composer】アノテーションでfriendとかpackage-privateとかをエミュレートするライブラリを作った

【composer】アノテーションでfriendとかpackage-privateとかをエミュレートするライブラリを作った WandTa/Annotation-Visibility Objective: 非標準のアクセス制御を使いたい Solution: アノテーションでオレオレアクセス制御子を定義する Sample 1. Layer…

SQL Antipatterns ch12 Phantom Files

pragprog.com Phantom Files Objective: Store Images or Other Bulky Media Antipattern: Assume You Must Use Files Files Don't Obey DELETE Files Don't Obey Transaction Isolation Files Don't Obey ROLLBACK Files Don't Obey Database Backup Tools …

Laravel.shibuya 3 IRTまとめ

PHP

IRT 1 -- PHP traitについて いつ使う・使わない テストで使いました 認証が必要なテストで、認証コードとテストデータだけtrait化 プロダクトコードではオブジェクトの委譲のほうがうまくいった 特定のメソッドだけmockしたいときに、無名クラスを普通に注…

SQL Antipatterns ch10 Rounding Errors

pragprog.com Rounding Errors Objective: Use Fractional Numbers Instead of Integers Antipattern: Use FLOAT Data Type Rouding by Necessity コラム: Meet the IEEE 754 Format Using FLOAT in SQL How to Recognize the Antipattern Legitimate Uses o…

SQL Antipatterns ch9 Metadata Tribbles (WIP)

pragprog.com Metadata Tribbles Objective: Support Scalability Antipattern: Clone Tables or Columns コラム: Mixing Metadata with Data Spawning Tables Managing Data integrity Synchronizing Data Ensuring Uniqueness Querying Across Tables Sync…

SQL Antipatterns ch8 Multicolumn Attriubtes

pragprog.com Multicolumn Attriubtes Objective: Store Multivalue Attributes Antipattern: Create Multiple Columns Searchinig for Values Adding and Removing Values Ensuring Uniqueness Handling Growing Sets of Values How to Recognize the Antip…

SQL Antipatterns ch7 Polymorphic Associations (WIP)

pragprog.com Polymorphic Associations Objective: Reference Multiple Parents Antipattern: Use Dual-Purpose Foreign Key Defining a Polymorphic Association Querying a Polymorphic Association Non-Object-Oriented Example コラム: Mixing Data Wit…

SQL Antipatterns ch6 Entity-Attribute-Value

pragprog.com Entity-Attribute-Value Objective: Support Vairable Attribute Antipattern: Use a Generic Attribute Table Querying an Attribute Supporting Data Integrity Reconstructing a Row How to Recognize the Antipattern Legitimate Use of th…

SQL Antipatterns ch5 Keyless Entry

pragprog.com Keyless Entry Objective: Simplify Database Architecture Antipattern: Leave Out the Constraints Assuming Flawless Code Checking for Mistakes "It's Not My Fault!" Catch-22 Updates How to Recognize the Antipattern Legitimate Uses…

SQL Antipatterns ch4 ID Required

pragprog.com ID Required コラム: Do I Really Need a Primary Key? Objective: Establish Primary Key Conventions Antipattern: One Size Fits All Making a Redundant Key Allowing Duplicate Rows Obscuring the Meaning of the Key Using USING Compou…

SQL Antipatterns ch3 Naive Trees

pragprog.com Naive Trees Objective: Store and Query Hierarchies Antipattern: Always Depend on One's Parent Query a Tree with Adjacency List Mantaining a Tree with Adjacency List How to Recognize the Antipatterns Legitimate Uses of the Anti…

ガルパンコラボカフェのランダムコースター(12種)を25枚ツモってもコンプできなかった話

背景 経済回した結果 25枚ツモって10/12種類って屑運なのでは 出力結果 考察 25枚ツモったときの確率分布 Q. コンプ率5割超えるためには何枚ツモらないといけないの 背景 sega-collabocafe.com ガルパン最終章第2話が上映される セガコラボカフェでガルパン…

理論から学ぶデータベース実践入門 ch14 トランザクションの本質

gihyo.jp まとめ トランザクション トランザクションの機能 トランザクションの鍵、スケジュール 「データの正しさ」の定義 スケジューラの性能 トランザクションの特徴 ACIDとは 原子性(Atomicity) 一貫性(Consistensy) 分離性(Isolation) 永続性(Durabilit…

理論から学ぶデータベース実践入門 ch13 リファクタリングの最適解

gihyo.jp まとめ リファクタリング DBのリファクタリングは大変 マルチアプリケーションにおけるDB環境 なぜリファクタリングが必要なのか リファクタリングの手順 スキーマの移行期間 反復的なリファクタリング 回帰テスト ベンチマークテスト マイグレーシ…

理論から学ぶデータベース実践入門 ch12 Webアプリケーションのためのデータ構造 (2/2)

gihyo.jp タグ コラム: 転置インデックスを使用して検索を高速化する スケールアウト レプリケーション スレーブへの問い合わせ方式 データの論理的整合性と非同期レプリケーション シャーディング 問題点 NoSQLのシャーディング タグ RDBにとって頭の痛いデ…

理論から学ぶデータベース実践入門 ch12 Webアプリケーションのためのデータ構造 (1/2)

gihyo.jp まとめ キャッシュという考え方 メリット/デメリット DBアプリケーションにおけるキャッシュ キャッシュはあくまでもキャッシュ キャッシュとして使うための要件 キャッシュすべきデータの種別 キャッシュすべきでない キャッシュ可能 キャッシュの…

理論から学ぶデータベース実践入門 ch11 インデックスの設計戦略 (2/2)

gihyo.jp リレーショナルモデルとインデックス インデックスはリレーショナルモデルの一部ではない 正規化とインデックス カラム数が絞られる 問題児NULL 指令: 最適なインデックスを探せ! 必要なインデックス インデックスのアクセス特性 インデックスが使…

SQL Antipatterns ch11 31 Flavors (WIP)

pragprog.com 31 flavors Objective: Restrict a Column to Specific Values Antipattern: Specify Values in the Column Definition コラム: Baskin-Robbins 31 Ice Cream What Was the Middle One? Adding a New Flavor Old Flavors Never Die Portability…

理論から学ぶデータベース実践入門 ch11 インデックスの設計戦略 (1/2)

gihyo.jp まとめ インデックスの働き RDBのインデックス インデックスの左端と範囲検索 セカンダリインデックスの更新 インデックスの種類 ハッシュインデックス 全文検索インデックス 形態素解析 Nグラム Rツリーインデックス 関数インデックス ビットマッ…

理論から学ぶデータベース実践入門 ch10 グラフに立ち向かう

gihyo.jp まとめ グラフの構造 ノード、エッジ 隣接 次数 歩道、小道、道 多重辺 ループ 閉路 連結 部分グラフ カットセット、ブリッジ エッジの向きと重み グラフの応用例 グラフの種類 一般グラフ 単純グラフ 連結グラフ/非連結グラフ 完全グラフ 正則グラ…

理論から学ぶデータベース実践入門 ch9 履歴データとうまく付き合う

gihyo.jp まとめ 履歴データの問題点 世界は履歴データで溢れている 履歴とリレーショナルモデルの相性問題 履歴データの具体例 履歴データの何が問題になるのか リレーションと時間軸との直交性 NULLの可能性 特定の行だけ意味が違う 履歴データに対する解…

理論から学ぶデータベース実践入門 ch8 SELECTを攻略する (2/2)

gihyo.jp リレーショナルではない操作 リレーショナルな操作のおさらい ソート 明示的に定義されていないカラム ストアドファンクション(ユーザ定義関数) コラム: 集約とGROUP BY リレーショナルではない操作の扱い方 インデントでSQLを読みやすくする リレ…

理論から学ぶデータベース実践入門 ch8 SELECTを攻略する (1/2)

gihyo.jp まとめ SELECTはSQLの心臓部 SELECTの本質 SELECTの強大さ データを取得する唯一の手段 SELECTの基本構造 SELECT七変化 集約関数 関数の有無だけで意味が変わる COUNTの特殊性 GROUP BYによる集約の書式 サブクエリ テーブルサブクエリ スカラサブ…

理論から学ぶデータベース実践入門 ch6 ドメインの設計戦略 2/2

gihyo.jp IDを設計するという考え方 現実世界の物体や概念を表す手段 ナチュラルキーとサロゲートキー ナチュナルキーの使いどころと問題点 サロゲートキーの使いどころと問題点 リレーショナルモデルにおけるキー 意味を含んだID 紙の呪縛 IDの欠陥は波及す…