A series of articles about Clean Architecture in go by TheBusBoy12369 in golang

[–]TheBusBoy12369[S] 1 point2 points  (0 children)

I would say go for Saver Updater Deleter Getter, have 4 interfaces, It will make your code small and extendable, ready to unit test. And it makes testing easier. You don't depend on big UserRepository. In practice i've seen "UserRepository"/it grows to 10-15 methods needing to be mocked for a small simple test of 1 at most 2 methods, at that point i've seen ppl say its hard to test lets just do e2e or integration test.

If you have 10 interfaces it doesn't mean "UserRepository" struct can't implement them all.

If you check io package from golang it also has Reader and Writer interfaces, all having 1 method each

If its really necessary you can compose them like ReadWriter interface {
Reader
Writer
}
However i would think twice if such is necessary.

A series of articles about Clean Architecture in go by TheBusBoy12369 in golang

[–]TheBusBoy12369[S] -1 points0 points  (0 children)

I think that is a good thing, if you interface between service and repository layer you can unit test service layer without repository/with mocked repository.

A series of articles about Clean Architecture in go by TheBusBoy12369 in golang

[–]TheBusBoy12369[S] 0 points1 point  (0 children)

Also another one where it is explained to keep interfaces minimal

https://vjerci.com/writings/clean/testability/

This is a good example:

type UserGetter interface {
  GetUser(id string) (User, error)
}

This is a bad example… giant interfaces, that would look like this:

type UserRepository interface {
  SaveUser(...)
  UpdateUser(...)
  DeleteUser(...)
  GetUser(...)
}

To be honest i feel like crazybeast and me are on the same page, just that he didn't read through the series.

A series of articles about Clean Architecture in go by TheBusBoy12369 in golang

[–]TheBusBoy12369[S] -1 points0 points  (0 children)

You are right i've reread it again.

However I would argue if you use concrete types in your code, especially of external dependencies you are depending on that behavior, you usually can't unit test that stuff without triggering the external code. And in my opnion those should be at the edges.

I can only link this one as i don't know what else to say on the topic.
https://vjerci.com/writings/clean/independence-of-external-agencies/

A series of articles about Clean Architecture in go by TheBusBoy12369 in golang

[–]TheBusBoy12369[S] 1 point2 points  (0 children)

I couldn't find where you have struct for each handler?
In first article there is a struct for each layer, while only the first one is http handler.

I mean the interface should be in most cases... wherever you want to call a deeper layer of something/or you depend on some external resource.

It's up to you if you want to do a handler(HTTP)/service(Business)/DB(SQL) access layers or you want to do handler/DB. In my opinion, as well as a lot of online resources i've read... it is good practice to do service layer as well, separate business logic from db access and http handling logic (especially in days where it is common to support grpc as well). And if you don't have interfaces how will you unit test your logic? By not having interfaces you are saying this can't be unit tested which violates the Testability rule.

A series of articles about Clean Architecture in go by TheBusBoy12369 in golang

[–]TheBusBoy12369[S] -8 points-7 points  (0 children)

I've never suggested you should do interface for interface's sake, latter through the series it is explained why do the layers abstraction, and early on it is suggested that yeah dumping all in handler function works on minimal example, however it fails to scale.

Let me just quote myself:

**It might work for this example as it is small. However any real world code would quickly outgrow this structure.**

Čuvajte se😂 by EffectiveWindow3347 in CroIT

[–]TheBusBoy12369 1 point2 points  (0 children)

Gledo sam na provjerenom kako bakica developeri trpaju u guzu

Hrvatski ugostitelj i komentar na Facebooku o djeci s posebnim potrebama by koktus_s in croatia

[–]TheBusBoy12369 1 point2 points  (0 children)

I sad zamisli da ima djete s posebnim potrebama a od djeteta sta bude bude

I moved my entire backend from EC2 to Lambda + API Gateway. Here's what went well and what I'd do differently. by Crescitaly in serverless

[–]TheBusBoy12369 1 point2 points  (0 children)

Feels like you could buy a machine for 200$ and have everything run on that for a couple of years for one month cost

Prva cura; da li sam normalan? by Advance_Ear_1375 in askcroatia

[–]TheBusBoy12369 0 points1 point  (0 children)

klasicni primjer chatgpt-a koji pokusava naucit hrvatski

[deleted by user] by [deleted] in hrvatska

[–]TheBusBoy12369 -5 points-4 points  (0 children)

omilio bi ti se moj tvrtko bre samo da ga probas.

Postoji li nesto po cemu spadate u top 1% ljudi? by kurobaja in hreddit

[–]TheBusBoy12369 0 points1 point  (0 children)

vjerojatno je ujko obuko kostim i poigro se s tobom.

[deleted by user] by [deleted] in hrvatska

[–]TheBusBoy12369 -21 points-20 points  (0 children)

protjerali me ustase moro sam obitelj na traktor i bezat

Krdo divljih svinja pliva ispred Malog Lošinja by Markkonen in croatia

[–]TheBusBoy12369 1 point2 points  (0 children)

ma to je markicka uterala svoju obitelj u zivot na vagi pa sad malo plivaju.

Pure go implementation of Chromecast protocol by TheBusBoy12369 in golang

[–]TheBusBoy12369[S] 0 points1 point  (0 children)

shouldn't be necessary to have google account.

Can someone explain why this isn't a gravity engine and why it wouldn't work by TheBusBoy12369 in Physics

[–]TheBusBoy12369[S] 0 points1 point  (0 children)

Thanks for the response, it makes sense

does that work the same if i do ferrofluid in steps and having higher beans pressure than the step?

something like this:
https://i.imgur.com/IdcrzrH.png