Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

୺తʹݴ͏ͱɺ ͱͯͭ΋ͳ͍ॊೈ͞Λ͍࣋ͬͯΔ RubyͱRailsͷڧΈͱ͸ ཭ΕͯΈΔͱ࿀͘͠ͳΔڧΈΛৼΓฦΔ

Slide 4

Slide 4 text

Rails͸ࠓ΋ੜ࢈ੑͷ࠷దղͷͻͱͭ • ϏϡʔΛ࣋ͨͳ͍APIαʔόͰ͋ͬͯ΋ڧΈ͕ͨ͘͞Μ͋Δ • Ή͠ΖϑϩϯτΤϯυ͸JS/TSʹ೚͍ͤͨ • RubyͱRails͸ϏδωεϩδοΫΛॻ͘ͷʹదͨ͠ݴޠͱϑϨʔϜϫʔΫ • جຊޠኮ͕๛෋ͰɺυϝΠϯʹదͨ͠৽͍͠ޠኮΛ૿΍͢ͷ΋ಘҙ • ΍ΓͱΓ͢ΔΦϒδΣΫτ͕΄΅ActiveRecord ModelΠϯελϯε΍RelationΦϒδΣΫτʹدΔͷ Ͱɺ΄΅self-documented, ݟΔ࣮૷͕ܾ·͍ͬͯΔͷͰಈతܕ෇͚ͷऑΈ͕໨ཱͪͮΒ͍ • ActiveRecordͷྫ֎ͱrescue_fromʹΑΔิ଍ػߏ͕RESTͱ͔ͬͪΓϋϚ͍ͬͯΔ

Slide 5

Slide 5 text

ActiveRecord͕ڧ͍ • CRUD: ܕม׵΍όϦσʔγϣϯΛ׬උ • ৚݅ݕࡧɺJOINɺूܭɺࢥ͍ͷ·· • ·ͱ΋ͳSQLΛ࡞ͬͯ͘ΕΔ • DRYͷపఈ • DBͷεΩʔϚͱstructఆٛΛೋॏ؅ཧ͠ͳ͍͍ͯ͘ • default஋΋ಡΜͰ͘ΕΔ

Slide 6

Slide 6 text

ActiveRecord Migration͕ڧ͍ • ฒߦ։ൃ΍ॱෆಉͷσϓϩΠʹ଱͑Δόʔδϣϯ؅ཧ • ݸʑͷϚΠάϨʔγϣϯʹ͍ͭͯద༻ঢ়ଶ͕؅ཧ͞Ε͍ͯͯɺݸผʹup/down΋Մೳ • DDL΋DML΋ྲྀͤΔ • Ϗϡʔ΍ϑΝϯΫγϣϯͷྨ΋௥ՃgemͰεΩʔϚͷҰ෦ͱͯ͠؅ཧՄೳ • σʔλϕʔεΤϯδϯΛ࢖͍౗ͤΔʂ GoͰۤ࿑͠·ͨ͠😝

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

Rails console͕ڧ͍ • ௐࠪ΍σʔλෆ੔߹ͷۓٸमਖ਼ɺόονॲཧͷϦϋʔαϧͳͲʹେ׆༂ • ίϯύΠϧ΋σϓϩΠ΋ͳ͠ʹɺ೚ҙͷϏδωεϩδοΫΛݺͼग़ͤΔ • όονॲཧͷྨ͸֎෦αʔϏε࿈ܞ΋ଟ͘ɺϫϯγϣοτͩͬͨΓ΋ͯ͠ɺ೦ೖΓͳςε τΛॻ͍͔ͯΒ࣮૷͢Δίετ͕·ͬͨ͘ݟ߹Θͳ͘ײ͡Δ͜ͱ΋ଟ͍ • ͦΜͳͱ͖ɺ։ൃ؀ڥ΍εςʔδϯά؀ڥͰRails console͔Β൓෮ࢼߦͯ֬͠ೝͰ͖Δ͜ ͱ͸େ͖ͳ෢ث ͜Εຊ౰ʹݟա͕ͪ͝͠😳

Slide 10

Slide 10 text

୺తʹݴ͏ͱɺ ։ൃମݧͰޙΕΛऔ͍ͬͯΔ RubyͱRailsͷऑΈͱ͸ ཭ΕͯΈΔͱ໭Γͨ͘ͳ͘ऑΈΛৼΓฦΔ

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

ॳΊͯ͞ΘΔਓʹ΋΍͘͞͠… • ϕʮRubyͰ͸͜Μͳ෩ʹॻ͚ΔΑʯ • ॳʮ͍͢͝ɺ؆ܿͰ͔͍͍ͬ͜Ͱ͢Ͷʂʯ • ॳʮʢͰ΋ଞͷݴޠʹԠ༻ޮ͔ͳ͍஌ࣝͩ…ʣʯ • ॳʮͥΜͥΜิ׬ީิ͕ग़ͯ͜ͳ͍Μ͚ͩͲΈͳ͞ΜͲ͏΍ͬͯઃఆͯ͠ΔΜͰ͔͢ʁʯ • ϕʮ͍͢͝ϓϥάΠϯઃఆͱ͔ಛʹͳͯ͘ɺΈΜͳۭͰॻ͍ͯ·͢… 
 ͦΕ͔RubyMine࢖ͬͯΈΔʁʯ • ॳʮʢࢧԉͳ͠Ͱॻ͘ͷ·͔͡…ʣʯ TypeScript/Go/Kotlin͸ݴΘͣ΋͕ͳɺ΋͸΍Python΋PHP΋ܕΞ ϊςʔγϣϯΛॻ͘͠ఆٛδϟϯϓΛ͹Μ͹Μ࢖͏ͷ͕;ͭ͏😇

Slide 13

Slide 13 text

LinterΛࣂ͍׳Β͢ͷ͕େม • RubocopͷσϑΥϧτઃఆ͕ͭΒ͍ • ίϛϡχςΟʔϕʔεͱ͍͏ͷ͕ۂऀͰɺ௚ͤͱݴΘΕΔ͕ཧ༝͕ෆ໌ͳͷͰ࠷ॳ͔Β ܗ֚Խ͍ͯ͠Δ • ࣗಈϑΥʔϚολʔͱͯ͠͸ಈ࡞͕஗͗͢Δ • อଘ࣌ࣗಈ੔ܗʹͯ͠ؾܰʹηʔϒͰ੔ܗɺͱ͍͕ͨ͠਺ඵֻ͔ΔͷͰମݧ͕ྑ͘ͳ͍

Slide 14

Slide 14 text

ܕ෇͚ରԠΛ΋ͬͱ͕Μ͹Γ͍ͨ • ܕ͸΋͸΍ݱ୅ϓϩάϥϚʔͷϝϯλϧϞσϧʹ͍ࠜͯ͟͠Δ • Ή͠ΖίʔυͷҙਤͷҰ෦ͱͯ͠ܕΛॻ͖͍ͨͰ͟͝Δ • ผϑΝΠϧ؅ཧ͸͠ΜͲ͍.rbs (.rbi) • ΤσΟλͰΠϯϥΠϯදࣔɾฤूͰ͖Ε͹؇࿨ʁ • SorbetʹΑΔΞϊςʔγϣϯ΋DRYʹͳ͍ͬͯͳ͍ • ϝιουͷԾҾ਺ɺಛʹΩʔϫʔυҾ਺ͷೋ౓ॻ͖͕ͩΔ͍

Slide 15

Slide 15 text

ͦΕͰ΋… 
 RubyͱRails͸ڧ͍ มԽΛแ༰͢Δྗ

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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