Talks

Summarized using AI

Go For The Rubyist

Mark Bates • February 06, 2014 • Burbank, CA

In the talk titled "Go For The Rubyist," Mark Bates discusses why the Ruby community is increasingly interested in the Go programming language, which was developed by Google. He begins by emphasizing the importance of learning from other programming languages and being a 'polyglot' programmer to enhance one's skills in software development. Bates highlights the origins of Go, illustrating its creation in response to the scalability issues faced by Google, which accounts for approximately 40% of internet traffic. This significant background leads to the discussion of Go's key features that make it appealing, particularly to Rubyists:

  • Compiled Language: Go is a statically typed, compiled language that offers garbage collection and true cross-platform capabilities, allowing for easy deployment across different operating systems.
  • Concurrency: One of Go's standout features is its robust handling of concurrency. While Ruby developers often face challenges with blocking operations, Go allows for concurrent execution of functions, maximizing CPU resource utilization.
  • Simplicity in Error Handling: Instead of traditional exception handling found in other languages, Go employs a simpler error handling mechanism, making it user-friendly for developers.
  • Speed: Bates compares the performance of Go and Ruby, showcasing significant speed advantages in Go, which is especially beneficial in performance-critical applications.
  • Flexible Typing: Although Go is statically typed, it allows some flexibility through its implicit interface system, enabling dynamic-like behavior in some cases.
  • Testing and Packages: Go features an accessible testing framework and encourages the use of third-party packages, streamlining the development process.
  • Frameworks: Bates introduces Ginkgo for behavior-driven development and mentions the robust net/http library for web applications, underlining Go's readiness for production environments.

He encourages Ruby developers to see the value in interdisciplinary learning and experimentation with different languages, concluding that Go provides excellent capabilities for command-line applications, concurrent programming, and performance-sensitive tasks. Through its powerful features, Go can complement Ruby in various projects, enabling developers to create high-quality applications while continuing to grow their technical repertoire.

Go For The Rubyist
Mark Bates • February 06, 2014 • Burbank, CA

Why are so many Rubyists buzzing about Go? This hot new language that grew out of Google just a few years ago is taking the world by storm and is generating a lot of buzz in the Ruby community. In this talk we'll look at the highlights of Go and try and figure out what the hype is all about, and we'll do with a keen Rubyist eye. We'll also look at where it would make sense in our Ruby/Rails projects to extend them with this highly concurrent, and performant language. What do you say my fellow Rubyists; are you up for the challenge of learning something a bit different?

Help us caption & translate this video!

http://amara.org/v/FG2v/

LA RubyConf 2014

