SlideShare a Scribd company logo
Why use Go for Web
development?
Weng Wei, July 2014
About Go
–Rob Pike
“Go is a programming language designed by Google to help solve
Google's (big)problems. ”
–Derek Collison
“ Go will become the dominant language for systems work in IaaS,
Orchestration, and PaaS in 24 months.”
Go looks cool!
but, it is suitable for simple web development?
Web? Use MVC!
• Quite a number of Go MVC web framework exist:
• Beego / Martini / Revel….
• Different approach for MC layers
• V layer are mostly the same: Go HTML Template http://golang.org/
pkg/html/template/
@yinwang0:Go HTML Template
• “Basically usable” template engine
• Surprisingly, logic control code in template are not Go itself
• Poor expressiveness
• Need to bind all template data into a single model
• Helper func need to be “registerd”
• Quite messy & tedious
–Wang Yin
“It’s better to build website with more mature frameworks from
other language”
Template engine must be good
for web development!
– Wikipedia
“PHP(PHP: Hypertext Preprocessor)…server-side scripting
language designed for web development.. PHP code can be
simply mixed with HTML code..”
Mix html with Go?
• “Not possible, Go doesn’t have interpreter”
• “Go is NOT script”
I think otherwise
• Go is turing complete
• No things Go can’t go
• Only thing more complicated to do with Go
• Embedding static compile language in HTML are possible:
• ASP.Net
Why use Go for web development?
Razor
• Default template/view engine for ASP.NET MVC
• Support embedding c# / vb.net in HTML
• .Net developers love it (including me):
• http://www.zhihu.com/question/19973649 (Chinese link)
How complicated to create
GoRazor?
GoRazor
• http://github.com/sipin/gorazor
• PoC in one night
• Continuous team improvement:214 commits
• Proven with internal large web project
Why use Go for web development?
• Mature template engine; sublime plug-ins for syntax highlight + auto
complete
• Able use Go directly in template; no different syntax for flow control
• Powerful expressiveness
• Rendering template is calling function; models are function
parameters
• No need to register helper func, directly import in template
• Very concise & convinient
Demo
• If you think Go is not suitable for web development because of poor
template engine
• Please try https://github.com/sipin/gorazor
Of cause, template engine is
only the start
Is Go suitable for dynamic web
development?
Dynamic
• web is built around string
• Go is static compiled; can it:
• Obtain object properties via string?
• Invoke package/object methods via string?
• Create object via string?
Reflection
• Reflection could meet most of the requirements
• Check Martini
Issues with Go’s reflection
• Let’s put performance aside
• Tedious & complicated
• Move compilation error to runtime error: no complier check
Reflection is not the only way
Code generation approach
For example
• Bind HTTP Post form values to object
Why use Go for web development?
Why use Go for web development?
Why use Go for web development?
Why use Go for web development?
• Generate all these methods:
• NewXXXObjByID(namespace, classname, id string)
• ReadForm(params map[string]string)

• So, 600k LoC





• Code generation makes static compiled language feels “dynamic”
• Go can do this, so does all other languages
• But, how about the compilation speed?
Full Compliation
Incremental compilation after editing template
• Go’s compilation speed is amazing!
• This is a project with 600k LoC on Mid 2011 Macbook Air
• We could keep cmd + s / cmd + tab / cmd + R development pace
Back to dynamic
• If complication is slow, then code-gen approach hurts produtivity
• Go compile extreme fast
• Go has unique point for dynamic
– Rob Pike
“interfaces.. the true Go philosophy…”
Go’s interface
• Define class/method first
• May define interface later
• Interface query at run-time
Example
• Check if object has “GetUserID” method
• If so, check if current user
• If so, allow edit
Why use Go for web development?
More example
• Check if object has “IsDistributed”、“GetPersistentNode” methods
• If so, replicate object to other nodes
Why use Go for web development?
Combine the examples
Why use Go for web development?
Why use Go for web development?
• Go allow querying original object’s interface
• Switch between different interfaces at runtime
• Interface could be defined in new packages
• No need to put all interface combinations for different purpose at
one place
However, why reinventing the
web MVC wheel?
But!
• Simple web pages? Pick whatever you like
• Of cause including Go
• Middle size web application, like a forum?
• php / Rails / Django / asp.net are more mature
• Go also can, if you like re-inventing the wheel
• How about large website?
Needs for large website
• Stability rules
• Scalability & Distributed are important
• SOA architecture
• Performance are critical
• Maintainable code (With GoRazor; even the templates are strong-
typed & compiler checked)
• Quick prototyping, and switch technology/platform?
• Works, but these are technical debt!
• If we could owe less debt since the beginning, why not?
Go is suitable to development
large website!
Finally, I would like to talk about
Go & startup
Q & A
Reference
• https://talks.golang.org/2012/splash.slide
• http://open.qiniudn.com/go-next-c-pptx.pdf
• http://www.csdn.net/article/2012-09-14/2809984-will-go-be-the-new-go-to-
programming-lan
• http://weibo.com/1889019865/B4nx3z6GF
• http://www.yinwang.org/blog-cn/2014/04/18/golang/
• http://zh.wikipedia.org/wiki/PHP
• http://www.ituring.com.cn/article/1339
Ad

