SlideShare a Scribd company logo
Fast Web Applications
with Go
!

DevFestW Istanbul !
March 2,2014!
Ekin Eylem Ozekin!
Outline
!

² 

Introduction to Go!

² 

Web with Go!

² 

Is Go suitable to Web!

² 

Demo Web Application!

² 

Questions

!
But First of All, Me
!

• 

Ekin Eylem Ozekin!

• 

BSc. In Computer Science, MSc. In Software
Engineering!

• 

Currently, Ph.D. Candidate at Bogazici
University, on Machine Learning!

• 

Works at GE

!
Introduction to Go
!

• 

Built around 2007, announced at 2009!

• 

By “GO”ogle!

• 

Open Source!

• 

Similar to C!

• 

Statically typed, compiled!

• 

No pointer arithmetic

!
Introduction to Go
!

• 

Automatic memory management, classes
(structs), type inference!

• 

First class functions, suitable to functional
programming!

• 

Concurrency support, channels

!
Introduction to Go
!

• 

Ideal for fast, distributed systems!

• 

Can import libraries directly from URLs!

• 

Built-in UTF-8 support (İ, Ğ etc. works perfectly)!

• 

Integrated AppEngine libraries

!
Introduction to Go
!

package main!
!

import (!
"fmt"!
"net/http"!
)!
!

func get_name() (string, string) {!
// No reason to break a few rules, right!
var hello = "Hello "!
audience := "DevFestTR"!
return hello, audience!
}!
!
func handler(writer http.ResponseWriter, request *http.Request) {!
hello, audience := get_name()!
fmt.Fprintf(writer, hello + audience)!
}!
!
func main() {!
http.HandleFunc("/", handler)!
http.ListenAndServe(":8080", nil)!
}

!
Introduction to Go
!

• 

Written as read, left from right!

• 

No semicolons!

• 

Multiple return values (think of tuples in Python)!

• 

Single binary file after compile!

• 

More on the previous code later

!
Web with Go
!

• 

Built-in http package!

• 

Similar to J2EE Servlets!

• 

But more like a Micro-framework

!
Web with Go
!

• 

Web Development with the performance of C!

• 

Might be deployed with built-in server (port
listener actually)!

• 

Deploy to Apache or Nginx with FastCGI!

• 

Also mod_go for Apache!

• 

Deploy to AppEngine or Heroku

!
Is Go Suitable for Web
!

Should I use Go for Web?
!
Is Go Suitable for Web
!

Pros!

• 
• 

Micro-framework style http package!

• 

CGI support (kinda old but solid and useful)!

• 

Compiled, fast performance!

• 

C like Syntax but better!

• 

API is mature enough!
Is Go Suitable for Web
!

Cons!

• 
• 

Not easier then PHP (or Ruby or Python)!

• 

Not as widely used as others!

• 

Not proven enough yet (can be argued)!
Is Go Suitable for Web
!

Last Word!

• 
• 

Service Oriented Architecture and Micro Frameworks fit well!

• 

You don’t have to use just Go, use with others!

• 

Google already uses it (isn’t it enough reason?)!
Demo

!

A Web application with Go
!

!

Let’s GO!
Source Code
!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

Server Side Code!

package main!
import ("html/template"; "fmt"; "net/http"; "strconv")!
func main() {!
http.HandleFunc("/", form)!
http.HandleFunc("/show_age", form_handler)!
http.ListenAndServe(":8080", nil)!
}!
func form(writer http.ResponseWriter,!
request *http.Request) {!
genderList := []string { "Male", "Female" }!
t, _ := template.ParseFiles("form.html")!
t.Execute(writer, map[string]interface{} {!
"genders": genderList,!
"title": "DevFest Applicant Form",!
})!
}!
func form_handler(writer http.ResponseWriter,!
request *http.Request) {!
gender := request.FormValue("gender")!
message := ""!
if ("1" == gender) {!
message = "You don't ask a woman her age."!
} else {!
age, _ := strconv.Atoi(request.FormValue("age"))!
if (age < 1000) {!
message = "This boy is still alive and kicking"!
} else {!
message = ”Still too young!"!
} !
}!
fmt.Fprintf(writer, message)!
}

!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

Template Code!

<h1>{{.title}}</h1>!
<p>!
Fill in your gender and age.!
<br />!
And I will tell you if you are old or not...!
</p>!
<form action="/show_age" method="POST">!
<dl>!
<dt>Gender</dt>!
<dd>!
<select name="gender" style="width: 125px;">!
{{range $index, $value := .genders}}!
<option value="{{$index}}" />{{$value}}!
{{end}}!
</select>!
</dd>!
<dt>Age</dt>!
<dd><input type="text" name="age" /></dd>!
</dl>!
<input type="submit" value="Save">!
</form>