00:00:27.900 Hello, Los Angeles! Come on, one more time. Hello, LA! Oh gosh, that was pathetic. Okay, we need to fix that. Everyone, please stand up. At the end of the day, we’re all a bit tired, and if you just sit, it's not going to be as good. Everybody, reach your arms up to the sky. There you go; very nice! Now some twists... And there you go! Still not feeling good? Let's get a little back stretch in there. Oh, excellent! Now, stay standing. I am Mark Bates. You can follow me on Twitter, where I share lots of really useful comments. I am the author of three books: "Distributed Programming", "Ruby Programming", and "CoffeeScript and Command-Line" which is written on Michael Hardin’s framework. I have a couple of PDF copies of that book to give away to a couple of lucky folks in the audience. This is what it looks like when you win one! I also work with a site called Metacast TV, which covers Ruby, JavaScript, and Go, among other things.
00:01:00.670 If you use this coupon code, you can get your first month free. So if you’re interested in Go, there are a couple of screencasts up there that you can learn about at no cost. Now, we’re going to talk about Go here, and I know you might be thinking, "Mark, this is a Ruby conference, right?" We're talking about Go! Well, I’ve been doing a lot of traveling over the past couple of years, and it’s quite common at Ruby conferences to see discussions about other languages. We've heard about a couple today—Node.js, Scala, and Elixir are big names in the conversation. So, why are we talking about these languages that aren’t Ruby at a Ruby conference?
00:02:01.299 To answer that question, let’s go back about 18 years, to 1996. When I was a freshman in college, there was a background session led by one of the founders of the school, a gentleman named Mark Featherstone-Witty, who had a very English name. He talked about the ethos and principles of our education, stating that in order to graduate and pass our classes, we had to interact with other disciplines in the school. We couldn't just practice music alone; we had to collaborate with dancers, actors, and sound technologists. One thing he said stuck with me, and it is as true for software as it is for art: "Art isn't created in a vacuum." I would argue that good software isn’t either. You need to take in influences from the outside. Understand what others are doing to improve the quality of your code.
00:02:48.090 Bringing in new ideas is crucial, and the phrase "polyglot" was mentioned earlier today. It truly is important to be a polyglot programmer. Imagine how terrible the Beatles would have been if they never listened to Buddy Holly, Elvis Presley, the blues, or classical music. Those influences shaped their music; without them, we wouldn’t have innovative albums like "Sgt. Pepper's Lonely Hearts Club Band." Similarly, as a developer, you need to explore styles beyond your own. Today, we’re going to do that by discussing Go—what it is, where it came from, and take a brief overview of the language.
00:03:34.959 We’ll also examine tools that are similar to what we have in the Ruby world, so that if you decide to create an app in Go or see where it could benefit your company, you’ll know where to start. So, what is Go? Well, Go originated from a little startup company up in Mountain View—Google, to be precise. They were really trying hard to address scalability issues. Out of curiosity, how much Internet traffic do you think Google is responsible for? Just shout out some numbers! What percentage?
00:04:39.840 Some might say, 'A hundred percent!' But no, it's actually significantly lower. According to recent Forbes data, Google accounts for about 40% of the Internet's traffic. That’s significant! Who can match that traffic in their application? Anyone? I didn’t think so. If we combined all the traffic generated by everyone in this room, I would be hard-pressed to imagine we would even scratch the surface of Google's volume. They operate on a scale that most of us will never reach unless we work at Google. So when a company responsible for 40% of the Internet traffic claims it has created a language to solve its scalability issues – shouldn’t we pay attention? I certainly think we should.
00:06:02.880 Go is a compiled language, which might strike fear into the hearts of dynamic scripting language enthusiasts. It’s statically typed, though not as strict as languages like Java. It features garbage collection, which is crucial, and it boasts true cross-platform capabilities. When you build a Go binary, it compiles all your third-party dependencies and assets into a single binary file. This means I can compile a Go program on Mac, and it will run flawlessly on Windows without any additional installations. It allows easy deployments, and it’s incredibly concurrent. This is where Go truly shines.
00:06:55.560 You might have heard that Go handles concurrency exceptionally well, and it’s very simple to use. It has a small number of keywords to learn: Go has 25, Java has 50, and C++ holds 84 keywords. Ruby has 42 keywords, which I'm sure some of you already knew. Go’s absence of traditional exception handling also sets it apart. You handle errors directly, rather than catching exceptions that bubble up through your application.
00:08:02.670 Now, let’s explore a basic Go program. Here's a simple "Hello, World!" application, which is one of the two programs you must write to earn your CS degree. In Go, you have a main package, which is the entry point for all Go applications, along with the main function. Interestingly, this capital 'P' in print is important because Go's approach to visibility is straightforward. If something is named with a capital letter, it's public; if lowercase, it's private. Concurrency, as I mentioned earlier, is a big selling point for Go.
00:09:36.030 Let's consider a function that lifts heavy objects. If it takes 30 seconds to complete, the application blocks on that line for 30 seconds. This scenario is a common issue in the Ruby world. However, in Go, you can tell the program to launch that task in the background, allowing the rest of the application to continue running. This is done simply by adding the keyword 'go' before a function call. It allows the concurrent execution of functions, taking advantage of all CPU cores and efficiently managing resources.
00:10:50.910 With Go routines, you can create a communications channel so that you can send and receive information between various processes. This makes it easy to get results back and handle them appropriately. Unlike complex libraries that require thread management, Go integrates this functionality into its core – making it a powerful feature of the language. Imagine a scenario where a user uploads an image. You can offload the processing to multiple Go routines running in parallel. When each one finishes, it can communicate back to you, allowing your web application to respond in real-time.
00:12:45.020 Moreover, speed is a key advantage of Go. For example, here’s a comparison of Fibonacci generators in both Go and Ruby. When tested, Go runs the generator in 0.005 seconds, while Ruby takes 0.38 seconds. That’s significantly faster! In real-world applications where you might be processing a hundred thousand items simultaneously, Go's speed advantages really start to add up.
00:14:22.140 Duck typing is an interesting topic to touch upon, especially for those of us who've come from Ruby. While Go is statically typed and requires you to declare specific types, it does allow some flexibility through its implicit interface system. In essence, as long as an object has the necessary methods, it can be treated as implementing an interface.
00:14:58.540 Now, let’s discuss practical applications of Go for Rubyists. Package management is crucial because Go allows you to use third-party packages seamlessly. However, its native package management isn't very advanced. Thankfully, there are third-party solutions for managing dependencies effectively. Testing, as we all know, is a big deal, and Go takes testing seriously, offering straightforward testing functionality that many developers appreciate.
00:16:46.160 An exciting framework called Ginkgo is worth checking out for those who prefer behavior-driven development approaches that you might be familiar with from Ruby. It has a clean syntax that allows for easy testing. When you work in Go, you can also easily create web applications thanks to its robust net/http library, which is especially useful for building production-ready applications.
00:19:21.290 Lastly, Go has solid drivers for modern databases. If you're working with databases in Go, I recommend the 'sequel' package for mapping results nicely. You’ll find many other packages available that can enhance your database interaction when working with Go.
00:20:50.660 To wrap up, if you’re considering options for your projects, remember Go excels in areas like command-line applications, concurrent programming, and performance-critical environments. Leveraging Go, while still integrating Ruby, allows you to harness the best of both worlds, enabling you to create incredible applications.
00:23:00.060 Thank you for your time! I hope this talk on Go has been helpful, and I’ll now open the floor to any questions you may have. Remember, keep learning and exploring new technologies!
Explore all talks recorded at LA RubyConf 2014
+2