Software Engineering Made Easy
Software Engineering Made Easy
  • Видео 10
  • Просмотров 39 235
Design patterns for microservices in Go (Part 1)
In this video I'm showing how you can improve your Golang code structure to pass from a mess in a single file to a fully-working MVC pattern.
In part 2 we're moving from MVC to Clean Architecture.
As always, let me know anything I can help you with and I'll be more than happy to create content about those topics.
To find more information about this and a lot more, you can always visit federicoleon.com/blog/
Fede.
Просмотров: 3 565

Видео

gRPC types and how they work
Просмотров 3444 года назад
In this video I'm presenting the different types of communication that you can choose from when implementing gRPC on your infrastructure. Source: grpc.io/docs/guides/concepts/ Hope you'll like the video! If you do, make sure you subscribe to the channel where I'm constantly working on all of the questions I get. Fede.
How to build your microservices architecture in AWS
Просмотров 6434 года назад
In this lesson we're taking a look at one alternative that you have to design and build your microservices infrastructure in AWS. Site post: federicoleon.com/how-to-model-infrastructure-for-microservices-in-aws/ Hope you'll like the video!
Introduction to pointers - Golang Tutorial
Просмотров 7624 года назад
In this lesson we're going to take an introduction to pointers (you should read about them in the Golang Tour) by using them in different types of problems we want to solve. Github repo: github.com/federicoleon/golang-examples/tree/master/pointers If you want to go deeper into the language and other Software Engineering aspects: federicoleon.com/ Of course, if you need anything from me, just le...
How to write code that you can mock and test - Golang Tutorial
Просмотров 13 тыс.4 года назад
In this lesson and tutorial we're looking at how you can write both testeable and mockeable code in Go by using methods and interfaces instead of just package functions everywhere. Github repo: github.com/federicoleon/golang-examples If you want to go deeper into the language and other Software Engineering aspects: federicoleon.com/ If you have any questions or comments, please let me know so I...
How to build a REST microservice in less than an hour - Golang Tutorial
Просмотров 4,1 тыс.4 года назад
In this video I show you how you can create a new microservice in Go in less than an hour! We'll using gin-gonic as the core HTTP framework and building this moving from a basic example in a single file to a fully functional Model-View-Controller implementation. Gin-Gonic framework: github.com/gin-gonic/gin Github repo: github.com/federicoleon/golang-examples If you want to go deeper into the l...
How to test functions with timeout - Golang Tutorial
Просмотров 1,5 тыс.4 года назад
In this video I'm covering how you can test functions that could timeout by relying on buffered channels and goroutines. If you want to go deeper into the language and other Software Engineering aspects: federicoleon.com/ Thanks for watching!
How to benchmark in your Go tests - Golang Tutorial
Просмотров 1,1 тыс.5 лет назад
In this video I cover the very basic concept of benchmarking in Go tests without getting too deeper in things like bench configuration or reseting timers so you can have a strong idea of the benchmarking concepts. Hope you like the video! If you want to go deeper into the language and other Software Engineering aspects: federicoleon.com/ Thanks for watching!
How to mock in your Go tests - Golang Tutorial
Просмотров 13 тыс.5 лет назад
Since the most asked feature this week was mocking, here I show you how you can take advantage of structs and interfaces to mock any artifacts you might be using. GitHub repo: github.com/federicoleon/go-testing Hope you liked the video! If you did, please like and subscribe to get new videos as soon as I upload them! If you want to go deeper into the language and other Software Engineering aspe...
How to test in Go (introduction) - Golang Tutorial
Просмотров 1,2 тыс.5 лет назад
In this lesson we're taking care of a huge topic in Go: testing! Github repo: github.com/federicoleon/go-testing If you want to go deeper into the language and other Software Engineering aspects: federicoleon.com/ Hope you liked the video! If you did, please like and subscribe! Much more coming up.