!
More information
!

² 

http://golang.org/doc/!

² 

http://golang.org/doc/articles/gos_declaration_syntax.html!

² 

http://blog.iron.io/2013/08/go-after-2-years-in-production.html!
Questions?

!

?

!

Thank you for listening!
!

Ekin Eylem Ozekin!
eeozekin@gmail.com

!
Q&A Session
!

• 
• 

• 
• 
• 
• 
• 
• 

Is there a Database Abstraction layer?!
As there are no classes ORM is a bit crippled. However, there are few implementations on that.
You can find those here: http://jmoiron.net/blog/golang-orms/ . There are also bindings for popular
databases: http://go-lang.cat-v.org/library-bindings!
What can I use for User Interfaces?!
There is a GTK binding for that. For more libraries you can check:
http://go-lang.cat-v.org/library-bindings!
To return multiple values Python returns actually a Tuple data structure. Is it similar in Go too?!
No. Go really returns multiple values.!
If I can something on a template, should I recompile in order to see changes?!
No, you don’t. If you make a change on the template code, all you have to do is refresh the page.
However you should be careful, when deploying to the server you should make sure that those
templates exist too.

!

More Related Content

What's hot

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
 
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
 
Contributing to open source
Contributing to open sourceContributing to open source
Contributing to open source
Devin Abbott
 
RubyConf Taiwan 2016 - Large scale Rails applications
RubyConf Taiwan 2016 - Large scale Rails applicationsRubyConf Taiwan 2016 - Large scale Rails applications
RubyConf Taiwan 2016 - Large scale Rails applications
Florian Dutey
 
Angular ❤️ CMS from #AngularUp
Angular ❤️ CMS from #AngularUpAngular ❤️ CMS from #AngularUp
Angular ❤️ CMS from #AngularUp
Filip Bruun Bech-Larsen
 
Week 8 intro to python
Week 8   intro to pythonWeek 8   intro to python
Week 8 intro to python
brianjihoonlee
 
Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4
Derek Jacoby
 
My Contributor Story
My Contributor StoryMy Contributor Story
My Contributor Story
Marko Heijnen
 
RubyConf China 2015 - Rails off assets pipeline
RubyConf China 2015 - Rails off assets pipelineRubyConf China 2015 - Rails off assets pipeline
RubyConf China 2015 - Rails off assets pipeline
Florian Dutey
 
Whats next in templating
Whats next in templatingWhats next in templating
Whats next in templating
Filip Bruun Bech-Larsen
 
Reason React
Reason ReactReason React
Reason React
Arnar Þór Sveinsson
 
Rails Vs CakePHP
Rails Vs CakePHPRails Vs CakePHP
Rails Vs CakePHP
Gautam Rege
 
The future of templating and frameworks
The future of templating and frameworksThe future of templating and frameworks
The future of templating and frameworks
Filip Bruun Bech-Larsen
 
Making CLI app in ruby
Making CLI app in rubyMaking CLI app in ruby
Making CLI app in ruby
Huy Do
 
So you think you can scale
So you think you can scaleSo you think you can scale
So you think you can scale
Dan Beil
 
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
 
SGCE 2015 REST APIs
SGCE 2015 REST APIsSGCE 2015 REST APIs
SGCE 2015 REST APIs
Domingo Suarez Torres
 
Engage 2019: Modernising Your Domino and XPages Applications
Engage 2019: Modernising Your Domino and XPages Applications Engage 2019: Modernising Your Domino and XPages Applications
Engage 2019: Modernising Your Domino and XPages Applications
Paul Withers
 
WordPress Development Environments
WordPress Development EnvironmentsWordPress Development Environments
WordPress Development Environments
Josh Cummings
 

What's hot (20)

Untangling - fall2017 - week5
Untangling - fall2017 - week5Untangling - fall2017 - week5
Untangling - fall2017 - week5
 
Untangling - fall2017 - week6
Untangling - fall2017 - week6Untangling - fall2017 - week6
Untangling - fall2017 - week6
 
Saving Time By Testing With Jest
Saving Time By Testing With JestSaving Time By Testing With Jest
Saving Time By Testing With Jest
 
Contributing to open source
Contributing to open sourceContributing to open source
Contributing to open source
 
