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

Let's start your first OSS with CakePHP

itosho
November 10, 2019

Let's start your first OSS with CakePHP

On CakeFest 2019 Tokyo, Japan / By Sho ITO, Connehito Inc

itosho

November 10, 2019
Tweet

More Decks by itosho

Other Decks in Programming

Transcript

  1. Let's start your first OSS with CakePHP
    by itosho / Connehito Inc.
    CakeFest 2019 Tokyo, Japan

    View full-size slide

  2. Hello, everyone!

    View full-size slide

  3. About Me
    Sho ITO @itosho
    - Backend Engineer, CakePHP Contributor
    - Like Baseball⚾, Basketball
    - CTO, Connehito Inc.
    - From the beginning, we used CakePHP in all backend systems

    View full-size slide

  4. About Our Company

    View full-size slide

  5. Creating services that people cannot live without
    Connehito uses the power of technology to provide
    support to mothers in their daily decision makings about family matter

    View full-size slide

  6. Brand that supports mothers' each step
    Business Lineup

    View full-size slide

  7. No.1 app for mothers in Japan!
    One third of mothers in Japan are using mamari
    Communication amongst users about their worries and experiences about
    childbearing and childcare
    Q&A Community App
    Delivery of useful articles about childbearing and childcare. Many articles
    are supervised by experts
    Web Media
    A subscription service provides more useful functions
    e.g. premium articles, shopping coupons, premium search functions
    Mamari Premium

    View full-size slide

  8. Have you ever wanted to create OSS?

    View full-size slide

  9. But, it's hard to take action, isn't it?

    View full-size slide

  10. Let’s take the first step TODAY!

    View full-size slide

  11. Today’s Topics
    1. Let’s create OSS!
    2. Make it better!
    3. Accelerate your OSS activity!

    View full-size slide

  12. 1. Let’s create OSS!

    View full-size slide

  13. About Easy Query
    - Behavior Plugin for CakePHP
    - https://github.com/itosho/easy-query
    - Easily some complicated queries
    - e.g. upsert, bulk upsert bulk insert, and insert once(insert select query)
    - Requirements: PHP 7.0+, CakePHP 3.5+, MySQL 5.6+
    - Looking for someone to support PostgreSQL !

    View full-size slide

  14. Step1. Prepare an OSS

    View full-size slide

  15. Create a Repository
    - Well begun is half done.
    - If you don’t mind
    - on GitHub
    - MIT Licence
    - Naming is important
    - Googleability
    - cake prefix

    View full-size slide

  16. The name and meta infomartion
    Lists packages required
    Autoload mapping

    View full-size slide

  17. Step2. Write codes

    View full-size slide

  18. The most fun process
    - Describe only bulkInsert()
    - Please check the repository for details

    View full-size slide

  19. Decomposed the Entity array data into fields and data
    Query builder realizes processing of the bulk inser

    View full-size slide

  20. Step3. Write test codes

    View full-size slide

  21. Test codes are necessary for OSS
    - We can release OSS without test codes
    - But, OSS without test codes is not reliable for developers
    - TDD is a good choice

    View full-size slide

  22. Assert
    Arrange
    Act

    View full-size slide

  23. Step4. Setup CI

    View full-size slide

  24. Finished writing code, not done yet
    - Travis CI is a best tool for OSS
    - Static code analysis and lint tool improve quality of OSS
    - Static code analysis: PHPStan
    - Lint tool: CakePHP Code Sniffer

    View full-size slide

  25. Step5. Clean up the document

    View full-size slide

  26. README is like a entrance
    - README is very important
    - Requirements
    - Installation
    - Usage
    - It’s kind to have badges
    - https://poser.pugx.org/

    View full-size slide

  27. 2. Make it better

    View full-size slide

  28. I might as well
    - Making it useful for many people
    - not only for self-satisfaction
    - I researched some popular OSS
    - found some common points

    View full-size slide

  29. Good OSS has “3Cs”
    1. Convenience
    2. Clarity
    3. Continuity

    View full-size slide

  30. Convenience
    - Big benefits required
    - The effort to solve a problem is often more bother than the pain that causes it...
    - Case: Easy Query
    - High performance of bulkInsert()
    - A CakePHP standard method, saveMany() doesn't have it
    - Inspection: insert 100 records to a tags table
    - saveMany() 2.93 sec
    - bulkInsert() 2.01 sec
    - Enviorment: CentOS6, MySQL5.6, CPU 2core, Memory 2GB (Docker for Mac)

    View full-size slide

  31. Clarity
    - Anyway can use it quickly
    - mature documentation
    - “When in Rome, do as the Romans do”
    - intuitive and simplie
    - Case: Easy Query
    - bulkInsert() has same interface with saveMany()

    View full-size slide

  32. Continuity
    - GitHub’s star is not all!
    - The change is drastic
    - Even a popular OSS is not remembered half a year later
    - It is also important to improve continuously
    - Case: Easy Query
    - I updated it last week
    - I declare today that I will upgrade Easy Query to CakePHP4 within half a year!

    View full-size slide

  33. 3. Accelerate your OSS activity!

    View full-size slide

  34. Next Step
    - OSS activity is fun and good!
    - But, it is difficult to continue...

    View full-size slide

  35. - Connehito has a company program for encouraging OSS activities
    - Smile Program!
    - To put it simply, it is an output support program
    - It started half a year ago
    Smile Program

    View full-size slide

  36. What is a smile program?
    - Save up miles when our members contribute to the outside community
    - Members can then spend miles
    Engineer A
    Miles bank
    Engineer B
    Save Up! (by Output)
    - OSS Contribution
    - Presenting and Writing
    Spend! (for Input)
    - Getting certified
    - Attend Oversea Conferences

    View full-size slide

  37. Concept
    - Money is not the motivation
    - When in need of support, a member can get it
    - Evaluating the value of output and input

    View full-size slide

  38. Let me show you how it actually works

    View full-size slide

  39. Smile Counter
    - CMS for Smile Program
    - Featutes
    - Request for output and input
    - Review for output and input
    - Mile management
    - Member management
    - Member Rankings
    - Made with CakePHP4!

    View full-size slide

  40. Why did we start Smile Program?

    View full-size slide

  41. We are raised by the engineer's community
    Engineer’s
    Community
    Connehito Inc
    Grow!
    - Using many OSS like CakePHP
    - Referring to other company’s case study

    View full-size slide

  42. Simply, I want to give back to it.

    View full-size slide

  43. Ecosystem
    Community
    Connehito
    Grow
    Take
    - Many OSS
    - Case Study
    - Conference
    Community
    Connehito
    Grow
    Take
    - Many OSS
    - Case Study
    - Conference
    Give
    - Contribution
    - Case Study
    - Sponsor

    View full-size slide

  44. Win-Win Relationship!

    View full-size slide

  45. Summary
    - If you have the will, you can create OSS now
    - Keep in mind the "3Cs" when creating OSS
    - “3Cs” are Convenience, Clarity and Continuity
    - Connehito will continue to use CakePHP
    - And we aim to be an indispensable company for CakePHP community!

    View full-size slide