Комментарии

  • @selvamp5775
    @selvamp5775 4 месяца назад

    Excellent 👌

  • @akshaydas5519
    @akshaydas5519 4 месяца назад

    This video is a masterpiece

  • @kanikasinghal1192
    @kanikasinghal1192 7 месяцев назад

    I am getting goleak error : Errors on successful test run: found unexpected goroutines:

  • @KaushikMitra-g2u
    @KaushikMitra-g2u 7 месяцев назад

    Truely awesome explanation !

  • @anishsuman1371
    @anishsuman1371 2 года назад

    What an explanation

  • @anthonyhernandez3005
    @anthonyhernandez3005 2 года назад

    this is Gold

  • @Crowmwellz
    @Crowmwellz 2 года назад

    Thx for the video Bro, it was really helpful. Please keep doing more videos like this !

  • @salahfarzin3554
    @salahfarzin3554 2 года назад

    How to write code that you can mock and test Thanks, really great 😍

  • @ioannissavvidis3696
    @ioannissavvidis3696 2 года назад

    Brilliant!

  • @ecesagar
    @ecesagar 3 года назад

    Very good explanation.. , in the Ping_service.go if PingServiceImpl has some struct variable and that used inside HandlePing(), and the sturct variable intiialization happens in ping controller, then it overrides the mock. how can we achieve in this scenario ?

  • @rajendragosavi2233
    @rajendragosavi2233 3 года назад

    Hands Down. Superb Stuff. Can you provide tutorial for - ginkgo with couterfeiter mocking ? Thanks

  • @ArjunTiwari91
    @ArjunTiwari91 3 года назад

    Hi I am getting missing calls to mock controller error

  • @georgiyyamov5827
    @georgiyyamov5827 3 года назад

    Great video. Minor nitpick - your isPalindrome function will fail for UTF string. When working with strings only range operator respects runes

  • @heathkuntz8638
    @heathkuntz8638 3 года назад

    I have to say that is one of the best, usually the tutorials won't get too complicated on testing, but then are impractical as my code is complicated to test. Very good job, learned a lot!

  • @dita0322
    @dita0322 3 года назад

    Qué pasó con la segunda parte?

  • @pravinranjan
    @pravinranjan 3 года назад

    Here, actually you are testing a mock method. Not actual method.

  • @chandansingh-dd5fj
    @chandansingh-dd5fj 3 года назад

    What if my stuct is not empty, means pingserviceImpl has some data like string or int. Then how we handle it ??

  • @pmirji02
    @pmirji02 3 года назад

    Thanks for this content. It is very good. Question though - I see a lot of Go projects having directory structure with 'pkg', 'cmd', 'api'....etc. The one you have shown here is great too but it seems it aligns to Java project style. I just wanted to get your views on this. Please continue posting more videos like these ones which are close to production quality and close to real world scenarios.

  • @khebchiabdallah7445
    @khebchiabdallah7445 3 года назад

    Thanks looking forward for part 2

  • @paruliano
    @paruliano 3 года назад

    Cool. Your explanation very easy to apply. It's very good and excellent. Subcribed. Thanks.

  • @funnyhere
    @funnyhere 3 года назад

    great vid!

  • @ramdittakavi
    @ramdittakavi 3 года назад

    Thanks a lot for the video. But, as someone rightly pointed out I would want to see how I can mock string_utils function inside IsPalindrome() because in reality we will be writing test case for IsPalindrome() function which is our implementation. So, why bother mocking that? We have to mock it's dependencies right?

  • @mistertwister8500
    @mistertwister8500 3 года назад

    this is soo complicated and convoluted.. There's gotta be an easier way of doing this, no?

    • @z.m.4331
      @z.m.4331 3 года назад

      The mocking functionality of the testify package

  • @dasgoll
    @dasgoll 4 года назад

    Man! I've learned a lot from this video. Thank you Federico :)

  • @SirRFI
    @SirRFI 4 года назад

    Should "getter" methods like "GetUpdatedStatus" be "value receiver" (get a copy of user) rather than "pointer receiver"? While we're not modifying the internal state of user, we're doing copy of it for nothing. In other words - is there a specific reason to not use pointers for "getters"?

  • @ignaciosuarez9265
    @ignaciosuarez9265 4 года назад

    One question here!, Why are we using Var instead just declaring type PingServiceImpl stric{}?

    • @christiangda
      @christiangda 4 года назад

      It is because he is overwriting this var (service.PingService) into the test (TestPing() function) with the Mock into controller package

  • @СохибЕкубов
    @СохибЕкубов 4 года назад

    Nice one

  • @sajithp2453
    @sajithp2453 4 года назад

    Thanks for the video, but what we are trying to achieve here. func TestIsPalindromeWithMock(t *testing.T) { StringsService = &serviceMock{} isPalindromeFunction = func(t string) bool { return false } assert.False(t, StringsService.IsPalindrome("ana")) isPalindromeFunction = func(t string) bool { return false } assert.False(t, StringsService.IsPalindrome("ana")) } by doing this we are mocking the string_service? what we wanted is mocking the string_utils

  • @shakilmakram6923
    @shakilmakram6923 4 года назад

    very clean explanation

  • @AmolGautam
    @AmolGautam 4 года назад

    great work , thank you.

  • @guptaachin
    @guptaachin 4 года назад

    you are the boss.

  • @rinosukmandityo6448
    @rinosukmandityo6448 4 года назад

    Nice video and I get some insight from your video. But I think if you want to do a unit test for a service you don't need to mock that particular service,, what you need to do is only mock the string_utils function. You can create factory method to replace IsPalindrome() function inside string_utils package

  • @IndiaThatIsBhaarat
    @IndiaThatIsBhaarat 4 года назад

    Purchased your Udemy course on microservices as well!! But where is the clean architecture tutorial? Please share that!!

  • @panagiotisgeorgiadis1692
    @panagiotisgeorgiadis1692 4 года назад

    Excellent knowledge transfer skills! Is there any chance to continue this by introducing GoMock framework and Ginkgo on top?

  • @IvanHerdianSaputra
    @IvanHerdianSaputra 4 года назад

    I found the proto file provide the interface and what response what client can see (I think it is defined in protobuff file). Is this the domain layer defined inside that file?

  • @neider4001
    @neider4001 4 года назад

    Holal fece, espero la segunda parte

  • @TenderBug
    @TenderBug 4 года назад

    Awesome video contains a lot more than what the video title says. Thank you!

  • @davudsafarli5356
    @davudsafarli5356 4 года назад

    Hi, thanks for the tutorial. Great job! I have one problem though. What if out controller methods have 4-5 dependencies on other services? Like: type controller struct { configService ConfigServiceInterface cacheService CacheServiceInterface } Should i create a mock struct for each service ? If yes, then, where should i put the code for MockConfigService and MockCacheService structs ?

  • @maei1140
    @maei1140 4 года назад

    great, thank you very much!!

  • @maei1140
    @maei1140 4 года назад

    thx federico. I enjoyed watching the course on udemey too.

  • @alexanderbryksin8976
    @alexanderbryksin8976 4 года назад

    Hi Fede, awesome guide, big thanks :) can you please explain right way to use dependency injection here, i mean for example we have to inject user_service into user_controller, does right way to do it - create interfaces for services and use it in controllers structs ? like that: type UserController struct { userService interfaces.UserService } type UserService interface { Register() }

  • @hagiwararyunosuke3371
    @hagiwararyunosuke3371 4 года назад

    Hello Looking forward to the next part 2. Any chance to get a "Hexagonal architecture" example, with test ? All the bests during this easter holiday !

    • @SoftwareEngineeringMadeEasy
      @SoftwareEngineeringMadeEasy 4 года назад

      Hi there! Let me work on that and I'll get back with this content. Both clean and hexagonal work really good with Go since they provide a clean way of dependency injection via interfaces. Thanks for the comments!! I'm always listening for topics and providing content about what people are struggling with. Make sure to subscribe to the channel to keep having updated content. Fede.

    • @hagiwararyunosuke3371
      @hagiwararyunosuke3371 3 года назад

      @@SoftwareEngineeringMadeEasy hi any news about that topic

  • @memonauta
    @memonauta 4 года назад

    Dude, I had never seen such quality during a presentation. Do you have any course in any platform?, if you have a go course with the same quality I would buy it without any hesitation.

    • @SoftwareEngineeringMadeEasy
      @SoftwareEngineeringMadeEasy 4 года назад

      Oscar! How are you?? Thank you very much for taking a few minutes of your time to leave such a comment. Really appreciated! Take a look at my website federicoleon.com where I have lots of things. If you like what you're looking, make sure you subscribe to the channel. I'm always posting new content! Hope you're healthy and safe! Fede.

  • @hagiwararyunosuke3371
    @hagiwararyunosuke3371 4 года назад

    Hello Federico awesome, thanks for the great explanation and the examples

  • @hagiwararyunosuke3371
    @hagiwararyunosuke3371 4 года назад

    Hi, humble request: do we have any chance to get a TDD real world like microservice done in go ? I just bought one of your course in udemy. I'll "mock" it and learn while watching ! Thank you very much for your contribution.

    • @SoftwareEngineeringMadeEasy
      @SoftwareEngineeringMadeEasy 4 года назад

      Hi there! Of course, I'll make sure this is published in these days. Thanks for the suggestion!! Make sure you subscribe to the channel to keep having content like this. Fede.

  • @hagiwararyunosuke3371
    @hagiwararyunosuke3371 4 года назад

    Hello, thanks for your golang videos tutorials. Question: isn't there already a default execution timeout available in the golang test package ? Is this way of manually adding a timeout to a test a standard one ? Thank you once again.

    • @SoftwareEngineeringMadeEasy
      @SoftwareEngineeringMadeEasy 4 года назад

      Hi there!! Yes, there is a default timeout of 10 minutes. You can change this by adding -timeout flag like this: go test -timeout 30s Anyway, these are 2 different things. The one I'm talking in this video is about testing functions that should return in less than a given amount of time. The one you asked is about configuring a timeout for your test case. Two different things. Let me know anything I can help you with! Fede.

  • @hagiwararyunosuke3371
    @hagiwararyunosuke3371 4 года назад

    Thank you very much for your go tutorials. I'm looking forward to watching the other ones.

    • @SoftwareEngineeringMadeEasy
      @SoftwareEngineeringMadeEasy 4 года назад

      Thanks!! Really appreciated. A lot of new content is coming your way! Make sure you subscribe to the channel. Fede.

  • @raulbrindus3072
    @raulbrindus3072 4 года назад

    Great video Federico as always, looking forward for part 2. Thank you for taking the time to make these videos, they are really helpful.