More Related Content

What's hot (20)

Saving Time By Testing With Jest
Saving Time By Testing With JestSaving Time By Testing With Jest
Saving Time By Testing With Jest
Ben McCormick
 
Automating JavaScript testing with Jasmine and Perl
Automating JavaScript testing with Jasmine and PerlAutomating JavaScript testing with Jasmine and Perl
Automating JavaScript testing with Jasmine and Perl
nohuhu
 
Next generation frontend tooling
Next generation frontend toolingNext generation frontend tooling
Next generation frontend tooling
pksjce
 
ITT Flisol 2013
ITT Flisol 2013ITT Flisol 2013
ITT Flisol 2013
Domingo Suarez Torres
 
Untangling - fall2017 - week5
Untangling - fall2017 - week5Untangling - fall2017 - week5
Untangling - fall2017 - week5
Derek Jacoby
 
Untangling - fall2017 - week6
Untangling - fall2017 - week6Untangling - fall2017 - week6
Untangling - fall2017 - week6
Derek Jacoby
 
Developing Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScriptDeveloping Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScript
nohuhu
 
Proxying DBI with DBD::Gofer and App::Staticperl
Proxying DBI with DBD::Gofer and App::StaticperlProxying DBI with DBD::Gofer and App::Staticperl
Proxying DBI with DBD::Gofer and App::Staticperl
nohuhu
 
Less\sass done right in .NET
Less\sass done right in .NETLess\sass done right in .NET
Less\sass done right in .NET
PawelPabich
 
JavaScript Build System Battle Royale | PrDC 2017
JavaScript Build System Battle Royale | PrDC 2017JavaScript Build System Battle Royale | PrDC 2017
JavaScript Build System Battle Royale | PrDC 2017
David Wesst
 
JSFoo-2017 Takeaways
JSFoo-2017 TakeawaysJSFoo-2017 Takeaways
JSFoo-2017 Takeaways
Mir Ali
 
Functional Programming in PHP
Functional Programming in PHPFunctional Programming in PHP
Functional Programming in PHP
Aurimas Niekis
 
Riak at Posterous
Riak at PosterousRiak at Posterous
Riak at Posterous
capotej
 
Modern javascript
Modern javascriptModern javascript
Modern javascript
Kevin Ball
 
javerosmx-2015-marzo-groovy-java8-comparison
javerosmx-2015-marzo-groovy-java8-comparisonjaverosmx-2015-marzo-groovy-java8-comparison
javerosmx-2015-marzo-groovy-java8-comparison
Domingo Suarez Torres
 
The Dark Side of Single Page Applications
The Dark Side of Single Page ApplicationsThe Dark Side of Single Page Applications
The Dark Side of Single Page Applications
Dor Kalev
 
Journey To The Front End World - Part3 - The Machine
Journey To The Front End World - Part3 - The MachineJourney To The Front End World - Part3 - The Machine
Journey To The Front End World - Part3 - The Machine
Irfan Maulana
 
Conquering AngularJS Limitations
Conquering AngularJS LimitationsConquering AngularJS Limitations
Conquering AngularJS Limitations
Valeri Karpov
 
