13 ms·
The stages of go enlightenment: 1. Holy crap, this is like coding in early Java days, what the heck were the language designers smoking?! They just ignored eve
by nvarsj 11y ago
The stages of go enlightenment:
1. Holy crap, this is like coding in early Java days, what the heck were the language designers smoking?! They just ignored everything! Where's my testing framework! DI?! Build system, dependency management?! WTF.
2. Holy crap, this is like coding in the early Java days! This is awesome! I can understand all golang code I read! Everything is so simple and easy. I finally get "less is more", and "worse is better"!
3. (Many months later) Oh god, I'm getting so sick of writing this test assertion in 4 lines over and over, and writing 100s of lines of mock structs. My tests are 5% substance and 95% setup. Okay let's write a junit/mockito assertion library. Oh crap, I'm having to manually wire everything everywhere and it's such a pain. Let's write a DI library. Ugh my project is getting too big and `go get` just doesn't cut it - time to use a dependency management library. Ugh, makefiles only go so far, time to write a build tool. Ugh code generation and metacoding is nonexistent, let's write our own code generation tool so we don't have to hand build 100s of types. ETC.
4. (Distant future) As golang's stubborn designers finally accept some flaws in their original thinking, they add features to make the language look a lot like another widely used language at the Googplex. Mission accomplished?
P.S. This is somewhat tongue in cheek - I do enjoy using golang day to day. It is a refreshing change :).
- RyanZAG 11y agoIt will get extremely meta when golang's infrastructure gets good enough for other languages to want to use. Then they'll split it out into a 'GoVM', or I guess 'GoRT', and then you'll have a 'GoVM' competing with the JVM...
- askyourmother 11y agoAppreciate it was written as tongue in cheek, but I am glad that today a developer can start with Go, test, write code, build, deploy all with Go, whereas nearly every other ecosystem requires additional tools, often external competing tools. Then life becomes about having to learn whole new toolbekt before even coding. Go still keeps it lean, and is great. The fact it does not have hipster dev approved status is also an added bonus. The minute we see a bloated testing suite with yet another DSL, for Go, we are in trouble.
- spriggan3 11y ago> The fact it does not have hipster dev approved status is also an added bonus. What are you talking about ? the hype is strong with Go. So strong devs are persuaded they need to use Go at all cost then complain Go has a garbage collector ( just go go-nuts mailing list). So strong there are countless articles on the net about "How we moved from X to Go..." just like in 2007/8 with Rails. > The minute we see a bloated testing suite with yet another DSL, for Go, we are in trouble. GoConvey and co ...
- eternalban 11y ago> just like .. Rails Uncanny, isn't it?
- ddw 11y agoExcept you can not use GoConvey and still write a quality test suite. Plus GoConvey wisely separated the UI visualizer from the BDD, we use the former and not the latter.
- jkarneges 11y ago> So strong there are countless articles on the net about "How we moved from X to Go..." Writing about Go is a great way to hit the front page of HN. I once saw 5 articles about Go on the HN front page at the same time!
- gizzlon 11y agoI don't think that's true anymore (?). HN has a well defined, very short, hype cycle.
- MichaelGG 11y agoRust has that built in, but managed to be a much more solid language (feature wise).
- weberc2 11y agoI don't know, I want to like Rust, but every time I pick it up I feel like I'm relearning C++. It's learning curve is steep, the sorts of applications I write benefit more from solid development velocity and a good concurrency story. I might be wrong, but I get the feeling that Rust really only shines where performance and meticulous control are paramount. I want to like it, but it feels ill-suited to the applications that interest me. :(
- zzzcpan 11y agoWell, hundreds of lines of mock structs is probably a sign that there is something very fundamentally wrong with the code. Go, as a language, has nothing to do with it. Testing is one of its nicest features. I only had to improve my testing experience just a bit, like stringifying complex outputs to compare them easily, comparing all of outputs with expected outputs in a single if statement and issuing a single verbose t.Errorf on failure, showing what functions produced what outputs on what inputs and what was expected.
- nvarsj 11y ago100s of lines. It feels very much like mocking objects in Java before mocking libraries came about. The explicitness is nice, but the verbosity increases very quickly as you start adding state to your mocks.
- brightball 11y agoAt some point mid #3 I finally hit the "I think it's time to just learn Elixir for every situation where I don't need a portable binary..." So far, looking like a solid decision.
- honua 11y agoThis is helpful to read because I've been debating between learning Elixir vs Go
- pjungwir 11y agoI'm looking to transition from Rails to something more performant. Phoenix is at the top of my list, but these benchmarks worry me: https://www.techempower.com/benchmarks/#section=data-r12&hw=peak&test=fortune https://www.techempower.com/benchmarks/#section=data-r12&hw=... https://www.techempower.com/benchmarks/#section=data-r12&hw=peak&test=update https://www.techempower.com/benchmarks/#section=data-r12&hw=... In both Phoenix has very high error rates, and in the first it seems really slow. Here is their Phoenix test app: https://github.com/TechEmpower/FrameworkBenchmarks/tree/master/frameworks/Elixir/phoenix https://github.com/TechEmpower/FrameworkBenchmarks/tree/mast... So what is going on there? Is it less of a perf win than I've heard? Is there something bad with their code?
- jake_morrison 11y agoThe benchmark for Phoenix was done at the last minute, and had a lot of problems which they didn't have opportunity to fix. The next round will be better.
- learc83 11y agoHere's a reply from the creator. https://www.reddit.com/r/elixir/comments/48ke69/any_reason_why_elixirphoenix_did_so_badly_in/d0ko6ai?context=3 https://www.reddit.com/r/elixir/comments/48ke69/any_reason_w...
- brightball 11y agoYea, I had the same concern until I heard the reason. There are other benchmarks out there that compare to Go/gin that are more accurate. Edit: Here. https://gist.github.com/omnibs/e5e72b31e6bd25caf39a https://gist.github.com/omnibs/e5e72b31e6bd25caf39a
- Mahn 11y agoYou forgot 5. (In a more distant future) After a plethora of features, long time Go developers become disappointed with how much bloat the language acquired over the years, decide to start from scratch and design the definitive language to replace it. Go to 1.
- twic 11y agoCounterfeiter is a pretty serviceable mock generator: https://github.com/maxbrunsfeld/counterfeiter https://github.com/maxbrunsfeld/counterfeiter
- gtrubetskoy 11y agoJava was: 1. Wow, this program runs on any platform! 2. Wow, no need to free memory! 3. Wow, threads and locks are so easy to do! Then many years later 4. Who really cares about cross-platform code if all I do is on Linux? 5. Why does this program require 4GB of ram? 6. Must I really download and install the JVM all the time, and what is it good for anyway? Go: 1. Wow, I can write stuff that previously could only be done in C/C++, and I can do it almost as easily as writing Python or Ruby. 2. Wow, I don't need anything installed for my program to run, it just runs!
- peteretep 11y agoYou're in stage 2, then.
- dig1 11y ago2. Yea, right. Obviously you haven't run enough Go binaries
- gizzlon 11y agoReally? I also find that to be true for the go stuff I run. The last example is nsq[1]: Download, unzip and run the binaries .. aahh :) Obviously this can be true for non-golang programs as well, but I can't think of any right now. 1: http://nsq.io/deployment/installing.html http://nsq.io/deployment/installing.html
- incepted 11y ago> 4. Who really cares about cross-platform code if all I do is on Linux? Most developers write their code on Windows and MacOS and then deploy on Linux. I'd say this "Write once run anywhere" thing was and still is a pretty big deal. > 5. Why does this program require 4GB of ram? Oh no! I need to buy a $5 piece of hardware to run this Java code? What kind of nonsense is that? > 6. Must I really download and install the JVM all the time, and what is it good for anyway? Once or twice a year, if you really want to. You update your browser much more often.
- 11y ago
- pacala 11y agoWhat do people use mocks for?
- tptacek 11y agoI'm sure this comment was written in good faith, but it doesn't belong at the top of this thread. It could be attached to virtually any post about Go. It barely engages with the actual post at all. Practically every other top-level comment below it is better. And, of course, it spawned a completely useless thread litigating Java vs. Go. Perhaps that's why it's at the top of the thread --- which means voting had a perverse effect for this topic. I don't know what to do about this tendency in language threads on HN, but it's a real problem.