Upgrade to Pro — share decks privately, control downloads, hide ads and more …

リーダブルコード読書会 #1

リーダブルコード読書会 #1

社内リーダブルコード読書会 #1

Kenta Enomoto

July 17, 2014
Tweet

More Decks by Kenta Enomoto

Other Decks in Programming

Transcript

  1. Qཁ໿ม਺ ! if (request.user.id == document.owner_id) {! // Ϣʔβ͸͜ͷจॻΛฤू͢Δ! }!

    ! …! ! if (request.user.id != document.owenr_id) {! // จॻ͸ಡΈऔΓઐ༻! }
  2. Qཁ໿ม਺ ! if (request.user.id == document.owner_id) {! // Ϣʔβ͸͜ͷจॻΛฤू͢Δ! }!

    ! …! ! if (request.user.id != document.owenr_id) {! // จॻ͸ಡΈऔΓઐ༻! }
  3. Qཁ໿ม਺ ! if (request.user.id == document.owner_id) {! // Ϣʔβ͸͜ͷจॻΛฤू͢Δ! }!

    ! …! ! if (request.user.id != document.owenr_id) {! // จॻ͸ಡΈऔΓઐ༻! } ! final boolean user_owns_document = (request.user.id == document.owner_id);! ! if (user_owns_document) {! // Ϣʔβ͸͜ͷจॻΛฤू͢Δ! }! ! …! ! if (!user_owns_document) {! // จॻ͸ಡΈऔΓઐ༻! }
  4. QυɾϞϧΨϯͷ๏ଇΛ࢖͏ if (!(file_exists && !its_protected)) Error("Sorry, could not read file.");

    if (!file_exists || is_protected) Error("Sorry, could not read file.");