SGCE 2015 REST APIs
SGCE 2015 REST APIsSGCE 2015 REST APIs
SGCE 2015 REST APIs
Domingo Suarez Torres
 
ASP.NET Core - Phillosophies, Processes and Tooling
ASP.NET Core - Phillosophies, Processes and ToolingASP.NET Core - Phillosophies, Processes and Tooling
ASP.NET Core - Phillosophies, Processes and Tooling
💻 Spencer Schneidenbach
 
Saving Time By Testing With Jest
Saving Time By Testing With JestSaving Time By Testing With Jest
Saving Time By Testing With Jest
Ben McCormick
 
Automating JavaScript testing with Jasmine and Perl
Automating JavaScript testing with Jasmine and PerlAutomating JavaScript testing with Jasmine and Perl
Automating JavaScript testing with Jasmine and Perl
nohuhu
 
Next generation frontend tooling
Next generation frontend toolingNext generation frontend tooling
Next generation frontend tooling
pksjce
 
Untangling - fall2017 - week5
Untangling - fall2017 - week5Untangling - fall2017 - week5
Untangling - fall2017 - week5
Derek Jacoby
 
Untangling - fall2017 - week6
Untangling - fall2017 - week6Untangling - fall2017 - week6
Untangling - fall2017 - week6
Derek Jacoby
 
Developing Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScriptDeveloping Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScript
nohuhu
 
Proxying DBI with DBD::Gofer and App::Staticperl
Proxying DBI with DBD::Gofer and App::StaticperlProxying DBI with DBD::Gofer and App::Staticperl
Proxying DBI with DBD::Gofer and App::Staticperl
nohuhu
 
Less\sass done right in .NET
Less\sass done right in .NETLess\sass done right in .NET
Less\sass done right in .NET
PawelPabich
 
JavaScript Build System Battle Royale | PrDC 2017
JavaScript Build System Battle Royale | PrDC 2017JavaScript Build System Battle Royale | PrDC 2017
JavaScript Build System Battle Royale | PrDC 2017
David Wesst
 
JSFoo-2017 Takeaways
JSFoo-2017 TakeawaysJSFoo-2017 Takeaways
JSFoo-2017 Takeaways
Mir Ali
 
Functional Programming in PHP
Functional Programming in PHPFunctional Programming in PHP
Functional Programming in PHP
Aurimas Niekis
 
Riak at Posterous
Riak at PosterousRiak at Posterous
Riak at Posterous
capotej
 
Modern javascript
Modern javascriptModern javascript
Modern javascript
Kevin Ball
 
javerosmx-2015-marzo-groovy-java8-comparison
javerosmx-2015-marzo-groovy-java8-comparisonjaverosmx-2015-marzo-groovy-java8-comparison
javerosmx-2015-marzo-groovy-java8-comparison
Domingo Suarez Torres
 
The Dark Side of Single Page Applications
The Dark Side of Single Page ApplicationsThe Dark Side of Single Page Applications
The Dark Side of Single Page Applications
Dor Kalev
 
Journey To The Front End World - Part3 - The Machine
Journey To The Front End World - Part3 - The MachineJourney To The Front End World - Part3 - The Machine
Journey To The Front End World - Part3 - The Machine
Irfan Maulana
 
Conquering AngularJS Limitations
Conquering AngularJS LimitationsConquering AngularJS Limitations
Conquering AngularJS Limitations
Valeri Karpov
 
ASP.NET Core - Phillosophies, Processes and Tooling
ASP.NET Core - Phillosophies, Processes and ToolingASP.NET Core - Phillosophies, Processes and Tooling
ASP.NET Core - Phillosophies, Processes and Tooling
💻 Spencer Schneidenbach
 

Similar to Why use Go for web development? (20)

Progressive Enhancement using WSGI
Progressive Enhancement using WSGIProgressive Enhancement using WSGI
Progressive Enhancement using WSGI
Matthew Wilkes
 
Test Automation with Twist and Sahi
Test Automation with Twist and SahiTest Automation with Twist and Sahi
Test Automation with Twist and Sahi
ericjamesblackburn
 
Automated Acceptance Testing from Scratch
Automated Acceptance Testing from ScratchAutomated Acceptance Testing from Scratch
Automated Acceptance Testing from Scratch
Excella
 
