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

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

Taka
May 24, 2016

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

Tech Talk Tokyo #2 May 24th, 2016.
https://techtalktokyo.doorkeeper.jp/events/44690

Taka

May 24, 2016
Tweet

More Decks by Taka

Other Decks in Programming

Transcript

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

    web service Tech Talk Tokyo #2 May 24th, 2016. @necojackarc
  2. 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”
  3. 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
  4. 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.
  5. 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.
  6. 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
  7. 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 :)
  8. 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.
  9. “ You may be thinking: “But Rails makes it really

    hard to do OOP right!” from “7 Patterns to Refactor Fat ActiveRecord Models”
  10. • Decorators • Errors • Forms • Lib • Observers

    • Parameters • Serializers • Services • Uploaders Components I actually added
  11. 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.
  12. 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