勉強日記

チラ裏

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

IPv6 IPoE + IPv4にした話

はやい はやくなる前 申し込み 光BBユニットが届く つなぐ 何もわからない。俺たちは雰囲気でパソンココを繋いでいる ソフトバンク光が遅いからIPv6高速ハイブリッド IPv6 IPoE + IPv4にした はやい わあい 別プロトコルを使うことで、混雑している回線を避…

月末にCarbon::createFromFormat('Ym', ...)してはいけない話

8/31に2月を作ろうとしたら3月になった例 どうしてこうなった 2019年8月31日に実行 Carbon::create(...$args)は大丈夫 Carbon::createFromFormat($format, $datetimeStr)が危険 回避方法 -- Ymd使え 8/31に2月を作ろうとしたら3月になった例 3月!? どうし…

【Emacs】Yasnippetを活用した話

テストコード作成補助まだまだ調整必要だけど捗りそうな感じになった pic.twitter.com/zy8c8IwmGe— 人魚姫ちゃん(D. Horiyama) (@wand_ta) August 30, 2019 ↑コンストラクタの名前を間違ってるのはご愛嬌 __constructが正しい 入れて満足してほとんど使って…

【contribute】Ray.AOP

Added BEAR.Sunday contributors https://t.co/1xzI0ign2M @wand2016 https://t.co/RDW0BEFlPY Arigato! pic.twitter.com/2BoB8b2EOG— BEAR.Sunday (@BEARSunday) August 28, 2019 アイコンで草生える issue github.com PR github.com 反省点 静的解析を回さ…

Clean Architecture Part III ch10 ISP: The Interface Segregation Principle

www.pearson.com ISP: The Interface Segregation Principle ISP and Language ISP and Architecture Conclusion 英語 ISP: The Interface Segregation Principle SRPに則ってない User1はop1だけ利用 User2はop2だけ利用 User3はip3だけ利用 op1に変更を加…

Clean Architecture Part III ch9 LSP: The Liskov Substitution Principle

www.pearson.com LSP: The Liskov Substitution Principle Guiding The Use of Inheritance The Square/Rectangle Problem LSP and Architecture Example LSP Violation Conclusion 英語 LSP: The Liskov Substitution Principle 置換可能性 o1: S o2: T P -…

PoEAA ch13 Repository

martinfowler.com Repository How It Works When to Use It Further Reading コード例 英語 Repository Mediates between the domain and data mapping layers using a collection-like interface for accessing domain objects. Domain ModelとData Mapper…

PoEAA ch13 Metadata Mapping

martinfowler.com Metadata Mapping How It Works When to Use It コード例 Metadata Mapping Holds details of object-relational maping in metadata. O/Rマッピングのコードのほとんどは、フィールドの対応づけ DBのテーブルのフィールド メモリ上のオブ…

PoEAA ch12 Single Table Inheritance

martinfowler.com Single Table Inheritance How It Works When to Use It コード例 英語 Single Table Inheritance Represents an inheritance hierarchy of classes as a single table that has columns for all the fields of the various classes. RDBは…

PoEAA ch12 Serialized LOB

martinfowler.com Serialized LOB How It Works When to Use It Example: Serializing a Deparment Hierarchy in XML Serialized LOB Saves a graph of objects by serializing them into a single large object (LOB), which it stores in a database field…

PoEAA ch15 Data Transfer Object

martinfowler.com Data Transfer Object How It Works Serializing the Data Transfer Object Assembling a Data Transfer Object from Domain Objects When to Use It Further Reading Example: Transferring Information About Albums (Java) Example: Ser…

LaravelのRDB絡みのテストを速くした話

結論 背景 参考 原因 solution -- migrate:freshではなくmigrateを使用する migrate:freshとmigrateの違い migrate使用による高速化 sample code -- RefreshDatabaseトレイトをoverrideする 結論 テスト始動に70秒かかっていたのが一瞬で始まるようになった …

PoEAA ch12 Class Table Inheritance

martinfowler.com Class Table Inheritance How It Works When to Use It Furhter Reading コード例 Class Table Inheritance Represents an inheritance hierarchy of classes with one table for each class. 1クラス1テーブル 抽象クラス含む How It Work…

Refactoring ch2 Principles in Refactoring (2/2) WIP

martinfowler.com Principles in Refactoring Refactoring in a Code Review What Do I Tell My Manager? When Should I Not Refactor? Problems with Refactoring Slowing Down New Features Code Ownership Branches Testing Legacy Codes Databases Refac…

PoEAA ch12 Concrete Table Inheritance