Prototyping like it is 2022
Prototyping like it is 2022 Prototyping like it is 2022
Prototyping like it is 2022
Michael Yagudaev
 
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Conference
 
Managing changes to eZPublish Database
Managing changes to eZPublish DatabaseManaging changes to eZPublish Database
Managing changes to eZPublish Database
Gaetano Giunta
 
Managing Changes to the Database Across the Project Life Cycle (presented by ...
Managing Changes to the Database Across the Project Life Cycle (presented by ...Managing Changes to the Database Across the Project Life Cycle (presented by ...
Managing Changes to the Database Across the Project Life Cycle (presented by ...
eZ Systems
 
WTF: Where To Focus when you take over a Drupal project
WTF: Where To Focus when you take over a Drupal projectWTF: Where To Focus when you take over a Drupal project
WTF: Where To Focus when you take over a Drupal project
Symetris
 
Developing Complex WordPress Sites without Fear of Failure (with MVC)
Developing Complex WordPress Sites without Fear of Failure (with MVC)Developing Complex WordPress Sites without Fear of Failure (with MVC)
Developing Complex WordPress Sites without Fear of Failure (with MVC)
Mike Schinkel
 
Devconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedDevconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developed
Alexander Makarov
 
WebDev Crash Course
WebDev Crash CourseWebDev Crash Course
WebDev Crash Course
Cesar Martinez
 
How Not to Be Conned by Your Drupal Vendor!
How Not to Be Conned by Your Drupal Vendor!How Not to Be Conned by Your Drupal Vendor!
How Not to Be Conned by Your Drupal Vendor!
pixelonion
 
Frontend as a first class citizen
Frontend as a first class citizenFrontend as a first class citizen
Frontend as a first class citizen
Marcin Grzywaczewski
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPA
Gil Fink
 
Getting started with dev tools (atl)
Getting started with dev tools (atl)Getting started with dev tools (atl)
Getting started with dev tools (atl)
Thinkful
 
Continuous Integration In A PHP World
Continuous Integration In A PHP WorldContinuous Integration In A PHP World
Continuous Integration In A PHP World
Idaf_1er
 
27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...
27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...
27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...
Tieturi Oy
 
Drupal 8 deeper dive
Drupal 8 deeper diveDrupal 8 deeper dive
Drupal 8 deeper dive
Amazee Labs
 
Docs Like Code: Strategies and Stories
Docs Like Code: Strategies and StoriesDocs Like Code: Strategies and Stories
Docs Like Code: Strategies and Stories
Anne Gentle
 
Building mobile apps with PhoneGap and Backbone
Building mobile apps with PhoneGap and BackboneBuilding mobile apps with PhoneGap and Backbone
Building mobile apps with PhoneGap and Backbone
Troy Miles
 
Progressive Enhancement using WSGI
Progressive Enhancement using WSGIProgressive Enhancement using WSGI
Progressive Enhancement using WSGI
Matthew Wilkes
 
Test Automation with Twist and Sahi
Test Automation with Twist and SahiTest Automation with Twist and Sahi
Test Automation with Twist and Sahi
ericjamesblackburn
 
Automated Acceptance Testing from Scratch
Automated Acceptance Testing from ScratchAutomated Acceptance Testing from Scratch
Automated Acceptance Testing from Scratch
Excella
 
Prototyping like it is 2022
Prototyping like it is 2022 Prototyping like it is 2022
Prototyping like it is 2022
Michael Yagudaev
 
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Remote: JS - Javascript Build Tools: Past & Beyond - Shedrack Akintayo
Shift Conference
 
Managing changes to eZPublish Database
Managing changes to eZPublish DatabaseManaging changes to eZPublish Database
Managing changes to eZPublish Database
Gaetano Giunta
 
Managing Changes to the Database Across the Project Life Cycle (presented by ...
Managing Changes to the Database Across the Project Life Cycle (presented by ...Managing Changes to the Database Across the Project Life Cycle (presented by ...
Managing Changes to the Database Across the Project Life Cycle (presented by ...
eZ Systems
 
WTF: Where To Focus when you take over a Drupal project
WTF: Where To Focus when you take over a Drupal projectWTF: Where To Focus when you take over a Drupal project
WTF: Where To Focus when you take over a Drupal project
Symetris
 
Developing Complex WordPress Sites without Fear of Failure (with MVC)
Developing Complex WordPress Sites without Fear of Failure (with MVC)Developing Complex WordPress Sites without Fear of Failure (with MVC)
Developing Complex WordPress Sites without Fear of Failure (with MVC)
Mike Schinkel
 
Devconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developedDevconf 2011 - PHP - How Yii framework is developed
Devconf 2011 - PHP - How Yii framework is developed
Alexander Makarov
 
How Not to Be Conned by Your Drupal Vendor!
How Not to Be Conned by Your Drupal Vendor!How Not to Be Conned by Your Drupal Vendor!
How Not to Be Conned by Your Drupal Vendor!
pixelonion
 
The Characteristics of a Successful SPA
The Characteristics of a Successful SPAThe Characteristics of a Successful SPA
The Characteristics of a Successful SPA
Gil Fink
 
Getting started with dev tools (atl)
Getting started with dev tools (atl)Getting started with dev tools (atl)
Getting started with dev tools (atl)
Thinkful
 
Continuous Integration In A PHP World
Continuous Integration In A PHP WorldContinuous Integration In A PHP World
Continuous Integration In A PHP World
Idaf_1er
 
27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...
27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...
27.1.2014, Tampere. Perinteinen mobiilimaailma murroksessa. Petri Niemi: Sing...
Tieturi Oy
 
Drupal 8 deeper dive
Drupal 8 deeper diveDrupal 8 deeper dive
Drupal 8 deeper dive
Amazee Labs
 
Docs Like Code: Strategies and Stories
Docs Like Code: Strategies and StoriesDocs Like Code: Strategies and Stories
Docs Like Code: Strategies and Stories
Anne Gentle
 
Building mobile apps with PhoneGap and Backbone
Building mobile apps with PhoneGap and BackboneBuilding mobile apps with PhoneGap and Backbone
Building mobile apps with PhoneGap and Backbone
Troy Miles
 
Ad

More from Weng Wei (12)

Fastest golang ORM implemented with generic
Fastest golang ORM implemented with genericFastest golang ORM implemented with generic
Fastest golang ORM implemented with generic
Weng Wei
 
About Caching
About CachingAbout Caching
About Caching
Weng Wei
 
谈谈缓存
谈谈缓存谈谈缓存
谈谈缓存
Weng Wei
 
用PY实现"Go元编程"
用PY实现"Go元编程"用PY实现"Go元编程"
用PY实现"Go元编程"
Weng Wei
 
Go for web
Go for webGo for web
Go for web
Weng Wei
 
Go for web
Go for webGo for web
Go for web
Weng Wei
 
论使用Python开发推荐引擎的优越性
论使用Python开发推荐引擎的优越性论使用Python开发推荐引擎的优越性
论使用Python开发推荐引擎的优越性
Weng Wei
 
Zalora php to_go
Zalora php to_goZalora php to_go
Zalora php to_go
Weng Wei
 
A byte of git
A byte of gitA byte of git
A byte of git
Weng Wei
 
My understanding of Git
My understanding of GitMy understanding of Git
My understanding of Git
Weng Wei
 
Sharding
ShardingSharding
Sharding
Weng Wei
 
Inside Zend Framework
Inside Zend FrameworkInside Zend Framework
Inside Zend Framework
Weng Wei
 
Fastest golang ORM implemented with generic
Fastest golang ORM implemented with genericFastest golang ORM implemented with generic
Fastest golang ORM implemented with generic
Weng Wei
 
About Caching
About CachingAbout Caching
About Caching
Weng Wei
 
谈谈缓存
谈谈缓存谈谈缓存
谈谈缓存
Weng Wei
 
用PY实现"Go元编程"
用PY实现"Go元编程"用PY实现"Go元编程"
用PY实现"Go元编程"
Weng Wei
 
Go for web
Go for webGo for web
Go for web
Weng Wei
 
Go for web
Go for webGo for web
Go for web
Weng Wei
 
论使用Python开发推荐引擎的优越性
论使用Python开发推荐引擎的优越性论使用Python开发推荐引擎的优越性
论使用Python开发推荐引擎的优越性
Weng Wei
 
Zalora php to_go
Zalora php to_goZalora php to_go
Zalora php to_go
Weng Wei
 
A byte of git
A byte of gitA byte of git
A byte of git
Weng Wei
 
My understanding of Git
My understanding of GitMy understanding of Git
My understanding of Git
Weng Wei
 
Inside Zend Framework
Inside Zend FrameworkInside Zend Framework
Inside Zend Framework
Weng Wei
 
Ad

Recently uploaded (20)

How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.
gregtap1
 
Image processinglab image processing image processing
Image processinglab image processing  image processingImage processinglab image processing  image processing
Image processinglab image processing image processing
RaghadHany
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Leading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael JidaelLeading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael Jidael
Michael Jidael
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Automation Hour 1/28/2022: Capture User Feedback from Anywhere
Automation Hour 1/28/2022: Capture User Feedback from AnywhereAutomation Hour 1/28/2022: Capture User Feedback from Anywhere
Automation Hour 1/28/2022: Capture User Feedback from Anywhere
Lynda Kane
 
Automation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From AnywhereAutomation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From Anywhere
Lynda Kane
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Asthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdfAsthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdf
VanessaRaudez
 
Rock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning JourneyRock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning Journey
Lynda Kane
 
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical DebtBuckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Lynda Kane
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5..."Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
Fwdays
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.Network Security. Different aspects of Network Security.
Network Security. Different aspects of Network Security.
gregtap1
 
Image processinglab image processing image processing
Image processinglab image processing  image processingImage processinglab image processing  image processing
Image processinglab image processing image processing
RaghadHany
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Leading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael JidaelLeading AI Innovation As A Product Manager - Michael Jidael
Leading AI Innovation As A Product Manager - Michael Jidael
Michael Jidael
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Automation Hour 1/28/2022: Capture User Feedback from Anywhere
Automation Hour 1/28/2022: Capture User Feedback from AnywhereAutomation Hour 1/28/2022: Capture User Feedback from Anywhere
Automation Hour 1/28/2022: Capture User Feedback from Anywhere
Lynda Kane
 
Automation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From AnywhereAutomation Dreamin': Capture User Feedback From Anywhere
Automation Dreamin': Capture User Feedback From Anywhere
Lynda Kane
 
Electronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploitElectronic_Mail_Attacks-1-35.pdf by xploit
Electronic_Mail_Attacks-1-35.pdf by xploit
niftliyevhuseyn
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
 
Asthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdfAsthma presentación en inglés abril 2025 pdf
Asthma presentación en inglés abril 2025 pdf
VanessaRaudez
 
Rock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning JourneyRock, Paper, Scissors: An Apex Map Learning Journey
Rock, Paper, Scissors: An Apex Map Learning Journey
Lynda Kane
 
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical DebtBuckeye Dreamin 2024: Assessing and Resolving Technical Debt
Buckeye Dreamin 2024: Assessing and Resolving Technical Debt
Lynda Kane
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5..."Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
"Client Partnership — the Path to Exponential Growth for Companies Sized 50-5...
Fwdays
 

Why use Go for web development?

  • 1. Why use Go for Web development? Weng Wei, July 2014
  • 3. –Rob Pike “Go is a programming language designed by Google to help solve Google's (big)problems. ”
  • 4. –Derek Collison “ Go will become the dominant language for systems work in IaaS, Orchestration, and PaaS in 24 months.”
  • 5. Go looks cool! but, it is suitable for simple web development?
  • 6. Web? Use MVC! • Quite a number of Go MVC web framework exist: • Beego / Martini / Revel…. • Different approach for MC layers • V layer are mostly the same: Go HTML Template http://golang.org/ pkg/html/template/
  • 7. @yinwang0:Go HTML Template • “Basically usable” template engine • Surprisingly, logic control code in template are not Go itself • Poor expressiveness • Need to bind all template data into a single model • Helper func need to be “registerd” • Quite messy & tedious
  • 8. –Wang Yin “It’s better to build website with more mature frameworks from other language”
  • 9. Template engine must be good for web development!
  • 10. – Wikipedia “PHP(PHP: Hypertext Preprocessor)…server-side scripting language designed for web development.. PHP code can be simply mixed with HTML code..”
  • 12. • “Not possible, Go doesn’t have interpreter” • “Go is NOT script”
  • 13. I think otherwise • Go is turing complete • No things Go can’t go • Only thing more complicated to do with Go • Embedding static compile language in HTML are possible: • ASP.Net
  • 15. Razor • Default template/view engine for ASP.NET MVC • Support embedding c# / vb.net in HTML • .Net developers love it (including me): • http://www.zhihu.com/question/19973649 (Chinese link)
  • 16. How complicated to create GoRazor?
  • 17. GoRazor • http://github.com/sipin/gorazor • PoC in one night • Continuous team improvement:214 commits • Proven with internal large web project
  • 19. • Mature template engine; sublime plug-ins for syntax highlight + auto complete • Able use Go directly in template; no different syntax for flow control • Powerful expressiveness • Rendering template is calling function; models are function parameters • No need to register helper func, directly import in template • Very concise & convinient
  • 20. Demo
  • 21. • If you think Go is not suitable for web development because of poor template engine • Please try https://github.com/sipin/gorazor
  • 22. Of cause, template engine is only the start
  • 23. Is Go suitable for dynamic web development?
  • 24. Dynamic • web is built around string • Go is static compiled; can it: • Obtain object properties via string? • Invoke package/object methods via string? • Create object via string?
  • 25. Reflection • Reflection could meet most of the requirements • Check Martini
  • 26. Issues with Go’s reflection • Let’s put performance aside • Tedious & complicated • Move compilation error to runtime error: no complier check
  • 27. Reflection is not the only way
  • 29. For example • Bind HTTP Post form values to object
  • 34. • Generate all these methods: • NewXXXObjByID(namespace, classname, id string) • ReadForm(params map[string]string)
 • So, 600k LoC
 
 

  • 35. • Code generation makes static compiled language feels “dynamic” • Go can do this, so does all other languages • But, how about the compilation speed?
  • 37. Incremental compilation after editing template
  • 38. • Go’s compilation speed is amazing! • This is a project with 600k LoC on Mid 2011 Macbook Air • We could keep cmd + s / cmd + tab / cmd + R development pace
  • 39. Back to dynamic • If complication is slow, then code-gen approach hurts produtivity • Go compile extreme fast • Go has unique point for dynamic
  • 40. – Rob Pike “interfaces.. the true Go philosophy…”
  • 41. Go’s interface • Define class/method first • May define interface later • Interface query at run-time
  • 42. Example • Check if object has “GetUserID” method • If so, check if current user • If so, allow edit
  • 44. More example • Check if object has “IsDistributed”、“GetPersistentNode” methods • If so, replicate object to other nodes
  • 49. • Go allow querying original object’s interface • Switch between different interfaces at runtime • Interface could be defined in new packages • No need to put all interface combinations for different purpose at one place
  • 50. However, why reinventing the web MVC wheel?
  • 51. But! • Simple web pages? Pick whatever you like • Of cause including Go • Middle size web application, like a forum? • php / Rails / Django / asp.net are more mature • Go also can, if you like re-inventing the wheel • How about large website?
  • 52. Needs for large website • Stability rules • Scalability & Distributed are important • SOA architecture • Performance are critical • Maintainable code (With GoRazor; even the templates are strong- typed & compiler checked)
  • 53. • Quick prototyping, and switch technology/platform? • Works, but these are technical debt! • If we could owe less debt since the beginning, why not?
  • 54. Go is suitable to development large website!
  • 55. Finally, I would like to talk about Go & startup
  • 56. Q & A
  • 57. Reference • https://talks.golang.org/2012/splash.slide • http://open.qiniudn.com/go-next-c-pptx.pdf • http://www.csdn.net/article/2012-09-14/2809984-will-go-be-the-new-go-to- programming-lan • http://weibo.com/1889019865/B4nx3z6GF • http://www.yinwang.org/blog-cn/2014/04/18/golang/ • http://zh.wikipedia.org/wiki/PHP • http://www.ituring.com.cn/article/1339