RubyConf Taiwan 2016 - Large scale Rails applications
RubyConf Taiwan 2016 - Large scale Rails applicationsRubyConf Taiwan 2016 - Large scale Rails applications
RubyConf Taiwan 2016 - Large scale Rails applications
 
Angular ❤️ CMS from #AngularUp
Angular ❤️ CMS from #AngularUpAngular ❤️ CMS from #AngularUp
Angular ❤️ CMS from #AngularUp
 
Week 8 intro to python
Week 8   intro to pythonWeek 8   intro to python
Week 8 intro to python
 
Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4Untangling the web - fall2017 - class 4
Untangling the web - fall2017 - class 4
 
My Contributor Story
My Contributor StoryMy Contributor Story
My Contributor Story
 
RubyConf China 2015 - Rails off assets pipeline
RubyConf China 2015 - Rails off assets pipelineRubyConf China 2015 - Rails off assets pipeline
RubyConf China 2015 - Rails off assets pipeline
 
Whats next in templating
Whats next in templatingWhats next in templating
Whats next in templating
 
Reason React
Reason ReactReason React
Reason React
 
Rails Vs CakePHP
Rails Vs CakePHPRails Vs CakePHP
Rails Vs CakePHP
 
The future of templating and frameworks
The future of templating and frameworksThe future of templating and frameworks
The future of templating and frameworks
 
Making CLI app in ruby
Making CLI app in rubyMaking CLI app in ruby
Making CLI app in ruby
 
So you think you can scale
So you think you can scaleSo you think you can scale
So you think you can scale
 
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
 
SGCE 2015 REST APIs
SGCE 2015 REST APIsSGCE 2015 REST APIs
SGCE 2015 REST APIs
 
Engage 2019: Modernising Your Domino and XPages Applications
Engage 2019: Modernising Your Domino and XPages Applications Engage 2019: Modernising Your Domino and XPages Applications
Engage 2019: Modernising Your Domino and XPages Applications
 
WordPress Development Environments
WordPress Development EnvironmentsWordPress Development Environments
WordPress Development Environments
 

Similar to Fast Web Applications with Go

網頁程式設計
網頁程式設計網頁程式設計
網頁程式設計
傳錡 蕭
 
Desert Code Camp 2014: C#, the best programming language
Desert Code Camp 2014: C#, the best programming languageDesert Code Camp 2014: C#, the best programming language
Desert Code Camp 2014: C#, the best programming language
James Montemagno
 
Developing OpenResty Framework
Developing OpenResty FrameworkDeveloping OpenResty Framework
Developing OpenResty Framework
OpenRestyCon
 
Дмитрий Щадей "Что помогает нам писать качественный JavaScript-код?"
Дмитрий Щадей "Что помогает нам писать качественный JavaScript-код?"Дмитрий Щадей "Что помогает нам писать качественный JavaScript-код?"
Дмитрий Щадей "Что помогает нам писать качественный JavaScript-код?"
Yandex
 
Rapid Prototyping With J Query
Rapid Prototyping With J QueryRapid Prototyping With J Query
Rapid Prototyping With J Query
Bootstrap
 
Clojure at ardoq
Clojure at ardoqClojure at ardoq
Clojure at ardoq
Erik Bakstad
 
How to start developing apps for Firefox OS
How to start developing apps for Firefox OSHow to start developing apps for Firefox OS
How to start developing apps for Firefox OS
benko
 
Snakes on the Web; Developing web applications in python
Snakes on the Web; Developing web applications in pythonSnakes on the Web; Developing web applications in python
Snakes on the Web; Developing web applications in python
Naail AbdulRahman
 
Evaluation of Web Processing Service Frameworks
Evaluation of Web Processing Service FrameworksEvaluation of Web Processing Service Frameworks
Evaluation of Web Processing Service Frameworks
Ebrahim Poorazizi
 
Go language presentation
Go language presentationGo language presentation
Go language presentation
paramisoft
 
Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)
Ran Mizrahi
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)
Ran Mizrahi
 
GoralSoft
GoralSoftGoralSoft
GoralSoft
goralsoft
 
Single page applications the basics
Single page applications the basicsSingle page applications the basics
Single page applications the basics
Chris Love
 
Breaking up with Microsoft Word
Breaking up with Microsoft WordBreaking up with Microsoft Word
Breaking up with Microsoft Word
cdelk
 
Developer Efficiency
Developer EfficiencyDeveloper Efficiency
Developer Efficiency
Dmitri Nesteruk
 
