text
stringlengths
0
1.82k
**Raphaël Simon:** \[19:57\] Right. So the main idea is you don't. You do not maintain generated code. Basically, you know, regenerated code is generated in its own package and it's cheap code. You don't have to maintain it, you don't have to test it, you don't have to really know the internals of it; you're welcome to...
So one of the code generation principals behind Goa is that user code and generated code never mix. And there is a very clear interface, an explicit... I mean a Go interface - it's a very explicit interface within the two. There's not just one, there's multiple, but the idea is that you have interfaces that are clear b...
I mean, basically the idea is if you change your design and you add - let's say you add a new field to a request payload, you regenerate your code, all that means is now your context subject has a new field and you can use it, and you don't have to worry about anything else.
Obviously, there are cases where the interface may break. They may change between different tools, but in that case it should be clear, it should be you moving from 1.0 to 2.0, and you're doing that consciously. It shouldn't be something that is a side effect.
So I've been very careful about that, because in the past I've had experience with CORBA, IDL, MIDL, and it was always really painful whenever the generated code mixed with user code. Because now what do you do? Do you test the whole thing? Do you now own the generated code? Do you need to test it, to maintain it? And ...
So I really wanted to try and avoid running into those issues, and so both the generated code goes into a front package, which you do not touch. Actually, you cannot touch it because the generator or the co-generator will wipe out the entire directory every time. So there is no way that your code is gonna mix with the ...
**Carlisia Thompson:** So when you say "Don't worry about testing the code that was auto-generated", part of the code was the controllers. So how is your workflow? Do you then go manually write tests for integration, for functionality? I'm not a huge fan of testing controllers in specific, I'm more a fan of testing int...
**Raphaël Simon:** So the controllers that the GoAgent generates, this is code that you own. So there are two kinds of code that GoAgent generates. One is the vast majority of the code; it's things that are living in front packages that you don't worry about. But then there is also this scaffolding code, which is kind ...
**Carlisia Thompson:** \[24:13\] Got it. And I wanted to say too, in prepping for these episodes I watched a talk that Brian Ketelsen gave in Tampa, and it's simply amazing. If you don't know Goa and have any interest at all, the talk is an hour fifteen, but it's so worth it because he shows the functionalities that Go...
And I'll tell you, it was very simple to use. Another thing that I thought was, I come from a Rails background, and I saw a lot of similarities. To me it felt like this could very much be an alternative to Rails if I wanted to do backend app or an API app in Go, except that it didn't abstract away a lot of things. I sa...
**Raphaël Simon:** Yeah, there is definitely some similarities in the way that you have controllers and you have resources, so that definitely is similar. I think also one other thing that Goa is trying to do is stay simple. So one of the things that we've used quite a bit here and we've grown an application probably w...
So something I think Goa is trying to do is to keep things simple; kind of get the best of Go, the Go principles of doing simple tools that do simple things and can be composed together to achieve what you want, and try to get those ideas and mix them with at the same time the practicality of doing something where you ...
I think that's kind of the two goals that are a little bit opposed to each other, but it's a good tension and I think Goa is trying to strike the balance between the two.
**Carlisia Thompson:** My impression was that it was very easy in the sense that when you jump into a Rails app, it's very easy to get going. So it was easy in that sense, but it was also simple and that's what I was trying to say... You know, in Rails I'm using a lot of abstractions that maybe I went into the Rails so...
**Raphaël Simon:** Yeah, that makes sense. I'm happy you say that. I mean, that was definitely a goal too, trying to simplify things and kind of hide a lot of the complexity of hooking up the model in the generated code, and then what you have to implement as the user should be fairly straightforward. Basically the dat...
**Brian Ketelsen:** \[28:08\] Now, I have an anecdote about that. In the Goa Slack channel, in the Gopher Slack, we call Raphael the Godfather, and that's because of his extreme dedication to the simplicity of the DSL and the user experience. He will not let anything get by that complicates the process, and I really ap...
I think having that laser-sharp focus on user experience and developer experience is what makes Goa a great tool, versus many of the other code generators, some of which I've written, that suck. So that's important. You have to have the Godfather in every project.
**Raphaël Simon:** \[laughs\] Yeah, I try to keep all the complexity below. You can look at it if you want, but you don't have to deal with it. I think it's a very interesting principle. Like in a big team, you get developers of every level that need to use your tool, and so I think you need to make it approachable, so...
You shouldn't have to know how the tool works to take full advantage of it. I think it's the tool's job to make sure that you can use it in a way that's easy and all the complexity is hidden from you. And at the same time, if you are a more advanced user or you're curious and you wanna see how it works, it shouldn't be...
**Erik St. Martin:** So another thing that's kind of risen in extreme popularity over the past couple of years is Swagger when doing API specifications, and as I understand it, Goa also generates all the Swagger specs so that you get the Swagger UI kind of for free for anything that you define in this DSL.
**Raphaël Simon:** Yeah. I mean, Swagger was definitely a big inspiration for the abstractions in the design, so there is no coincidence that the Swagger generation is very complete in the sense that you can express anything that you can express in Swagger in the DSL. Actually, the first inspiration was JSON schema. I ...
And so that was kind of the initial inspiration for the abstractions in the design language, but then it so happened that Swagger is also using JSON schema for a lot of their representation of what they call the path object. And so that mapping was very easy to do, and it just was sort of natural. And I think it's grea...
And actually, I think an interesting project or add-on that could be done with Goa is a tool that would take some Swagger definitions and generate the Goa DSL, kind of go the other way round. So if you write the Goa DSL you get Swagger, but it would also be interesting if you had Swagger to be able to go to a Goa DSL, ...
**Erik St. Martin:** He's assigning that to you, Brian.
**Brian Ketelsen:** Pardon me?
**Erik St. Martin:** He's assigning it that to you. That's your task. \[laughter\]
**Brian Ketelsen:** I was just going to say, if you started with a Swagger specification and you generated a Goa DSL and then the Goa DSL generated a Swagger specification, you could set that thing into an endless loop. And by the end of it, it would be Turing-complete.
**Raphaël Simon:** \[32:02\] \[laughs\] Yes, it will actually be very interesting to see how the Swagger evolves over time or it degrades. \[laughter\]
**Brian Ketelsen:** Or whether it takes over the world and starts launching nuclear warheads.
**Carlisia Thompson:** I have a question for Raphael. The views aspect or feature of Goa, I thought it was super interesting. I remember working with a Rails app, an API that was serving cube data as rests for resources, and we had to do some filters that were complicated. Once I figured out a pattern, we just followed...
Now, with query params and filtering features of an API, is that what the views does? Like if I have different filtering criteria, I can use different views to represent that, is that what it is?
**Raphaël Simon:** Yeah, that's the idea. So the idea is that a single resource may be represented in different ways. You may have an index view for example that only has a few fields, and you may have a detailed view that has all the fields, and you may have another view that is specialized in some other way. So the i...
If you decide that you want to use a query string parameter call view, and the name can be either index or expanded, then great. Do that, and in your controller, in your code, you basically build a response using the view that you wanted for that value of the query string. And that all gets also translated into the Swa...
**Carlisia Thompson:** Yeah, that sounds brilliant. And I bet it's a lot easier to document as well.
**Raphaël Simon:** Yeah, it is. And I think people have a sort of instinctive understanding of it; it makes sense. If I want to index you, then great. It's the same packing resource, it's just different ways for representing it. So I don't think it's a very complicated abstraction, and it does add a lot to the DSL.
**Brian Ketelsen:** Yeah, I completely agree with that.
**Erik St. Martin:** What's that?
**Brian Ketelsen:** I'm just saying I completely agree with that. I love the idea of views having the same resource represented slightly differently for a different use case. It doesn't mean you should have to write a ton of different code, you just ask for that resource with a specific view.
**Raphaël Simon:** Yeah.
**Erik St. Martin:** So I'd like to make sure we have kind of time to do a fireside chat... You know, talking about news and projects and stuff we've run across together. So before we move on off of Goa, I'd just kind of like to hear from you, what's next for Goa? What kind of functionality are you looking to add here ...
**Raphaël Simon:** \[36:04\] Yeah, so there are a couple of things. First of all I should say that Goa is not 1.0 yet, so I think the near future is going to be finishing 1.0. We are very close, and what I think will make sense is to finish up the security examples that we've started, because that's an area that can ge...
So finishing those examples and making sure everybody's happy with those, and then I think at that point we'd be ready to phrase and kind of shift 1.0, whatever that means. But the idea is that then that is stable, so if you are waiting for Goa to be stable to use it, there you go; now you can start using it.
And now for moving on for the next, 2.0, I think there's a couple of interesting areas I'm looking at right now. One is extending Goa beyond HTTP; in particular I've been looking at gRPC. I think it's an area that I've been asked a lot and it's also something we are looking at here at RightScale, so I'd like to see wha...
And another interesting space is making the DSL engine a bit more flexible. So today we've mentioned it's possible to write plugins, and plugins can define their own DSL and/or they can define their own output. But it's a bit more difficult if you want an output from one plugin to affect the output of another plugin, o...
If you wanted to do that today, it would be a bit difficult because you couldn't modify the output generated by the built-in generator for the low level HTTP server glue. I think that's another interesting dimension to look at in terms of trying to make Goa a bit more open and have more people being able to contribute ...
**Erik St. Martin:** This is great. I guess if anybody wants to keep up with or investigate Goa, [goa.design](https://goa.design) is probably the best place. The GitHub link's there.
**Raphaël Simon:** Yes, and the Slack Channel. I think there's a [GopherAcademy](https://gopheracademy.com), so [gophers.slack.com](https://gophers.slack.com) and there's a Goa channel there.
**Erik St. Martin:** That's right. And you'll be actually speaking at [GopherCon](https://www.gophercon.com) this year and Brian will be speaking at Abstractions about Goa as well, if I'm correct?
**Brian Ketelsen:** That's right. And we have a big announcement for people who might be interested in learning about Goa at either one of those conferences. I talked to the organizer of Abstractions and I talked with Erik, and we both agreed to do a discount code for both conferences, so you can get $50 off if you boo...
**Erik St. Martin:** Alright, so let's do some fireside chat here - news and interesting projects. We'd love for you to participate - Raphael, jump in wherever and offer your own input or things that you've come across and you find interesting.