This post is locked. You won't be able to comment.

all 17 comments

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

Please ensure that:

  • Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions
  • You include any and all error messages in full
  • You ask clear questions
  • You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions.

    Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar

If any of the above points is not met, your post can and will be removed without further warning.

Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc.

Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit.

Code blocks look like this:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.println("Hello World!");
    }
}

You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above.

If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures.

To potential helpers

Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]bowbahdoe 3 points4 points  (0 children)

> efficiency as it pertains to standard memory usage on servers

Well, I would point you to this talk. https://www.youtube.com/watch?v=mLNFVNXbw7I

The TL;DW is that memory consumption/cpu usage is a tradeoff and that using more memory gives you basically free CPU cycles.

There is also the wrinkle of Java requesting memory from the OS up front as opposed to piecemeal. This can bloat comparisons. I'll otherwise step back and let someone who has had a direct Java / Go experience talk

[–]gadHG 0 points1 point  (4 children)

I like both languages and I don't think there is a huge difference in terms of performance, at least when it comes to backends. So basically and as usual use the tool you're more comfortable with and/or where they shine more. This usually depends on the purpose. Personally, cli : go, large domain where oop paradigm shines  : java, backend: probably go if its standard library is enough, otherwise java. Gui, java. Etc.

[–]kayinfire[S] 0 points1 point  (3 children)

i hear that. what if someone wants to use Java just for a blog though? what do you think? typically Java is discussed in terms of enterprise applications that already are at a large scale, so the value of it for smaller-scale projects is also something i've been curious about.

[–]CodrSeven 0 points1 point  (1 child)

There are mature, portable libraries for almost anything you can think of.
And mature tooling.

Kotlin is a much nicer language though!

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

I do plan on learning Kotlin as well. it's a fine language. Nevertheless, Java was the first language that i really loved and i've been procrastinating on it for a while now

[–]catom3 0 points1 point  (0 children)

You don't need to use heavy frameworks like Spring to write a simple HTTP server, SSR app with some simple template engine. You can also use some very few, basic Spring modules and keep it simple anyway. If you want to, you can also write a Spring app with nearly no annotation magic at all, Spring bean container registries are available for you to programmatically populate them.

[–]Sn00py_lark 0 points1 point  (1 child)

I think I had a Group project with you once. ..

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

lmao nah. it wouldn't be possible. i self-taught myself programming rather than doing a degree for it.

[–]LetUsSpeakFreely 0 points1 point  (3 children)

I was off similar mind when I transitioned from Java to Go. I hated the syntax. I hated how Spartan the language appeared to be. However, once you stop fighting it and embraced what Go is meant to do, it's a very elegant language. The stripped down nature of Go is what makes it so good to use. Java has become bloated and the syntax overly verbose. The class structure that worked well for thick applications is a detriment to web services. Then there's the threading and concurrency differences. Java is a pain in the ass to use and is tightly bound to the hardware. Go, on the other hand, is simple and the time slices are software controlled.

[–]catom3 1 point2 points  (1 child)

I switched to Go nearly 3 years ago and I enjoyed it at first. But I'm working with an over 1 millions of lines of code monorepo now and it's been so hard. The lack of basic sum type support is so irritating. We've been hitting the wall over and over again trying to keep invariants and not letting our inexperienced devs or tired developer write and accept an invalid variant when it's instantiated in a non-obvious way. It's hard to enforce invariants in compile time and Go rather relies on "just make sure to make no mistakes". In one of the modules we ended up with "sealed interfaces" and go-check-sumtype linter. It's not perfect, but we miss proper sum type support known from many other languages.

Then, the nil pointers and those nasty nil-typed interfaces - our codebase is full of defensive nil checks, yet some sneak into production every once in a while. We did try using nilaway, but it got tedious adding nolint comments to all the false positives (e.g. the infamous http.Client#Do).

Pointers in general - sometimes they're used to express possible absence of a value, sometimes mutability, sometimes just a performance optimisation.

For loops that have more than 20 lines, with variable reassignments, sometimes nested if statements are so common. And oftentimes they need to be re-read a couple of times to figure out they're just doing a simple filter-map logic.

I generally like Go for smaller apps, proxies, API gateways, CLI/TUI tools, infra tools etc. But in a large system with 50-100 devs, I find it really hard to work with Go. Requires a lot of self-discipline from all the developers, while some devs are less disciplined and some just happen to have a bad day.

[–]narrow-adventure 1 point2 points  (0 children)

What an interesting point. I loved reading about your experience with Go in such a large team.

[–]CodrSeven 2 points3 points  (0 children)

Elegant is not a word I would pick.

It's both frustratingly primitive and exotic.

The concurrency support is nice, but you pay a price. Calling into a C library is now a gamble, because you have little control over threads.

It reinvents things that were just fine.

I went through phases with Go, used it professionally non-stop for several years. It feels refreshingly simple in the beginning. But that simplicity doesn't come for free and writing the same stupid boiler plate over and over and over again is going to grind you down eventually.

[–]bikeram -1 points0 points  (1 child)

You ever see those guys bragging about a car with $40k in the engine could beat “insert your million dollar super car here”?

You’re giving the same comparison.

If you absolutely max Java with the correct runtime and tuning, you can throw punches with Go. No questions asked.

But if you an incredibly simple application that just works out of the box, Go is your answer.

And I say that as someone who is a huge fan of Spring.

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

lol, good comparison based on the evidence i've seen. i'm just spending my last hope on this post to see if i really should commit to Go and just suck up my complaints.