Web Fundamentals Crash Course
Web Fundamentals Crash CourseWeb Fundamentals Crash Course
Web Fundamentals Crash Course
MrAbbas
 
Web Fundamentals Crash Course
Web Fundamentals Crash CourseWeb Fundamentals Crash Course
Web Fundamentals Crash Course
MrAbas
 
MozTW YZU CSE Lecture
MozTW YZU CSE LectureMozTW YZU CSE Lecture
MozTW YZU CSE Lecture
littlebtc
 
HTML5 History & Features
HTML5 History & FeaturesHTML5 History & Features
HTML5 History & Features
Dave Ross
 

Similar to Fast Web Applications with Go (20)

網頁程式設計
網頁程式設計網頁程式設計
網頁程式設計
 
Desert Code Camp 2014: C#, the best programming language
Desert Code Camp 2014: C#, the best programming languageDesert Code Camp 2014: C#, the best programming language
Desert Code Camp 2014: C#, the best programming language
 
Developing OpenResty Framework
Developing OpenResty FrameworkDeveloping OpenResty Framework
Developing OpenResty Framework
 
Дмитрий Щадей "Что помогает нам писать качественный JavaScript-код?"
Дмитрий Щадей "Что помогает нам писать качественный JavaScript-код?"Дмитрий Щадей "Что помогает нам писать качественный JavaScript-код?"
Дмитрий Щадей "Что помогает нам писать качественный JavaScript-код?"
 
Rapid Prototyping With J Query
Rapid Prototyping With J QueryRapid Prototyping With J Query
Rapid Prototyping With J Query
 
Clojure at ardoq
Clojure at ardoqClojure at ardoq
Clojure at ardoq
 
How to start developing apps for Firefox OS
How to start developing apps for Firefox OSHow to start developing apps for Firefox OS
How to start developing apps for Firefox OS
 
Snakes on the Web; Developing web applications in python
Snakes on the Web; Developing web applications in pythonSnakes on the Web; Developing web applications in python
Snakes on the Web; Developing web applications in python
 
Evaluation of Web Processing Service Frameworks
Evaluation of Web Processing Service FrameworksEvaluation of Web Processing Service Frameworks
Evaluation of Web Processing Service Frameworks
 
Go language presentation
Go language presentationGo language presentation
Go language presentation
 
Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)Intro to node.js - Ran Mizrahi (27/8/2014)
Intro to node.js - Ran Mizrahi (27/8/2014)
 
Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)Intro to node.js - Ran Mizrahi (28/8/14)
Intro to node.js - Ran Mizrahi (28/8/14)
 
GoralSoft
GoralSoftGoralSoft
GoralSoft
 
Single page applications the basics
Single page applications the basicsSingle page applications the basics
Single page applications the basics
 
Breaking up with Microsoft Word
Breaking up with Microsoft WordBreaking up with Microsoft Word
Breaking up with Microsoft Word
 
Developer Efficiency
Developer EfficiencyDeveloper Efficiency
Developer Efficiency
 
Web Fundamentals Crash Course
Web Fundamentals Crash CourseWeb Fundamentals Crash Course
Web Fundamentals Crash Course
 
Web Fundamentals Crash Course
Web Fundamentals Crash CourseWeb Fundamentals Crash Course
Web Fundamentals Crash Course
 
MozTW YZU CSE Lecture
MozTW YZU CSE LectureMozTW YZU CSE Lecture
MozTW YZU CSE Lecture
 
HTML5 History & Features
HTML5 History & FeaturesHTML5 History & Features
HTML5 History & Features
 

Recently uploaded

20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 

Recently uploaded (20)

20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 

