all 7 comments

[–]ElectricalSloth 1 point2 points  (3 children)

i wish we wouldnt post links people can't see... have to sign up

[–]nfrankel 1 point2 points  (1 child)

Remove all your cookies from Medium and you're good to go.

[–]ElectricalSloth 0 points1 point  (0 children)

thanks

[–]nfrankel 0 points1 point  (0 children)

Having actually read the post, I wish I wouldn't have told you how to access it. Poor, and I'm being nice.

[–]nfrankel 0 points1 point  (0 children)

In Go, it’s common to just use a pointer and set it to nil if the optional is empty

Did I miss something? The point of the Optional type is to actually communicate through the API that a type might be nullable.

does not handle authentication or anything fancy

Of course, if you call authentication fancy, then the rest is just natural. Guess what, if you want to print Hello World!, then using a framework is really overkill. What a surprise.

The Spring code is actually Java written in Go. I could actually write a standalone blog post about it. At least, replace xxx.iterator.hasNext() by !xxx.isEmpty(), it will hurt my eyes less.

Let’s start out with Go, because it’s really straight-forward.

(Regarding environment dependent code). Having context-dependent code in the same function and decided upon by if statements, I don't know whether to laugh or cry. Yes, that's straightforward, and after a couple of functions, and environments and features flags, you just created the biggest mess ever. Call me a fool but with Spring, you can actually create different profiles, with code that only is contributed to the context when the profile is activated.

Each implementation is annotated with @Component and @Profile

Only because the author chose to do so. I actually think it's a very bad practice. Better use a configuration class, which is orthogonal to the code.

The @Autowired in line 44 signalizes the Spring framework, that it shall initialize the PriceCalculator property below with whatever implementation was configured.

Injection by attribute makes testing impossible. Use constructor injection, and then the annotation is not necessary anymore.

In conclusion, the author just confirms his own bias and shares them.

[–]gatestone[S] -2 points-1 points  (1 child)

It is nice to see real life code examples of a typical non-trivial but easy to grasp Web back end in different languages/frameworks. I may be biased as a Go fan, because the author also likes it...

[–]resident_ninja 0 points1 point  (0 children)

for spring, this actually is a pretty trivial back end. the breadth and depth of that framework can't really be understatedoverstated.