GopherCon 2018: Kat Zien - How Do You Structure Your Go Apps
HTML-код
- Опубликовано: 3 июн 2024
- How should I structure my Go code?” is probably one of the most commonly asked questions, by new and experienced programmers alike. There is almost always more than one answer and it can be tricky to decide what will work best.
Should I keep all my files under one directory or should I split them up? How should I divide my code and into what packages? Can I write object-oriented code in Go? Why do some projects have a cmd directory and what is the advantage of that?
In this tutorial session, Kat will aim to answer those questions and give you an overview of common design patterns and best practices to make your projects testable, maintainable and easy to understand. - Наука
0:00 Intro
7:00 Start of example projects
8:05 Flat structure
10:12 Layered architecture (group by function)
14:25 Group by modules
16:24 Group by context
26:54 Hexagonal architecture
36:09 Frameworks
38:05 Testing
38:38 Naming
40:23 Review
One of the best talk i've ever seen in my life. Very clear explanation, thank you!
Excellent. We could use more talks on how to organise code in larger projects as most examples never get to the kind of complexity where architecture, interface design and import structure actually start to matter.
Great talk, really helpful to understanding the different approaches. It really does depend on the use-case!
Great Talk on Folder Structure! Really helped me. Go Go Golang!!!
Great talk! Thank you very much for putting this together. This is quite helpful to this "new gopher".
Thank you for putting this talk together!
Getting started with GoLang and this is golden ! thanks much Kat !
One of the best talks I've ever seen. Thank you!
Very useful talk! Which approach you use depends entirely on the size and condition of the project but I think that hexagonal architecture can be more better for me. Thank you for everything Kat😊
Great talk!
Excellent Talk! Thank you!!
Great presentation. Thank you.
just put your code into packages with well defined purpose and context (no 'adding' package which shares both beer and review for some stupid reason). Have you seen any package in standard library that were grouped by 'adding' or 'listing' function? Why the hell I should even do that? Just code packages, don't try to do any fancy structure, it's all bullshit that based on no foundation at all.
great talk, thanks!
thank you!
Amazing talk !
nice talk, thanks
Excellent...
How to avoid the init()? Even in testing func, we have to init the server and db to test. How to avoid in this case?
Great talk.
Thanks a lot ...
Links in the description would be awesome
@@dn5426 404
awesome
thank. you.
This was really helpful for me, thanks! Also, it's always great to see another woman developer nailing it!
I'll stick with flat for a while!
Good talk, but DDD is actually Domain Driven Design (not Development) and it was defined, coined and popularized by Eric Evans (not Vaughn Vernon).
See minute 16:28
👏👏👏
Good talk, although one small correction DDD = Domain Driven Design (not development), it was proposed by Eric Evans.
Using ports&adapters vs other clean designs and packaging-by-feature vs packaging-by-layered-feature is still a topic that brings controversies within teams, in a way my gut is that programmers embrace them while coders are scared of/confused by them.
Hexagonal hell. 13 folders to keep 17 files. 😅
This video is supported by beer reviewed research.
who has the girl's twitter? need more.
@kasiazien (at the end of the talk)
The talk was OK. Extreme over complicated and messy project structures. The best thing with Go is that Go is simple, let's keep it simple! There is no point in structuring a Go project as a Java enterprise application or a .NET project. I keep the structure of my services as simple and flat as possible.
i think she was pretty clear on "don't overcomplicate if you don't need to"
Even in the book: learning-go-an-idiomatic-approach makes a reference to this video. She knows what she said.
Useful talk. But please, PLEASE stop with those absurd GIFs. They are very distracting and unprofessional.
lighten up
live a little, dude.
imo the only thing wrong with GIFs is if they stay on the screen for too long while talking, like here. In that case, yeah, they're pretty distracting. But nothing wrong if you're only gonna keep em up for a few loops.
@@HanifCarroll Why do it in the first place? It looks unprofessional and is of no value.
She can’t open a terminal in vscode wow
The moment she couldn’t open the terminal I stopped!!
I think she didn't help true beginners because she wanted to sound smart.
?
She talks about the different styles of file structures, but not how one would run/build those different structures, such as go run *.go etc
@@randydiaz7664 Hey Randy, thanks for your feedback. In all honesty, "how you run go apps" is a separate topic and slightly outside of the scope of this talk which was focused on the structure (and strictly limited to 45 mins). I do have a more beginner friendly talk where I talk about running go apps, the GOPATH and so on which I gave at Scotland PHP earlier this year, and I'd post a link to it but the videos are not up yet. Either way, you comment made me laugh as sounding smart is definitely not why I give talks. Far from it, most of my talks is me sharing what I found so far as a beginner with other people, be it performance optimisation or DDD :)
Hello real world
Great talk!
awesome