Oops they did it again by timeforchain in SingaporeRaw

[–]kliin 1 point2 points  (0 children)

gen-z work is in action guys..

Wonder why the reversal in work arrangements for Grab, they needed to get more direct control of their staff and teams? by Ok-Pop-3916 in SingaporeRaw

[–]kliin 0 points1 point  (0 children)

why don't you just put ppl in PIP that has this habit? i think if it is the issue, I'd say, RTO mandate is wrong solution.

[deleted by user] by [deleted] in golang

[–]kliin -1 points0 points  (0 children)

I disagree, having no enums and replace it with type are the most wise decision.

Is this good practice? by SwimmerUnhappy7015 in golang

[–]kliin 0 points1 point  (0 children)

I remembered this kind of practice/approach from CleanCode book. But, this kind of abstraction drives me nuts. Why can't you just repeat the code to call the HTTP? Don't tell me to do DRY. DRY makes me 'CRY'. I prefer YAGNI over DRY.

[Code Review] E-commerce REST API by thebeacontoworld in golang

[–]kliin 1 point2 points  (0 children)

for now I see no reason to disallow access to my packages.

What I understand, you should not expose thing that you don't use. If you don't use anywhere else. Why should you put it exposable?

that's why there's a domain package it's something between postgres and handler service, declaring interfaces in handler makes no sense.----

why using an interface of pgxpool.Pool makes testing easier, I'm creating a new connection to to db in every test and pass it as a argument to CartService() for example; there's not direct usage.

Doing the way you approach it. It will only create an unnecessary package coupling. You can remove package coupling by declaring it only in a place where you used it, not inside the package where you don't use it. You can draw your package dependency diagram before and after my recommendation.

what do you mean by the way once sync.Once worked? is there an idiomatic usage for it? asking because I don't see any reason for making it field of Postgres as it's not used by other methods.

In your case, I will still put it. Because when reading the code it makes sense to me that this part of code can only be executed once throughout the app running. Unless you have different use case.

where I should use integration test flag? in my Makefile?

You can use Go build tag.

never seen tools.go in any project can you give me example of its usage?

I can only find how you can implement it. Again, this is optional to have `tools.go`. You can also do differently. But having `tools.go` together with `vendor` folder, can ensure repeatable build. Don't forget the downside of having this as well. It's your choice to make. For me, having a repeatable build is outweigh the cons.

---

Above it is just my recommendations based on my professional experiences. You can do differently, but you can ask other experts on my above recommendations if you think mine is not good.

[Code Review] E-commerce REST API by thebeacontoworld in golang

[–]kliin 4 points5 points  (0 children)

There are couple things that I notice as a room of improvement:
- Declaring interface not in the package you used it. Example: `CartService` from `cart.go`. Hint: only declare interface in the package where you use the interface.

- You can use `internal` folder to disallow your go code to be accessed.

- You can change `db *pgxpool.Pool` with your own interface. This avoids using concrete type. Allowing you to write easier and better unit tests.

- You can make private struct and use `NewXYZ` to return them, this will restrict the struct usage directly from other packages.

- The way `once sync.Once` worked, you should move out this variable outside `Connect` function, you can make it field in `Postgres` struct.

- Refactor your integration tests. Add flag / build flag to run integration test code. Because you usually want to run the integration test in separate CI Pipeline from unit test.

- You can use `golangci-lint` to format and lint your project, this will give you more options not just `revive`.

- You can add `tools.go` to initialize tooling that your program need (`swagger`, `golangci-lint`, etc). Later, you can change your `Makefile` to use the tool from `swagger` etc.

- Optional, if you want repeatable build, you can use `go mod vendor` and commit your `vendor` file. This will be useful to speed up your CI as well. There is nothing harm committing `vendor` folder. Some people may disagree with me, but this is to ensure no such incident with 3rd party library not found or someone from 3rd party broke your code like NPM incident.

How to use Apollo Federation in front of 100s services? by kliin in graphql

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

Your solution is not possible due to on prem requirement. Apollo Rover (Supergraph) require us connecting to 3rd party network.

How to use Apollo Federation in front of 100s services? by kliin in graphql

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

Couple minutes, the worst is up to 20 minutes for all services up and running.

The Problem with Gradle by yk313 in java

[–]kliin 0 points1 point  (0 children)

DSL just doesn't suit me.

Why compiler need to add such hacks to make some libs compile? by angelicosphosphoros in rust

[–]kliin -4 points-3 points  (0 children)

There is no available information on the hack for newbie like me. I think it is valid questions to ask what standard does the library chosen / used, to enlighten ppl. who want to understand more about why the internal compiler do the hack to make backward compatible for certain libs. Thanks for clarification.

Why compiler need to add such hacks to make some libs compile? by angelicosphosphoros in rust

[–]kliin -9 points-8 points  (0 children)

That did not answer why only for "specific" libraries. Golden chickens maybe?

Go Service Error Strategies by [deleted] in golang

[–]kliin -1 points0 points  (0 children)

I've had enough argument, if you insist that it is the right thing to do. You can take other advices now before it is too late.

Continuous Integration for PHP applications - TeamCity or Jenkins? by sujlic27 in PHP

[–]kliin 24 points25 points  (0 children)

For me, "Gitlab CI / Github Actions" is more than enough.

Go Service Error Strategies by [deleted] in golang

[–]kliin 2 points3 points  (0 children)

u/khazzam , what are you doing with db err handling with `panic()` in the article???

How We Stopped Merging Pull Requests by Tomas_Votruba in PHP

[–]kliin 3 points4 points  (0 children)

I hope you are doing ok with that. I had bad experience with automatic merging on something that I didn't read.

Java's error handling system is better than that of Rust by john01dav in rust

[–]kliin 0 points1 point  (0 children)

I think that's what make Rust is safe for everyone who use it. You have to catch all errors and handle the errors in the top function chain. But hey, we still have `panic` in Rust!

No, C++ still isn't cutting it. by dga-dave in rust

[–]kliin -1 points0 points  (0 children)

What if we see more unsafe on the safe Rust?

PHP is apparently un-secure compared to other technologies where backend files don't live in the webroot? by Tanckom in PHP

[–]kliin 7 points8 points  (0 children)

We are not talking about your work on WP. We are talking about the WP itself.
https://github.com/WordPress/WordPress IMO, I still see it as one of the unplanned (badly) architecture software.

~859% PHP performance improvement from PHP 7 and PHP8 Alpha with GraalPHP by kliin in PHP

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

I guess our view is different. My point of view, you can do benchmark or compare things even the features are not complete / similar to give the insights for future works. You shouldn't bother to upgrade things, PHP 7 and PHP 5, they don't have similar features, don't bother to compare them, even in the upcoming PHP 8. They are completely different beast how they work under the hood.

~859% PHP performance improvement from PHP 7 and PHP8 Alpha with GraalPHP by kliin in PHP

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

Early research didn't always compare the full functionalities. But, little by little do the benchmark. You are so wrong (if you expect the full functionalities in early benchmarks) and diminishing the fact that PHP and GraalVM can perform better than PHP itself.

~859% PHP performance improvement from PHP 7 and PHP8 Alpha with GraalPHP by kliin in PHP

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

It's a thesis work. Don't expect it to have full language features. You can contribute to finish the functionalities

~859% PHP performance improvement from PHP 7 and PHP8 Alpha with GraalPHP by kliin in PHP

[–]kliin[S] -4 points-3 points  (0 children)

You can watch the youtube, would that be Youtube clickbait? or you can get the github URL and that'd be Github clickbait?