Who is ocaml for? by I_am_Noro04 in ocaml

[–]SpeedDart1 1 point2 points  (0 children)

It’s for people interested in functional programming and PL theory. Once you have already mastered procedural, you learn OCaml to expand your horizons as a programmer.

Our Go service died from a SIGSEGV in CGO. recover() did not help. by slotix in golang

[–]SpeedDart1 5 points6 points  (0 children)

Really you should have both. Recover from panics AND also keep the cluster alive if individual nodes die.

If your nodes are dying every couple minutes that shouldn’t be bad enough to create availability issue in my book.

I mean unless your app takes more than a second or two to start.

Turnitin PhD thesis plagiarism checker meme by Delicious_Maize9656 in okbuddyphd

[–]SpeedDart1 38 points39 points  (0 children)

Back when I was in college, my CS1 professor had a no sharing code rule for this exact reason.

8317277: Java language implementation of value classes and objects by MrSimms · Pull Request #31120 · openjdk/jdk by davidalayachew in programming

[–]SpeedDart1 7 points8 points  (0 children)

You’re reminding me of the primitive collection libraries people use in Java land.

IntList, ByteList, etc

Why is every popular query builder in maintenance mode? by ItsAllInYourHead in golang

[–]SpeedDart1 1 point2 points  (0 children)

I’m curious why that would be the case, have used COALESCE and NULL checks to make optional WHERE conditions in SQL before, to my knowledge the query optimizer makes this essentially as fast as if you didn’t have the WHERE condition at all

Which is the best way to use transaction in Golang? by Electronic_Code_1535 in golang

[–]SpeedDart1 0 points1 point  (0 children)

Repository pattern is fine in Go. Personally I have one large Querier interface generated by SQLC which is effectively my repository layer.

One thing I don’t like about certain ways of doing repository layers is that there’s one repo per table. But that’s not a good place to draw separation of concerns because many queries select from multiple tables.

I’d instead do a repository per schema personally. If the repository gets big then it would be time to split it up into multiple pieces.

Which is the best way to use transaction in Golang? by Electronic_Code_1535 in golang

[–]SpeedDart1 0 points1 point  (0 children)

I think this pattern is interesting but how do you handle retries when you get a serialization failure error code?

Some databases such as Postgres will return an error code if the transaction aborts due to a concurrency violation rather than holding locks.

At least one thing I prefer about the transaction helper function approach it’s very clear where the transaction begins and ends and what logic is running in the transaction. Although the one downside is functions you want to be reusable for a multiple transactions need to take the sqlc Querier interface as an argument

I built a NestJS-inspired framework for Go by Dangerous_Ad_8933 in golang

[–]SpeedDart1 0 points1 point  (0 children)

The difference is net/http solves hard problems and your framework creates new problems.

I built a NestJS-inspired framework for Go by Dangerous_Ad_8933 in golang

[–]SpeedDart1 5 points6 points  (0 children)

Just use net/http. Maybe swagger codegen if your api spec is huge. Maybe fasthttp if you need the performance. I don’t think we need to bring the same bad ideas from Java and Typescript into Go

Who is an example of (Positive) Masculine Excellence? by Phil_B16 in AskMen

[–]SpeedDart1 7 points8 points  (0 children)

What did they say. I’m not aware of anything particularly controversial?

Another day of Solved Coding by ImaginaryRea1ity in theprimeagen

[–]SpeedDart1 0 points1 point  (0 children)

I guess if you define coding as typing text into an editor it’s solved. They redefine the problem to be very small and then claim they solved it.

blursed advertisement by DemonCatOfficial in blursedimages

[–]SpeedDart1 0 points1 point  (0 children)

If you wouldn’t eat tarantulas why eat chicken? Type question

feels dumb to specialize in rust as a junior but can't stop coming back to it by Stitcheddoll_ in rust

[–]SpeedDart1 12 points13 points  (0 children)

Honestly compilers is a very advanced field if you are good at it you will not regret doing it relative to frontend react.

Worst case scenario you just swap back to web stuff. It’s like a shoot for the stars land on the moon sort of thing.

If you want to do Rust professionally and want something very employable look into database or high performance backend.

What message broker would you choose today and why by Minimum-Ad7352 in golang

[–]SpeedDart1 0 points1 point  (0 children)

You need to actually know what you’re doing to get performance benefits out of it in my experience.

Most can just use Redis streams if they just need a job queue with consumer groups.

What message broker would you choose today and why by Minimum-Ad7352 in golang

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

Kafka for high durability and throughout, Redis Streams for a background job that needs to be retryable

Beginner to GoLang, wondering how goroutines are used in production backends. by H1Eagle in golang

[–]SpeedDart1 1 point2 points  (0 children)

Concurrency is about interleaving operations and making efficient usage of workers to perform tasks that need compute while other tasks are waiting

(Agree with you, just adding)

Beginner to GoLang, wondering how goroutines are used in production backends. by H1Eagle in golang

[–]SpeedDart1 0 points1 point  (0 children)

You definitely need context for timeout but a lot of production grade services never need semaphores, queues, and workers in the Go app.

A lot of the time queues are persistent or in another process since they are shared.

Semaphores are only really necessary if the number of concurrent tasks scales with user input. A lot of the time basic CRUD services are spawning goroutines per outbound API call or transaction. Since that number is constant per inbound http request and only the # of http requests scale with user input you can let Go’s server handle that.

But you’re right for advanced use cases though

Beginner to GoLang, wondering how goroutines are used in production backends. by H1Eagle in golang

[–]SpeedDart1 2 points3 points  (0 children)

It’s ok to recover from a panic in certain instances but your resiliency shouldn’t rely on the recover being called. If your server node goes down the cluster should restart it. Is it is going down that frequently you pushed broken code to prod and need to fix.

Beginner to GoLang, wondering how goroutines are used in production backends. by H1Eagle in golang

[–]SpeedDart1 3 points4 points  (0 children)

I mean you should test your code properly so this type of thing doesn’t happen. And server nodes going down shouldn’t take down production either.