Dependency Injection in Go

  Рет қаралды 2,792

Adib Hanna

Adib Hanna

2 ай бұрын

Dependency Injection in Golang
Neovim config: github.com/adibhanna/nvim
Twitter: / adib_hanna

Пікірлер: 14
@fixer8173
@fixer8173 2 ай бұрын
In case you wonder if it is worth creating videos regularily, thanks for that a lot, your videos are super helpful and instructive, hope for many more ;)
@adibhanna
@adibhanna 2 ай бұрын
Thank you! It’s been difficult to stay consistent, but im glad to be back at it
@KuzyoYaroslav
@KuzyoYaroslav 2 ай бұрын
Great video. Could you explain please why constructor function always returns pointer ?
@EverRusting
@EverRusting 2 ай бұрын
I want to answer if I can, first of all, those are more like factory or generator functions, not constructors. Second, idk about Go but in C++ when you work with objects (or non primitive types), you usually want to pass the reference instead of the whole object. One reason for this is pass by value clones the entire object and also it's a different object every time because it's a clone. When you pass the pointer, it's the same object every time and in this case this is the desired outcome.
@gggalahad
@gggalahad 2 ай бұрын
​@@EverRusting Yeah but when I return pointer from function (method, constructor, whatever), doesn't it goes to heap? When I'm turning on gc in vscode or goland, it says that returned pointer goes to heap every time. And doesn't it means that garbage collector will do some work in the future, and doesn't it much bigger work than copy value from one stack frame to another?
@MyroslavSuprun
@MyroslavSuprun 2 ай бұрын
@@gggalahad I have started reading Learning Go v2 recently and the author says the same thing. If you pass a pointer, it goes to the heap, and most times it's better to pass value instead of a pointer. Unless it's a struct with a lot of values. A quote from the book: "Most of the time, you should use a value. Values make it easier to understand how and when your data is modified. A secondary benefit is that using values reduces the amount of work that the garbage collector has to do." But I still see that most built-in go packages return pointer instead of a value. Like gzip.NewReader, errors.New etc.
@TheMouseJerry-du1md
@TheMouseJerry-du1md 2 ай бұрын
Brilliant Video. Pls share more golang videos and most used patterns in real time production code and also how one can use external packages that contains interfaces and struct types and what and when we can initialise or embed the in our code? U got me subscribed with this one video and hoping to see more...
@adibhanna
@adibhanna 2 ай бұрын
thank you! planning to release a lot of Go videos
@Suraj-tz3oq
@Suraj-tz3oq 13 күн бұрын
What if i have multiple dependencies like db, external service, ... other dependencies and they are dependent interdependent as well
@ayoubelmhamdi7920
@ayoubelmhamdi7920 2 ай бұрын
you show us some codes, but the intuition is start from hello word to wrote all words, without autocompletions lile copilot.... using copilot ia the the teacher that use paper to vopy past in broad.
@lguedes768
@lguedes768 2 ай бұрын
font name?
@Tarekconqueso
@Tarekconqueso 2 ай бұрын
I believe that's jetbrains mono
@adibhanna
@adibhanna 2 ай бұрын
berkeleygraphics.com/typefaces/berkeley-mono/
@Suraj-tz3oq
@Suraj-tz3oq 13 күн бұрын
Ide?
Porting Neovim Keymaps To Zed
39:59
Adib Hanna
Рет қаралды 8 М.
Mastering Dependency Injection In Golang
14:29
Anthony GG
Рет қаралды 44 М.
THEY WANTED TO TAKE ALL HIS GOODIES 🍫🥤🍟😂
00:17
OKUNJATA
Рет қаралды 10 МЛН
3M❤️ #thankyou #shorts
00:16
ウエスP -Mr Uekusa- Wes-P
Рет қаралды 7 МЛН
Vivaan  Tanya once again pranked Papa 🤣😇🤣
00:10
seema lamba
Рет қаралды 27 МЛН
Dependency Injection на примере Uber fx | Эйч Навыки
17:43
Эйч Навыки — менторская программа
Рет қаралды 5 М.
10 AWESOME CLI TOOLS TO SUPERCHARGE YOUR WORKFLOWS
10:03
Adib Hanna
Рет қаралды 14 М.
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 756 М.
Trying Another Way... (Dependency Injection)
11:23
Davis Media
Рет қаралды 12 М.
THIS is the BEST Way to Write HTTP Services in Golang
13:53
Lua, the simplest language to learn
11:52
Adib Hanna
Рет қаралды 2,7 М.
Чистая архитектура проекта на Golang
58:22
Олег Козырев
Рет қаралды 35 М.
Why I Use Golang In 2024
9:21
ThePrimeTime
Рет қаралды 256 М.
Learn Dependency Injection and Write Better Code
21:52
Amigoscode
Рет қаралды 167 М.
Что не так с яблоком Apple? #apple #macbook
0:38
Не шарю!
Рет қаралды 241 М.
Хотела заскамить на Айфон!😱📱(@gertieinar)
0:21
Взрывная История
Рет қаралды 4,6 МЛН
1$ vs 500$ ВИРТУАЛЬНАЯ РЕАЛЬНОСТЬ !
23:20
GoldenBurst
Рет қаралды 1,4 МЛН