Trying Another Way... (Dependency Injection)

  Рет қаралды 13,833

Ben Davis

Ben Davis

Күн бұрын

NOTE: Before or after watching this video I HIGHLY recommend you read over the FX documentation. FX is weird, and while a video will help you get the idea of what it does, nothing can replace actually doing it. It is a stupidly useful package, but its up to you to learn it!
FX: uber-go.github...
Source Code for Example: github.com/bmd...
This video goes over an example of how one could structure a GoLang backend. This is not the only way to do it, nor is it objectively the best way to do it, but it does solve the problem. This is part of the ongoing SvelteKit + GoLang series.
🚀 DEPLOY YOUR BACKENDS 🚀
[Railway](railway.app/?r...)
My Socials
🐦 [twitter]( / benjamin41902 )
📷 [insta]( / bmdavis419 )
💾 [github](github.com/bmd...)
My Companies
📈 [insiderviz](www.insiderviz...)
📅 [BLOK](www.theblokapp...) (coming soon)
#golang #programming #engineering

Пікірлер: 23
@Cheun-b4q
@Cheun-b4q Жыл бұрын
Your struggle is literally my struggle. I can not find a life of me create a backend architecture I’m satisfied with
@arthuralvespsy
@arthuralvespsy Жыл бұрын
Hey Ben first of all, thank you about the video, I had some experience using the FX and for the specific project that I was working this looked like a Bazooka because behind the scenes it's using signals in a pool of objects inside the Context.
@themarksmith
@themarksmith Жыл бұрын
Top quality video Ben
@catalinim4227
@catalinim4227 Жыл бұрын
tech school has a really good series on microservices. I use that structure for all my go projects
@coffeeintocode
@coffeeintocode Жыл бұрын
Nice 👌 never seen FX in use actually. Agreed though, lack of convention/opinion in Go is both a blessing and a curse
@duongphuhiep
@duongphuhiep Жыл бұрын
Greate video, I didn't know this Fx library until now. As a C# developer. I remark a difference between this "Go Fx/DI" and "C#/DI". In C#, Java, we also use the DI framework to manage the "objects life cycle". For eg, when you "register" (or "provide") a "NewUserStorage", you will have to declare the "life time scope" of the "UserStorage" object after it is created. In C# the life time can be "singleton", "scoped" or "transient". * When you provide(NewUserStorage, "singleton") then the NewUserStorage() function would be called only once, then the created object "UserStorage" is re-use until the end of the application. * When you provide(NewUserStorage, "transient") then the NewUserStorage() function would be called each time a consumer need to resolve a "UserStorage" The Fx docs did not mention what is the life time scope of the provided object (I suspect that they are all transient?..)
@JohnDoe-ji1zv
@JohnDoe-ji1zv Жыл бұрын
Been using this for quite some time, and I would say that’s the way to scaffold servers or anything else in golang. Uberfx ftw
@SR-ti6jj
@SR-ti6jj Жыл бұрын
This is dope, very C#-esque
@ivan-penchev
@ivan-penchev Жыл бұрын
As an ex-C#er any time I see something like this I am remind of the talk by Dave in Gophercone on " Clear is better than clever "
@anselminos5238
@anselminos5238 Жыл бұрын
been using fx for a few months, i think it is great for dependency injection, although i wish it wouldn't log as much as it does by default.
@Rgotto2
@Rgotto2 10 ай бұрын
Interface closures are nice as well.
@주영이-x3y
@주영이-x3y Жыл бұрын
nice video :) I have a career in Python and Java, and I honestly prefer the DI (Dependency Injection) pattern. Recently, I've been studying Go and it seems there's a lot of discussion about the DI pattern in the Go community. I have a question regarding this. When using frameworks or libraries that support the DI pattern in runtime environments like fx, dig, as far as I know, it involves using reflection, which I heard is an expensive resource in Go. I'm curious about what advantages you've gained using fx, compared to the aforementioned disadvantages.
@jeheskielsunloy3881
@jeheskielsunloy3881 Жыл бұрын
hey nice video mate, I was just wondering what is your vscode theme? i kinda like it
@bmdavis419
@bmdavis419 Жыл бұрын
GitHub dark
@josephmartin6219
@josephmartin6219 Жыл бұрын
You earned a sub man, thanks alot and please whats the name of the vscode font please, thank you!
@manee427
@manee427 Жыл бұрын
Thanks which software you use for drawing ? I mean the online app that can write like handwriting :)
@bmdavis419
@bmdavis419 Жыл бұрын
excalidraw
@manee427
@manee427 Жыл бұрын
Thanks and nice channel . keep going @@bmdavis419
@DevlogBill
@DevlogBill Жыл бұрын
Hi Ben, I have question? What backend technology would you recommend for me? I am from NYC so I have a good selection. I have about 1 year and a half experience in programming. Did 8 months in web development with HTML, CSS and JavaScript and very little experience with React. But I also have experience with Django and I am already making API's and I made 2 CRUD apps. But I am thinking about switching from Django to something else, there are hardly no jobs for Django. I check on indeed and I only see 2 or 8 jobs tops on a good day. Is Golang easy to pick up? I am assuming if I have already some very basic skills in a backend framework I hope learning another backend framework or library won't be as difficult. I would appreciate any recommendations, thank you.
@bmdavis419
@bmdavis419 Жыл бұрын
Its a borderline impossible question to answer, but I would say that if you are looking for a job TypeScript is gonna be your best bet. While I personally prefer Go, it has less jobs, and a smaller ecosystem, making TS both easier to pick up, and easier to get hired for. Once you learn TS though it is VERY easy to learn Go, C#, or any other high(ish) level language for BE. The concepts carry over nicely (REST, HTTP, SQL, etc)
@cariyaputta
@cariyaputta Жыл бұрын
What's the font you are using?
@bmdavis419
@bmdavis419 Жыл бұрын
Jetbrains nerd font mono
@esser50k
@esser50k 5 ай бұрын
do not use fx, please no. Dependency injection is a terrible idea. It breaks golang in so many ways. First you lose the compile time dependency checks, so it might compile and still not run. You might have code that is not even used. Go would usually catch that because you’d be initialising something and not using it. With fx you also lose that. Everything is a singleton, so to instantiate more than one object of the same type you have to wrap it in some bullshit.. You totally lose sight of where your dependencies are coming from for your other constructors. I think it’s embarrassing for uber to put their name behind this shitty library. Just use plain go if possible. So much easier to just walk through your entrypoints, just a map from URL to handler and you build the app from there.. simple
I want to use Go, but I'm not going to.
18:31
Ben Davis
Рет қаралды 33 М.
Mastering Dependency Injection In Golang
14:29
Anthony GG
Рет қаралды 49 М.
Which One Is The Best - From Small To Giant #katebrush #shorts
00:17
Spongebob ate Patrick 😱 #meme #spongebob #gmod
00:15
Mr. LoLo
Рет қаралды 20 МЛН
Minecraft Creeper Family is back! #minecraft #funny #memes
00:26
Dependency injection in Go  / Дмитрий Дорогин (ozon.ru)
32:33
Goroutines Crash Course (Mutex, Channels, Wait Group, & More!)
15:42
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 831 М.
[Golang] Dependency injection with Fx
33:10
Panpito
Рет қаралды 8 М.
How and Why I Rebuilt my SAAS App
13:24
Ben Davis
Рет қаралды 21 М.
Svelte 5's Secret Weapon: Classes + Context
18:14
Huntabyte
Рет қаралды 21 М.
Dependency Injection на примере Uber fx | Эйч Навыки
17:43
Эйч Навыки — менторская программа
Рет қаралды 6 М.
Dependency Injection in Go
11:19
Adib Hanna
Рет қаралды 4,2 М.