martinfowler.com Concrete Table Inheritance How It Works When to Use It Example: Concrete Players(C#) 英語 Concrete Table Inheritance Represents an inheritance hierarchy of classes with one table per concrete class in the hierarchy. 具象ク…

Refactoring ch2 Principles in Refactoring (1/2)

martinfowler.com Defining Refactoring The Two Hats Why Should We Refactor? Refactoring Improves the Design of Software Refactoring Makes Software Easier to Understand Refactoring Helps Me Find Bugs Refactoring Helps Me Program Faster When …

PoEAA ch11 Identity Map

martinfowler.com Identity Map How It Works Choice of Keys Explicit or Generic How Many セッションに1つ クラス/テーブルにつき1つ Where to Put Them When to Use It Example: Methods for an Identity Map Identity Map Ensures that each object get…

PoEAA ch11 Lazy Load

martinfowler.com Lazy Load How It Works 種類 Lazy Initialization Virtual Proxy Value Holder Ghost When to Use It Example: Lazy Initialization Example: Virutal Proxy Example: Using a Value Holder (Java) Example: Using Ghosts (C#) 英語 Lazy …

【squid】HTTPプロキシサーバ立てた

構築後のネットワークのイメージ 背景 Solution: クラウドサーバーにHTTPプロキシを立てる 設定 squidの設定 クラウドサーバーの設定 プロキシ経由してHTTPリクエスト送る 構築後のネットワークのイメージ ブログのサムネ用 背景 外部システムのIFと連携する…

【Laravel】configをテストするなどした

背景 サンプル テスト そもそもアンチパターンなのでは? 背景 /config/hoge.phpの中身を\Config::get('hoge.path.to.value')って感じに読み取れるアレ /config/配下のPHPはarrayを返しさえすれば何でも書ける Facadeとかは動かないけど 業務で、configの中…

Refactoring ch1 A First Example -- PHPで書き直してみた (2/3)

martinfowler.com Splitting the Phases of Calculation and Formatting Separated Into Two Files 英語 Splitting the Phases of Calculation and Formatting 1/3 でコード構造化した結果からスタート repos

Refactoring ch1 A First Example -- PHPで書き直してみた (1/3)

martinfowler.com The Starting Point 【補】テスト書く Decomposing the statement Function Refactoring 2nd EditionはJavaScriptで書かれている コードを読める人口がもっとも多いであろう、という理由から 「JavaScriptのリファクタリングの本」ではない…

SQL Antipatterns ch25 Magic Beans

pragprog.com Magic Beans Objective: Simplify Models in MVC Antipattern: the Model Is an Active Record コラム: Leaky Abstractions Active Record Couples Models to the Schema Active Record Exposes CRUD Functions Active Record Encourages an An…

PoEAA ch12 Inheritance Mappers

martinfowler.com Inheritance Mappers How It Works When to Use It コード例 英語 Inheritance Mappers A structure to organize database mappers that handle inheritance hierarchys. @startuml abstract class Mapper { + insert(DomainObject) + upda…

Clean Architecture Part III ch8 OCP: The Open-Closed Principle

www.pearson.com OCP: The Open-Closed Principle A Thought Experiment Directional Control Information Hiding Conclusion 英語 OCP: The Open-Closed Principle 1988, Bertrand Meyer提唱 A software artifact should be open for extension but closed …

SQL Antipatterns ch24 Diplomatic Immunity

pragprog.com Diplomatic Immunity Objective: Employ Best Practice Antipattern: Make Sql a Second-Class Citizen How to Recognize the Antipattern Legitimate Uses of the Antipattern Solution: Esablish a Big-Tent Culture of Quality Exhibit A: D…

PoEAA ch13 Query Object

martinfowler.com Query Object How It Works When to Use It Further Reading コード例 英語 Query Object An object that represents a database query. SQLを直接使うと生じる問題: アプリケーション開発者がSQLに不慣れ アプリケーションコードとSQLとの…

PoEAA ch14 Model View Controller

martinfowler.com Model View Controller How It Works ModelからViewの分離 ViewからControllerの分離 When to Use It 英語 Model View Controller Splits user interface interaction into three distinct roles. 最も多く引用される(そして、もっとも間違…

SQL Antipatterns ch23 See No Evil

pragprog.com See No Evil Objective: Write Less Code Antipattern: Making Bricks Without Straw Diagnoses Without Diagnostics Lines Between the Reading How to Recognize the Antipattern Legitimate Uses of the Antipattern Solution: Recover from…

SQL Antipatterns ch22 Pseudokey Neat-Freak

pragprog.com Pseudokey Neat-Freak Objective: Tidy Up the Data Antipattern: Filling in the Corners Assigning Numbers Out of Sequence Renumbering Existing Rows Manufacturing Data Discrepancies How to Recognize the Antipattern Legitimate Uses…