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

RubyとRailsの何が強いのか

 RubyとRailsの何が強いのか

Presented in Qiita Night Lightning Talks on 2022-12-02
https://increments.connpass.com/event/265957/

Akinori MUSHA

December 02, 2022
Tweet

More Decks by Akinori MUSHA

Other Decks in Programming

Transcript

  1. RubyͱRailsͷԿ͕ڧ͍ͷ͔ ෢ऀ থل

  2. Software Engineer, Senior Expert at WED Inc. ✓Ruby Committer /

    ex. FreeBSD Committer ✓Huginn (⭐37k) Co-maintainer ✓Hammerspoon (⭐9.8k) Contributor Writes Production Code In Ruby / TypeScript / Go / Lua ෢ऀ থل (Akinori Musha) @knu on GitHub and Twitter
  3. ୺తʹݴ͏ͱɺ ͱͯͭ΋ͳ͍ॊೈ͞Λ͍࣋ͬͯΔ RubyͱRailsͷڧΈͱ͸ ཭ΕͯΈΔͱ࿀͘͠ͳΔڧΈΛৼΓฦΔ

  4. Rails͸ࠓ΋ੜ࢈ੑͷ࠷దղͷͻͱͭ • ϏϡʔΛ࣋ͨͳ͍APIαʔόͰ͋ͬͯ΋ڧΈ͕ͨ͘͞Μ͋Δ • Ή͠ΖϑϩϯτΤϯυ͸JS/TSʹ೚͍ͤͨ • RubyͱRails͸ϏδωεϩδοΫΛॻ͘ͷʹదͨ͠ݴޠͱϑϨʔϜϫʔΫ • جຊޠኮ͕๛෋ͰɺυϝΠϯʹదͨ͠৽͍͠ޠኮΛ૿΍͢ͷ΋ಘҙ •

    ΍ΓͱΓ͢ΔΦϒδΣΫτ͕΄΅ActiveRecord ModelΠϯελϯε΍RelationΦϒδΣΫτʹدΔͷ Ͱɺ΄΅self-documented, ݟΔ࣮૷͕ܾ·͍ͬͯΔͷͰಈతܕ෇͚ͷऑΈ͕໨ཱͪͮΒ͍ • ActiveRecordͷྫ֎ͱrescue_fromʹΑΔิ଍ػߏ͕RESTͱ͔ͬͪΓϋϚ͍ͬͯΔ
  5. ActiveRecord͕ڧ͍ • CRUD: ܕม׵΍όϦσʔγϣϯΛ׬උ • ৚݅ݕࡧɺJOINɺूܭɺࢥ͍ͷ·· • ·ͱ΋ͳSQLΛ࡞ͬͯ͘ΕΔ • DRYͷపఈ

    • DBͷεΩʔϚͱstructఆٛΛೋॏ؅ཧ͠ͳ͍͍ͯ͘ • default஋΋ಡΜͰ͘ΕΔ
  6. ActiveRecord Migration͕ڧ͍ • ฒߦ։ൃ΍ॱෆಉͷσϓϩΠʹ଱͑Δόʔδϣϯ؅ཧ • ݸʑͷϚΠάϨʔγϣϯʹ͍ͭͯద༻ঢ়ଶ͕؅ཧ͞Ε͍ͯͯɺݸผʹup/down΋Մೳ • DDL΋DML΋ྲྀͤΔ • Ϗϡʔ΍ϑΝϯΫγϣϯͷྨ΋௥ՃgemͰεΩʔϚͷҰ෦ͱͯ͠؅ཧՄೳ

    • σʔλϕʔεΤϯδϯΛ࢖͍౗ͤΔʂ GoͰۤ࿑͠·ͨ͠😝
  7. Sidekiq͕ڧ͍ • खܰʹδϣϒΛ࡞͙ͬͯ͢࢖͑Δ • PubSubͩͱTerraformͰτϐοΫΛ৽ઃͯ͠ϫʔΧʔʹsubscriberΛ༻ҙͯ͠… • ߴ౓ͳྲྀྔ੍ޚ΍ॏෳɾഉଞ੍ޚ͕ඞཁʹͳͬͯ΋༰қʹରԠ • Sidekiq Pro/EnterpriseΛങͬͯ΋͍͍͠ɺOSSͷιϦϡʔγϣϯ΋๛෋

  8. RSpec͕ڧ͍ • ͳΜͰ΋ϞοΫͰ͖Δ • ΠϯλϑΣʔεΛ෼཭ఆٛͨ͠Γ͠ͳͯ͘΋͢΂͕ͯTest Ready • σʔλϕʔεͷΫϦΞͳͲͥΜͿRails+RSpecଆͰ໘౗Λݟͯ͘ΕΔ • E2EςετʢFeature

    specʣ΋ඪ४૷උ
  9. Rails console͕ڧ͍ • ௐࠪ΍σʔλෆ੔߹ͷۓٸमਖ਼ɺόονॲཧͷϦϋʔαϧͳͲʹେ׆༂ • ίϯύΠϧ΋σϓϩΠ΋ͳ͠ʹɺ೚ҙͷϏδωεϩδοΫΛݺͼग़ͤΔ • όονॲཧͷྨ͸֎෦αʔϏε࿈ܞ΋ଟ͘ɺϫϯγϣοτͩͬͨΓ΋ͯ͠ɺ೦ೖΓͳςε τΛॻ͍͔ͯΒ࣮૷͢Δίετ͕·ͬͨ͘ݟ߹Θͳ͘ײ͡Δ͜ͱ΋ଟ͍ •

    ͦΜͳͱ͖ɺ։ൃ؀ڥ΍εςʔδϯά؀ڥͰRails console͔Β൓෮ࢼߦͯ֬͠ೝͰ͖Δ͜ ͱ͸େ͖ͳ෢ث ͜Εຊ౰ʹݟա͕ͪ͝͠😳
  10. ୺తʹݴ͏ͱɺ ։ൃମݧͰޙΕΛऔ͍ͬͯΔ RubyͱRailsͷऑΈͱ͸ ཭ΕͯΈΔͱ໭Γͨ͘ͳ͘ऑΈΛৼΓฦΔ

  11. Rubyͷ։ൃମݧ͸ϋοϐʔͳΜ͡Όͳ͍ͷʁ 👍 ҙਤΛࣗ༝ʹදݱͰ͖ΔɺറΓ͕গͳ͍ • ݴޠͷ੍໿ճආͷςΫχοΫ͕ཁΒͳ͍ • ʮͨΊͷʯσβΠϯύλʔϯɺΠϯλʔϑΣʔε͕ͳ͍ 👎 ੍໿Λදݱɺڧ੍͢Δޠኮʹ๡͍͠ •

    ಡΈखʹͱͬͯͷώϯτɺΠϯλϓϦλʹͱͬͯͷώϯτ • ॻ͖खͷϛε๷ࢭ
  12. ॳΊͯ͞ΘΔਓʹ΋΍͘͞͠… • ϕʮRubyͰ͸͜Μͳ෩ʹॻ͚ΔΑʯ • ॳʮ͍͢͝ɺ؆ܿͰ͔͍͍ͬ͜Ͱ͢Ͷʂʯ • ॳʮʢͰ΋ଞͷݴޠʹԠ༻ޮ͔ͳ͍஌ࣝͩ…ʣʯ • ॳʮͥΜͥΜิ׬ީิ͕ग़ͯ͜ͳ͍Μ͚ͩͲΈͳ͞ΜͲ͏΍ͬͯઃఆͯ͠ΔΜͰ͔͢ʁʯ •

    ϕʮ͍͢͝ϓϥάΠϯઃఆͱ͔ಛʹͳͯ͘ɺΈΜͳۭͰॻ͍ͯ·͢… 
 ͦΕ͔RubyMine࢖ͬͯΈΔʁʯ • ॳʮʢࢧԉͳ͠Ͱॻ͘ͷ·͔͡…ʣʯ TypeScript/Go/Kotlin͸ݴΘͣ΋͕ͳɺ΋͸΍Python΋PHP΋ܕΞ ϊςʔγϣϯΛॻ͘͠ఆٛδϟϯϓΛ͹Μ͹Μ࢖͏ͷ͕;ͭ͏😇
  13. LinterΛࣂ͍׳Β͢ͷ͕େม • RubocopͷσϑΥϧτઃఆ͕ͭΒ͍ • ίϛϡχςΟʔϕʔεͱ͍͏ͷ͕ۂऀͰɺ௚ͤͱݴΘΕΔ͕ཧ༝͕ෆ໌ͳͷͰ࠷ॳ͔Β ܗ֚Խ͍ͯ͠Δ • ࣗಈϑΥʔϚολʔͱͯ͠͸ಈ࡞͕஗͗͢Δ • อଘ࣌ࣗಈ੔ܗʹͯ͠ؾܰʹηʔϒͰ੔ܗɺͱ͍͕ͨ͠਺ඵֻ͔ΔͷͰମݧ͕ྑ͘ͳ͍

  14. ܕ෇͚ରԠΛ΋ͬͱ͕Μ͹Γ͍ͨ • ܕ͸΋͸΍ݱ୅ϓϩάϥϚʔͷϝϯλϧϞσϧʹ͍ࠜͯ͟͠Δ • Ή͠ΖίʔυͷҙਤͷҰ෦ͱͯ͠ܕΛॻ͖͍ͨͰ͟͝Δ • ผϑΝΠϧ؅ཧ͸͠ΜͲ͍.rbs (.rbi) • ΤσΟλͰΠϯϥΠϯදࣔɾฤूͰ͖Ε͹؇࿨ʁ

    • SorbetʹΑΔΞϊςʔγϣϯ΋DRYʹͳ͍ͬͯͳ͍ • ϝιουͷԾҾ਺ɺಛʹΩʔϫʔυҾ਺ͷೋ౓ॻ͖͕ͩΔ͍
  15. ͦΕͰ΋… 
 RubyͱRails͸ڧ͍ มԽΛแ༰͢Δྗ

  16. ͜Ε͕మ൘ߏ੒✨ RailsϞϊϦεͷपΓʹϚΠΫϩαʔϏε • ߴϨΠϠʔΛ୲͏ʹ;͞Θ͍͠ॊೈੑ • GoͰ֎෦γεςϜ࿈ܞόοΫΤϯυΛॻ͍ͯRails͔ΒgRPC • PythonͰը૾ॲཧαʔϏεΛॻ͍ͯSidekiq͔Β࣮ߦ • LP΍ಛઃαΠτ͸Nuxt.js΍FreshͰָ͘͠ॻ͘

  17. https://wed.company/recruit WED Inc. is Hiring! WED͸Ұॹʹ։ൃ͢Δ஥ؒΛ୳͍ͯ͠·͢ʂ