Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
© - BASE, Inc. Building API server-side architecture for Beginners GopherCon . . - @hgsgtk
Slide 2
Slide 2 text
© - BASE, Inc. Talk abstract • A practical approach to build server-side architecture in a Go project • Especially for teams who do not have Go experience in business
Slide 3
Slide 3 text
© - BASE, Inc. Kazuki Higashiguchi / Backend engineer in Japan! About me @hgsgtk BASE BANK, Inc. / Dev Division / Tech lead
Slide 4
Slide 4 text
© - BASE, Inc. Problem of building architecture for beginners Approach to build architecture Summary Talk structure
Slide 5
Slide 5 text
© - BASE, Inc. Problem of building architecture for beginners Approach to build architecture Summary Talk structure
Slide 6
Slide 6 text
© - BASE, Inc. Why I need server-side architecture .Keep a design easy to change • -> Separate external input/output and business logic .Reach common understanding of implementation policies in a team • -> To make readable and maintainable code
Slide 7
Slide 7 text
© - BASE, Inc. • No absolute answer for any projects • We should determine a suitable architecture for the project Reality of building architecture
Slide 8
Slide 8 text
© - BASE, Inc. • We should consider various things • Service requirements • Team member ability • Service scale • etc To determine a suitable architecture
Slide 9
Slide 9 text
© - BASE, Inc. Problem of building architecture for beginners • We should consider various things • Service requirements • Team member ability • Service scale • etc For beginners, “Team member ability” is a factor that can not be ignored
Slide 10
Slide 10 text
© - BASE, Inc. Go beginners have a lot of questions How to implement API server by net/http package How to write an unit test How to use interface type - Go basic questions -
Slide 11
Slide 11 text
© - BASE, Inc. If we determine complicated architecture from the beginning How to implement API server by net/http package How to write an unit test - Go basic questions - ex. “Adopt clean architecture!” How to use interface type
Slide 12
Slide 12 text
© - BASE, Inc. How to implement API server by net/http package How to write an unit test - Go basic questions - ex. “Adopt clean architecture!” - Architecture questions - What’s clean architecture? How to apply Dependency Inversion Principle in Go? What should we write in use case layer? How to use interface type If we determine complicated architecture from the beginning
Slide 13
Slide 13 text
© - BASE, Inc. How to implement API server by net/http package How to write an unit testing - Go basic questions - ex. “Adopt clean architecture!” - Architecture questions - What’s clean architecture? How to apply Dependency Inversion Principle in Go? What should we write in use case layer? How to use interface type If we determine complicated architecture from beginning There are many questions in team members’ mind
Slide 14
Slide 14 text
© - BASE, Inc. If we determine complicated architecture from beginning How to implement API server by net/http package How to write unit testing How to use interface type - Go Basic Questions - ex. “Adopt Clean Architecture!” - Architecture Questions - What’s clean architecture? How to apply Dependency Inversion Principle in Go? What we should write in use case layer? When it gets worst, Confusing
Slide 15
Slide 15 text
© - BASE, Inc. Why I need server-side architecture .Keep a design easy to change • -> Separate external input/output and business logic .Common understanding of implementation policies in a team • -> To make readable and maintainable code We are not able to achieve “common understanding”
Slide 16
Slide 16 text
© - BASE, Inc. Problem of building architecture for beginners Approach to build architecture Summary Talk structure
Slide 17
Slide 17 text
© - BASE, Inc. Approach to build architecture Architectural complexity Go Skills/Knowledge
Slide 18
Slide 18 text
© - BASE, Inc. Approach to build architecture Architectural complexity the final architecture . Define “the final architecture” that seems to be good for the project Go Skills/Knowledge
Slide 19
Slide 19 text
© - BASE, Inc. Approach to build architecture Architectural complexity the final architecture . Set intermediate goals to “the final architecture” Go Skills/Knowledge
Slide 20
Slide 20 text
© - BASE, Inc. Example of my team • The team have few Go experience in business • The Team has backend engineers • usually use PHP in work
Slide 21
Slide 21 text
© - BASE, Inc. Example of my team Architectural complexity Layered Architecture + DIP Simple Model-Controller Model-Controller + DIP . . Go Skills/Knowledge
Slide 22
Slide 22 text
© - BASE, Inc. Architectural complexity Layered Architecture + DIP Simple Model-Controller Model-Controller + DIP . . Go Skills/Knowledge . Define Layered Architecture + DIP as “the final architecture” Example of my team
Slide 23
Slide 23 text
© - BASE, Inc. Layered Architecture + DIP • Refer to Layered Architecture • Apply DIP (Dependency Inversion Principle) to isolate domain logic from infrastructure implementations(ex. database handling)
Slide 24
Slide 24 text
© - BASE, Inc. Architectural complexity Layered Architecture + DIP Simple Model-Controller Model-Controller + DIP . . Go Skills/Knowledge . Set intermediate goals Example of my team
Slide 25
Slide 25 text
© - BASE, Inc. st goal: Simple Model-Controller • Simple design only with controller and model • Model includes implementations such as handling a database • To get used to Go API development
Slide 26
Slide 26 text
© - BASE, Inc. At st goal, team will acquire How to implement API server by net/http package How to write an unit test How to use interface type - Go Basic Questions - Got it!
Slide 27
Slide 27 text
© - BASE, Inc. At st goal, team will acquire How to implement API server by net/http package How to write an unit test How to use interface type - Go Basic Questions - Got it! Acquire Go Basic from simple design code
Slide 28
Slide 28 text
© - BASE, Inc. nd goal: Model-Controller + DIP • Separate infrastructure implementations from model • Prepare repository package and move database handling implementation to datastore package. (apply DIP) • Get used to how to use interface in Go
Slide 29
Slide 29 text
© - BASE, Inc. - Go Basic Questions - Final goal: “Layered Architecture + DIP” - Architecture Questions - What’s layered architecture? How to apply Dependency Inversion Principle in Go? What should we write in application layer? How to use interface type At nd goal, team will acquire How to implement API server by net/http package How to write an unit test Got it!
Slide 30
Slide 30 text
© - BASE, Inc. Got it! - Go Basic Questions - Final goal: “Layered Architecture + DIP” - Architecture Questions - What’s layered architecture? How to apply Dependency Inversion Principle in Go? What should we write in application layer? How to use interface type At nd goal, team will acquire How to implement API server by net/http package How to write an unit test Acquire Basic of Go and Archictecture from more complicated design
Slide 31
Slide 31 text
© - BASE, Inc. Final goal: Layered Architecture + DIP • Introduce service package corresponding to “service application layer” in DDD as processing becomes more complicated
Slide 32
Slide 32 text
© - BASE, Inc. - Go Basic Questions - Final goal: “Layered Architecture + DIP” - Architecture Questions - What’s layered architecture? How to apply Dependency Inversion Principle in Go? What should we write in application layer? How to use interface type At final goal, team will reach How to implement API server by net/http package How to write an unit test Got it!
Slide 33
Slide 33 text
© - BASE, Inc. - Go Basic Questions - Final goal: “Layered Architecture + DIP” - Architecture Questions - What’s layered architecture? How to apply Dependency Inversion Principle in Go? What should we write in application layer? How to use interface type At final goal, team will reach How to implement API server by net/http package How to write an unit test Got it! Reach common understanding of implementation policies
Slide 34
Slide 34 text
© - BASE, Inc. Go Skills/Knowledge Architectural complexity Layered Architecture + DIP Simple Model-Controller Model-Controller + DIP . . Approach to build architecture To acquire Go skills and knowledge rapidly
Slide 35
Slide 35 text
© - BASE, Inc. To acquire Go skills and knowledge rapidly .Use standard package as much as possible • To learn Go language itself • ex. use net/http package to serve HTTP .Write a test • To get feedback on the code design (such as testability) • For quick refactoring
Slide 36
Slide 36 text
© - BASE, Inc. Problem of building architecture for beginners Approach to build architecture Summary Talk structure
Slide 37
Slide 37 text
© - BASE, Inc. Summary • In my approach, an architecture grew with team members’ ability growth • Set a final goal and intermediate goals • To grow rapidly, use standard package as much as possible and write a test
Slide 38
Slide 38 text
© - BASE, Inc. Feel free to ask me any Q GopherCon . . - @hgsgtk