text stringlengths 0 1.82k |
|---|
**Bryan Liles:** Yeah... I like to do TDD, but sometimes I just write software. I have a project in front of me right now where I just started writing because I wasn't sure if my abstraction was right; generally, whenever you get to the point where you're starting to lay down test, people are much more reluctant to cha... |
The reason I work like that is because it works for me. This is not a prescription for anyone. But what I'm saying is that we need to understand, once again, why do we have tests? What are tests for? Are we using them to prove correctness? I'm actually using it to make sure that I can move faster and I don't have to sw... |
That's the only reason I write tests - because I don't trust future Bryan; or actually, I don't trust past Bryan. He's a jerk. |
**Brian Ketelsen:** The past Bryan, exactly. It's always past Brian getting me in trouble. |
**Erik St. Martin:** I like the safety of refactoring by having a test suite. I've never been a hundred percent test-coverage person because I think that that just makes people write tests that just hit the code and they don't actually truly exercise the program. Also, I've never adopted that whole red-green-refactor t... |
\[48:15\] And typically, through the development and through the usage of an application, I'll throw in tests as issues come up, to prevent regressions. I like testing, but I'm not a "test first" all the time. There's some problems where I will start with the uni-test first and kind of build from there, but there's oth... |
**Bryan Liles:** Yeah. Red-green-refactor is hard, and I like how books have it and they're like, "That's how you do it." I always use something different, and I know this is valid because before Jim Weirich died, he said "Bryan, this is a good idea." And I stuck with this one. |
So what I've done is I write a little code, and maybe I write a test first or maybe I write the test last; I run the test, and hopefully it fails, because you should try to make those tests fail. Then I change a little bit of code and I run the test again. I don't think about red-green-refactor. I do red-green-red-gree... |
Just remember, all we're trying to do is write code faster. If I can write code fast with no test and it was a hundred percent correct, would I write tests? No. |
**Erik St. Martin:** Yeah, until future Bryan has to deal with past Bryan, and tries to refactor. |
**Bryan Liles:** Well, past Bryan is a jerk, and we know past Bryan is a jerk, so I don't expect him to be better. |
**Carlisia Thompson:** For me, one thing that I have adopted at some point and since then I always use it, and it has been tremendously helpful, is to have the red there at some point. I don't care if I'm writing the test first or not, but making that test fail makes a huge difference, because you could be writing and ... |
**Erik St. Martin:** There's also some unit tests... I know in Ruby they have it - I forgot the name of the library now - where it inverts your test to basically make sure that it would fail without it. They have fuzzying tools and stuff like that. |
So we talk about having those tests there for refactoring; unless it's a large refactor that I have to do, it doesn't always bother me to write the tests before I do the refactoring. If I'm looking at some small library with very little surface in the API, I'll write a test, test out a couple of scenarios that I wanna ... |
I think if you're on a large team and lots of people are touching the same code, I think it benefits you more to have a lot of test coverage, because there's a lot of risk there, that I start stepping in and making changes, but then, you know... Brian and Carlisia are working on stuff and I break them because I'm not t... |
**Carlisia Thompson:** And testing is something that really pays off to learn how to do well. |
**Erik St. Martin:** Without a doubt. |
**Carlisia Thompson:** \[51:47\] Right? I'm not there yet, I keep learning, but you look at a codebase and it has a ton of tests, and most of them are useless. It consumes time from everybody - they have to read... I mean, when I look at a new codebase, the first thing I read is the test, because it will tell me the bu... |
**Erik St. Martin:** Yeah, if they not valid tests, they're just trying to hit lines of code, then there's no point in having them. But I think the takeaway is you should try to test as best as you can. If you've got a one or two-line function that does something very clear - formats a string, or something - I don't kn... |
**Bryan Liles:** Obviously, I have one last thing for people that think about testing and they always say to me, "I'm gonna go look at the Go standard library and see of a test." You realize that if you were writing the standard library, that would be a good place to go look for tests. But if you're writing an applicat... |
If you look at a project like Kubernetes, it's a little convoluted, but they have a good way of testing it. They have a great end-to-end set, and they have a great set of unit tests. And they're pretty religious about that. I'm not saying it's the right way, but if you wanna look for something that's better than the st... |
**Erik St. Martin:** Yeah, that's fair, because the standard library is gonna be mostly unit test style, it's not really gonna be end-to-end and integration tests where you have multiple components that need to be stood up and communicate with each other. |
**Bryan Liles:** Yeah. |
**Carlisia Thompson:** That's a very good point Bryan, because I have just started to realize a lot of the blog posts out there, a lot of the examples, a lot of the sample codes are applicable to libraries if you're writing a library; but if you're writing an application or an API, you have to do things a bit different... |
**Brian Ketelsen:** We need to take a break and talk about our next sponsor. Bryan, I'd like it if you just closed your ears for a moment, please? |
**Break:** \[54:25\] |
**Brian Ketelsen:** You can open your ears back up, Bryan. |
**Bryan Liles:** \[laughs\] You know, I will offer some commentary and they'll be very positive. I think a lot of developers need to understand this. Unless you own your company - I don't own my company; I just work there for a paycheck. I like to hear about all the stuff going on in our market. That validates that our... |
\[55:56\] I think that more people need to realize that you should champion yourself without trying to be a detriment to your employer, but realize that when push comes to shove, they're gonna push you off, because they need to win. A lot of people don't realize that - the allegiance is with yourself and with your fami... |
**Erik St. Martin:** But you already said that past Bryan is a jerk, so... |
**Bryan Liles:** Past Bryan is a jerk, but he's not here anymore, so we can talk about him. \[laughter\] |
**Erik St. Martin:** Past Bryan isn't here because he was a jerk. |
**Bryan Liles:** That's right. |
**Carlisia Thompson:** Talking about your company - how about the monorepo deal with DigitalOcean? Let's talk about that. |
**Bryan Liles:** Oh, I'll give you where that came from. We were doing Go; let's say I did start doing Go in the middle of 2014. We started doing Go, everybody started doing Go, but the problem is that we had our internal GitHub and then we had about 15 projects inside of there and actually making sure everything mount... |
I remember us talking about this in the fall of 2014, but then what happened is I ran into some Google people at a conference - it was Gotham Go - and I happened to speak there, and I said "I'm not gonna lose this chance to talk to Google people about, "How do you all do this? Because what we're doing makes no sense, a... |
We converted what we do at DigitalOcean and we created this thing called cthulhu. I didn't know what a cthulhu was, I had to look it up. I'm not quite sure I understand what it is now, but it's where our Go code goes. Really all it is, the monorepo is -- and we don't do it quite like other projects do it. We have two G... |
Back to Doge... A standard library in Go is actually pretty good, there's a lot of things in there. But unfortunately, it doesn't do a lot of things that we like to do. We're pretty deep in things like gRPC, we have the way that we log, we have the way that we do metrics... So what we did is we wrote another standard l... |
One day we might open source it; it's actually kind of neat the things we have in there. But what it allows us to do is you download the whole Go repo - it's like 200 MB, it's actually pretty big... But whenever you download it, you have the whole environment. The reason that I like it - and then I'll tell you the reas... |
Then when we reintegrate to master, we pretty much know if it's gonna work or if it's gonna fail; there's no guessing. And that's what I think is the real win, is that it takes the guesswork. We know if all our Go tests pass. The bad side is that yes, Go does compile quickly, but not if you have a metric crap ton of pa... |
**Erik St. Martin:** \[01:00:27.08\] I'm gonna go out on a limb and say that the name is Grand Test Auto, how's that? |
**Bryan Liles:** Yeah, we'll just say Grand Test Auto. It's a weird thing, developers... But I will say this, it's allowed us to move faster, but as we've grown to a hundred engineers, it's actually made things slower; integrating people into it, getting new projects started has been difficult. But one thing we've done... |
I will say this, you can explore the monorepo, but realize that it's not a panacea. Like having children - they're amazing when they come out, that first second, but for the next three weeks or three months they suck, because they cry all the time. \[laughter\] Then they get older and they're amazing again. That's abou... |
**Carlisia Thompson:** Do you ever talk about breaking it out? |
**Bryan Liles:** Some people talk about it, and I would say there are projects that aren't in the repo for reasons political or technical, but we're just trying to make sure that everyone keeps it in there for the greater good of the team; we keep all the Go in the same place. And you know, this is another thing that c... |
**Carlisia Thompson:** A question for you - what is your ratio of commits to merge conflicts? |
**Bryan Liles:** Merge conflicts? Never. |
**Carlisia Thompson:** Really? |
**Bryan Liles:** Never. No, we don't have merge conflicts. The reason we don't is because if you think about it, we have our standard library Doge, and then all the teams... So, in any particular section of the code, there might only be like 3 or 4 developers. It's not like everybody is in there, killing everything at ... |
**Erik St. Martin:** So the monorepo thing though - it's much more popular than people think, especially in bigger companies. My first exposure to it was working for Disney, which has a massive perforce server. And it had everything on there, and not just the division of Disney I worked for, but the artists, and things... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.