いきなり結論を書くと、idやclassはスタイルのためのものなので、テストでそれを使うのはやめましょう。そして、カスタムデータ属性を使いましょう。(idやclassはスタイルのためだけではないという意見はごもっともです!しかし、主にとしてスタイルに使われるということでご了承頂いて以下の駄文に付き合って頂けると幸いです🙇) 先に断っておくと主にreactについての話で、JSXを前提とします。(手法はReactに限りませんが理由は後述) 2020/03/23 追記 この記事は1年以上前に書かれた記事なのでテストフレームワークとしてenzymeを使っていますが、現時点ではTesting Libraryの使用をオススメします。data-testid に対応するクエリを備えています。 React Testing Library · Testing Library はじめに ご存知の通り、ロジックと
This document summarizes several common Rails antipatterns including monolithic controllers, fat controllers, voyeuristic models, duplicate code, and messy migrations. It provides examples of each antipattern and recommendations for refactoring code to avoid them, such as extracting logic into modules, using service objects, and avoiding external dependencies in migrations.Read less
もうこれだけでBad smellしかしませんね。検索とか考えると頭が痛いです。重複考慮した更新や削除とかも同じくきついですね。 従属テーブル作って対応しましょう。 8. メタデータトリブル(メタデータ大増殖) 全く同じテーブルなのに年や月で分かれていたり、同じような列が連続しているやつです。 CREATE TABLE LOG_2013 ( ... ); CREATE TABLE LOG_2014 ( ... ); CREATE TABLE LOG_2015 ( ... ); データが多すぎるから分けた、というケースが多いと思います。古いデータは使わないし、かといってテーブル1つにするとクエリが遅くなるし、みたいな。 上記のようなケースならOKだし、実際そういう経験はありますが。LOG_2014テーブルの2014/12/31のデータが間違ってたので、UPDATEして2015年のデータにしよう
Bill Karwin “SQL Antipatterns: Avoiding the Pitfalls of Database Programming” の読書メモ。 Jaywalking 目的 ある属性について、複数の値を持たせる。 アンチパターン : カンマ区切りリスト カンマ区切りで複数の値を 1 つの列に納める。 例では、特定の製品についての担当者を複数設定するのにカンマ区切りで、担当者のアカウントIDを記述している。 create table products ( product_id integer, product_name varchar(1000), acount_id varchar(100), -- comma separated list -- ... ); insert into products (product_id, product_name, accou
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く