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

Two things I found effective when starting up a new web service

084b3ff6e62235ac7842b2ba2fe3fbf2?s=47 Taka
May 24, 2016

Two things I found effective when starting up a new web service

Tech Talk Tokyo #2 May 24th, 2016.



May 24, 2016


  1. Two things I found effective when starting up a new

    web service Tech Talk Tokyo #2 May 24th, 2016. @necojackarc
  2. Taka Software Engineer Twitter: @necojackarc GitHub: necojackarc Blog (JP): http://necojackarc.hatenablog.com/

    Blog (EN): http://necojackarc.hateblo.jp/
  3. Outline ◦ Introducing a new web service by PIXTA ◦

    Sharing two effective methods which make systems more extensible: • Immutable Data Model with additional restrictions • Adding extra components to MVC frameworks, especially “Ruby on Rails”
  4. 1. Introducing a new web service The name is “fotowa”.

    URL: https://fotowa.com/
  5. About “fotowa” III. photo shoot & online delivery II. request

    IV. reward I. registration Matching service between those who want to have their photos taken and photographers
  6. Development of “fotowa” ◦ We released the first version on

    February 29th, 2016. ◦ It took one and a half months. ◦ I needed to take care of a lot of changes because the requirements weren't fixed. ◦ I found some methods which were effective to deal with frequent changes.
  7. 2. Extended Immutable Data Model

  8. What is Immutable Data Model? ◦ One of the styles

    of data modeling ◦ In a word, forbidding updating database • Practically, it’s almost impossible to make an application without updating any data. • So, it’s okay to just try and exclude as much update as possible.
  9. Benefits of Immutable Data Model ◦ Keeping your data model

    simple • Updating usually causes complexity. ◦ Making your design open to change • You can easily extend and modify the design. ◦ Making your database robust
  10. Let’s apply additional restrictions!

  11. Additional restrictions They improve your database much more! ◦ Never

    updating records (already adopted) ◦ Never deleting records ◦ No null columns ◦ No deleted flags The more restrictions you apply, the more improvements you (might be able to) get :)
  12. 3. Adding extra components to Rails

  13. Brief introduction of Ruby on Rails ◦ It’s a MVC

    framework. • It originally has three components that are models, controllers and views. ◦ Developers often suffer from “fat stuff”. • Since Rails has only three components, developers tend to put “all business logic” on controllers or models. It causes fat models or fat controllers.
  14. “ You may be thinking: “But Rails makes it really

    hard to do OOP right!” from “7 Patterns to Refactor Fat ActiveRecord Models”
  15. It’s not true. Adding extras solves these problems.

  16. • Decorators • Errors • Forms • Lib • Observers

    • Parameters • Serializers • Services • Uploaders Components I actually added
  17. It enables you to apply Single Responsibility Principle.

  18. Conclusion ◦ Extended Immutable Data Model makes your database open

    to change. ◦ Adding extra components enables you to follow Single Responsibility Principle which makes your application open to change.
  19. Changes are inevitable  Let’s prepare for changes!

  20. References ◦ イミュータブルデータモデル(入門編) • http://www.slideshare.net/kawasima/ss-40471672 ◦ SIerにおけるDBAのしごと • http://qiita.com/kawasima/items/7eafd8406866f9d6e91b ◦

    7 Patterns to Refactor Fat ActiveRecord Models • http://blog.codeclimate.com/blog/2012/10/17/7-ways-to-decomp ose-fat-activerecord-models/ ◦ 肥大化したActiveRecordモデルをリファクタリングする7つの方法(翻訳) • http://techracho.bpsinc.jp/hachi8833/2013_11_19/14738
  21. THANKS!