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

BEAR.Sunday (2018)

BEAR.Sunday (2018)

BEAR.Sunday is a resource orientated framework with a REST centered architecture, implementing Dependency Injection and Aspect Orientated Programming' at its core. #phperKaigi

Akihito Koriyama

March 10, 2018
Tweet

More Decks by Akihito Koriyama

Other Decks in Technology

Transcript

  1. DIP: ґଘؔ܎ٯసͷݪଇ • ίʔυ͸ಉ౳Ҏ্ͷϨϕϧͷந৅ʹґଘ͢Δ • ԼҐϨϕϧͷৄࡉʹґଘ͠ͳ͍ • Code should depend

    on things that are at the same or higher level of abstraction • High level policy should not depend on low level details Dependency inversion principle
  2. “ґଘੑٯసݪଇ͸ΦϒδΣΫτࢦ޲ٕज़ͷརӹͷࠜװΛͳ͢΋ͷɻ
 ࠶ར༻ΛՄೳʹ͢ΔϑϨʔϜϫʔΫͷ։ൃʹ͸ͦͷݪଇద༻͕ඞਢ” Robert Martin (a.k.a. Uncle Bob) “The principle of

    dependency inversion is at the root of many of the benefits claimed for object- oriented technology. Its proper application is necessary for the creation of reusable frameworks”
  3. ڊେɻ͔̍ͭ͠͠ͷม਺ͱͯ͠อଘՄೳɻ Huge, but can be stored one single value $app

    ϦΫΤετΛ௒͑ͯDI͕࠶ར༻Ͱ͖Δ Injection is reused beyond requests.
  4. • ֦ுੑ • ฒߦ։ൃ • ϝϯςφϯε • ςελϏϦςΟ • ΦϒδΣΫτͱར༻ͷੜ੒ͷ෼཭

    • ΦϒδΣΫτσϦόϦʔ DIͷར఺ Extensibility Maintainability Parallel development Testability Clear separation of object instantiation and object usage Object delivery DI benefit
  5. 1st framework: DI Framework • DSLͱΞϊςʔγϣϯΛ࢖ͬͨDIϑϨʔϜϫʔΫ • ૄ݁߹ • ίϯύΠϧͱϥϯλΠϜͷ۠ผ

    • ΞϓϦέʔγϣϯ͸୯ҰͷΦϒδΣΫτ • CodegenͰߴ଎ loosely coupled compile time and runtime application root object DI framework with DSL w/ annotation fast
  6. What is AOP? Cache Log Auth ԣஅతؔ৺ࣄΛ෼཭Մೳʹ͢Δ͜ͱʹΑΓ
 ϞδϡϥϦςΟʔΛ૿Ճͤ͞Δ͜ͱΛ໨తͱͨ͠
 ϓϩάϥϛϯάύϥμΠϜ A

    programming paradigm that aims to increase modularity by allowing the separation of cross-cutting concerns
  7. 2nd framework: Aspect Oriented Framework • AOPΞϥΠΞϯε • ίϯςΩετʹΑΔϨΠϠϦϯά •

    ܕ҆શ • CodegenͰߴ଎ AOP Alliance Laying by context Type safety Fast
  8. 1)1

  9. API APIۦಈ։ൃ DB Mobil e Web API Cloud Moc k

    URI API • API is hub • API is core value API driven development
  10. 3rd framework: REST Framework • RESTfulͳϦιʔείϯςφ • HTTPඪ४ • ࠶ར༻ੑ

    • ڧྗͳΩϟογϡ RESTful container HTTP standard Reusability Cache-friendly
  11. Performance • annotation ? dependency injection ? 
 method interception

    ? DSL ? named parameter ? • ߴ଎ • ΦϒδΣΫτάϥϑΩϟογϡ • Codegen Fast Object graph cache
  12. Connecting frameworks • DI - ΦϒδΣΫτΛ݁Ϳ • AOP - Domain

    LogicͱApplication LogicΛ݁Ϳ • REST -ϦιʔεΛ݁Ϳ Connecting objects Connecting domain logic and application logic Connecting resources
  13. AOP (Gregor Kiczales) DI (Martin Fowler) REST (Roy Fielding) OOP

    (Allan Kay) Annotation (Anders Hejlsberg) Guice (Bob Lee)
  14. Why BEAR.Sunday ? • RESTfullΫϦʔϯΞʔΩςΫνϟ • APIۦಈ։ൃ • ࠶ར༻ੑ •

    ύϑΥʔϚϯε • ޙํޓ׵ RESTful clean architecture API driven development Reusability Performance NO BC break