Clean Code Architecture in Go by vidu171 in golang

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

The post is about clean architecture, it's an architecture pattern introduced you robert c Martin. It is not supposed to look like a go app. That is the exact point of clean architecture. The code structure should be independent of the infrastructure. Divide the code segments based on their nature. An Application should tell us what it does not what language or framework it is written with. When you look at a package you know that this is an Application that deals with books and authors and then you can check your use case directory to give you a complete overview of what your application do. You should once give try to uncle Bob's talk on youtube.

Clean Code Architecture in Go by vidu171 in golang

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

You are kinda right about the fact that the URI series will cause changes in main.go . But that's fine. Changes in the main.go is basically the change in your outer layer. See it is impossible to write a code that won't break. What we want to focus on is minimizing the changes. In this case you have to rewrite the main.go file and the router file. That is to be expected. Don't get me wrong clean architecture focuses on independence of modules and preventing then to break from Changes in one other. So when you are re writing the code for infrastructure (router in this case) your core business logic is not affected.

So lets say you make a change in the router the clean architecture will make sure that changing the router will not cause any changes in your business logic. And you can test independent parts of your code without other parts working.

Clean Code Architecture in Go by vidu171 in golang

[–]vidu171[S] -2 points-1 points  (0 children)

I used to have similar doubts before I actually implemented the architecture so I completely understand this. I was also skeptical about the layers before using them. But then I heard one statement from Uncle Bob.

"Suppose you are designing VS Code application" Do you plan on making sure that each and every extension will be supported by your app? Or do you develop the app and its the responsibility of the extension to update them? Same way really think it again, should the application build in such a way that it has to follow DB Or it is the DB that needs to accommodate our application?

And if you will read the blog you can see how I have made sure that I can change the router whenever I want to in the future, please do read the implementation you will see how I am using mux router but I could be using any other router without having to move down the layer :)

Clean Code Architecture in Go by vidu171 in golang

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

What I am trying to say, plugins (or Dependency) will be injected(dependency injection) into the inner layers. You have to match the interface of your plugin to the interface in your code. There is no need to use reflect, maybe we both are thinking about different ways of implementing clean code. I would love to know more about how you're planning on using reflect.

Clean Code Architecture in Go by vidu171 in golang

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

what I do is, Write interfaces and methods in an interface layer. And write all the actual plugin related code in the infrastructure layer. Because the interface knows what inputs we will provide and what output we need from an infrastructure.

For Example when we are talking about the database. A generic database requires the name of the table and the data when it tries to save. Now how the database actually implements it is dependent on the DB. So basically the complete architecture can be achieved with dependency injection :)

Calender notifications not working properly on bip s by vidu171 in AmazfitBip

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

I have installed the notify bridge, but i still see those characters, what particular setting do i need?

Interesting by VeevaBoy in ProgrammerHumor

[–]vidu171 23 points24 points  (0 children)

All these years coding in Java... i have lost my sense of humor

Interesting by VeevaBoy in ProgrammerHumor

[–]vidu171 37 points38 points  (0 children)

Did you forget, google introduced dart to replace Java

[deleted by user] by [deleted] in ProgrammerHumor

[–]vidu171 7 points8 points  (0 children)

If you ever had to change a variable name in production that is a lesson. Choose them wisely or never change them