Fast Web Applications with Go

  • 1. Fast Web Applications with Go ! DevFestW Istanbul ! March 2,2014! Ekin Eylem Ozekin!
  • 2. Outline ! ²  Introduction to Go! ²  Web with Go! ²  Is Go suitable to Web! ²  Demo Web Application! ²  Questions !
  • 3. But First of All, Me ! •  Ekin Eylem Ozekin! •  BSc. In Computer Science, MSc. In Software Engineering! •  Currently, Ph.D. Candidate at Bogazici University, on Machine Learning! •  Works at GE !
  • 4. Introduction to Go ! •  Built around 2007, announced at 2009! •  By “GO”ogle! •  Open Source! •  Similar to C! •  Statically typed, compiled! •  No pointer arithmetic !
  • 5. Introduction to Go ! •  Automatic memory management, classes (structs), type inference! •  First class functions, suitable to functional programming! •  Concurrency support, channels !
  • 6. Introduction to Go ! •  Ideal for fast, distributed systems! •  Can import libraries directly from URLs! •  Built-in UTF-8 support (İ, Ğ etc. works perfectly)! •  Integrated AppEngine libraries !
  • 7. Introduction to Go ! package main! ! import (! "fmt"! "net/http"! )! ! func get_name() (string, string) {! // No reason to break a few rules, right! var hello = "Hello "! audience := "DevFestTR"! return hello, audience! }! ! func handler(writer http.ResponseWriter, request *http.Request) {! hello, audience := get_name()! fmt.Fprintf(writer, hello + audience)! }! ! func main() {! http.HandleFunc("/", handler)! http.ListenAndServe(":8080", nil)! } !
  • 8. Introduction to Go ! •  Written as read, left from right! •  No semicolons! •  Multiple return values (think of tuples in Python)! •  Single binary file after compile! •  More on the previous code later !
  • 9. Web with Go ! •  Built-in http package! •  Similar to J2EE Servlets! •  But more like a Micro-framework !
  • 10. Web with Go ! •  Web Development with the performance of C! •  Might be deployed with built-in server (port listener actually)! •  Deploy to Apache or Nginx with FastCGI! •  Also mod_go for Apache! •  Deploy to AppEngine or Heroku !
  • 11. Is Go Suitable for Web ! Should I use Go for Web? !
  • 12. Is Go Suitable for Web ! Pros! •  •  Micro-framework style http package! •  CGI support (kinda old but solid and useful)! •  Compiled, fast performance! •  C like Syntax but better! •  API is mature enough!
  • 13. Is Go Suitable for Web ! Cons! •  •  Not easier then PHP (or Ruby or Python)! •  Not as widely used as others! •  Not proven enough yet (can be argued)!
  • 14. Is Go Suitable for Web ! Last Word! •  •  Service Oriented Architecture and Micro Frameworks fit well! •  You don’t have to use just Go, use with others! •  Google already uses it (isn’t it enough reason?)!
  • 15. Demo ! A Web application with Go ! ! Let’s GO!
  • 16. Source Code ! 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 Server Side Code! package main! import ("html/template"; "fmt"; "net/http"; "strconv")! func main() {! http.HandleFunc("/", form)! http.HandleFunc("/show_age", form_handler)! http.ListenAndServe(":8080", nil)! }! func form(writer http.ResponseWriter,! request *http.Request) {! genderList := []string { "Male", "Female" }! t, _ := template.ParseFiles("form.html")! t.Execute(writer, map[string]interface{} {! "genders": genderList,! "title": "DevFest Applicant Form",! })! }! func form_handler(writer http.ResponseWriter,! request *http.Request) {! gender := request.FormValue("gender")! message := ""! if ("1" == gender) {! message = "You don't ask a woman her age."! } else {! age, _ := strconv.Atoi(request.FormValue("age"))! if (age < 1000) {! message = "This boy is still alive and kicking"! } else {! message = ”Still too young!"! } ! }! fmt.Fprintf(writer, message)! } ! 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 Template Code! <h1>{{.title}}</h1>! <p>! Fill in your gender and age.! <br />! And I will tell you if you are old or not...! </p>! <form action="/show_age" method="POST">! <dl>! <dt>Gender</dt>! <dd>! <select name="gender" style="width: 125px;">! {{range $index, $value := .genders}}! <option value="{{$index}}" />{{$value}}! {{end}}! </select>! </dd>! <dt>Age</dt>! <dd><input type="text" name="age" /></dd>! </dl>! <input type="submit" value="Save">! </form> !
  • 18. Questions? ! ? ! Thank you for listening! ! Ekin Eylem Ozekin! eeozekin@gmail.com !
  • 19. Q&A Session ! •  •  •  •  •  •  •  •  Is there a Database Abstraction layer?! As there are no classes ORM is a bit crippled. However, there are few implementations on that. You can find those here: http://jmoiron.net/blog/golang-orms/ . There are also bindings for popular databases: http://go-lang.cat-v.org/library-bindings! What can I use for User Interfaces?! There is a GTK binding for that. For more libraries you can check: http://go-lang.cat-v.org/library-bindings! To return multiple values Python returns actually a Tuple data structure. Is it similar in Go too?! No. Go really returns multiple values.! If I can something on a template, should I recompile in order to see changes?! No, you don’t. If you make a change on the template code, all you have to do is refresh the page. However you should be careful, when deploying to the server you should make sure that those templates exist too. !