
Ask HN: Go vs. Ruby/Rails for first time indie dev? - onelastjob
I&#x27;d like to start making a social media web project and I&#x27;m wondering if I should use Golang or Ruby&#x2F;Rails on the back-end? I don&#x27;t have any prior coding experience. I&#x27;ve been reading a lot online about how Object Oriented Programming makes maintaining code difficult in the long term, which makes me think Golang might be a better choice than Ruby. Also, Golang&#x27;s speed sounds like it would help to keep my server costs low if my site were to get some traffic.<p>Since I&#x27;d be a solo dev on my projects, ecosystem and speed of development are important to me. How does Golang&#x27;s ecosystem for web dev compare to Ruby on Rails currently? I know that Ruby has lots of gems (devise, etc) to make web dev faster. Does Golang&#x27;s ecosystem have similar tools at this point?<p>A few other notes: On the front-end, I think I&#x27;d be most interested in using Vue.js from what I&#x27;ve read. I&#x27;m not really considering Elixir&#x2F;Pheonix at the moment, as I don&#x27;t like the idea of needing to learn both Elixir and Erlang. Thanks!
======
wallflower
If you choose Ruby, rspec and rspec-expectations
([https://relishapp.com/rspec/rspec-
expectations/docs](https://relishapp.com/rspec/rspec-expectations/docs)) grant
you very powerful abilities to write unit tests for your APIs out of the box.
You can pretty much mock anything from method calls to network responses.

Also, when running an rspec test that touches/creates/modifies ActiveRecord
database objects, the rspec scaffold will automatically create a new database
transaction for running your test so that the test database you are using is
not affected.

In general, don't worry if the Ruby that you write looks nothing like the
concise and sometimes 'magic' Ruby that more experienced developers can
produce. You'll get there when you get there. Try to learn as much about
Enumerables as you can [https://ruby-
doc.org/core/Enumerable.html](https://ruby-doc.org/core/Enumerable.html)

Vue.js is a good choice. Not as popular as React... yet.

Rails, as other commenters have noted, has a learning curve. As long as you
try to stick within the normal usages of Rails, you should be fine.

Whatever you do with Rails, stay far away from their template markup languages
(haml). Write the front-end in Vue.js, consuming APIs, don't do any server-
side rendering of anything. If you really want to do server-side front-end,
ditch Ruby/Rails and just go full blown Node.js front and back end.

Good luck, just get started!

~~~
tdeck
> Whatever you do with Rails, stay far away from their template markup
> languages (haml). Write the front-end in Vue.js, consuming APIs, don't do
> any server-side rendering of anything.

This is far from a consensus opinion. Depending on your application you can
actually get great results with Turbolinks, meaning you write very little
client side code. It's worth reading up on that option as well.

~~~
wallflower
Ok, we can agree to disagree. Given the OP’s stated personal choice of using
Vue.js, I assume that they want to build a SPA.

In my understanding, using Turbolinks makes use of most every JavaScript
client-side framework, including Vue.js, more difficult as the JavaScript
components have to be adapted to work with Turbolink caching.

~~~
tdeck
Indeed, I wouldn't recommend using them together either if OP goes with Vue.

~~~
wallflower
Thanks for the clarification, we will agree to agree :) I still have not-so-
fond memories of using Rails 4.x to render HAML partials to "support" basic
JavaScript dynamic interactivity.

------
Nextgrid
I would recommend Rails (or Django, or Laravel), not because Golang is a bad
language, but because it's just a _language_ where as Rails is a fully-
featured web framework that will do a lot of stuff for you out of the box
(authentication, sessions, database access and ORM, templates, etc).

------
karmakaze
It seems you've done your homework choosing Vue.js and narrowing down the
backend choices.

I myself know/use way too many languages/frameworks. I do very (most?) often
choose Vue/Go and stongly recommend this combo. I also use Ruby/Rails at my
day job.

Go is mature enough but isn't as comprehensive as the Rails ecosystem. Rails
is a good framework but still has a deep learning curve. Most of your back-end
will be simple database/json requests. It's easier to be self-sufficient with
Go, with Rails I always feel like I'm using so many things I don't fully
understand.

There will be enough Go libraries for doing the common things you will want to
do.

~~~
onelastjob
Thanks for sharing your experience with Go and Ruby/Rails. I have been a
little concerned about putting in a lot of time into learning Rails, since I
get the feeling that web dev might be heading more towards Go in the future.
If the libraries are mostly far along enough for what I need at this point,
I'll probably give Go a try first. Thanks!

------
justaguyhere
Use each for a week or two. Whatever makes you productive and happy, use it.
Most projects aren't going to have special requirements or don't need to scale
to millions of users (not at the beginning anyway). So it would make sense to
pick a tech stack that makes one comfortable and productive.

If you do have any special requirements (real time, video rendering, scaling
to a ton of users etc) then it would be good to spend time looking at the pros
and cons of various tech stacks

------
bigbassroller
> I don't like the idea of needing to learn both Elixir and Erlang

You dont need to learn Erlang to use Elixir, rather you would need to know
Elixir to use Phoenix; like you need to know Ruby to use Rails.

Also you can build a Twitter timeline clone in under 18 minutes using Phoenix
LiveView: [https://youtu.be/MZvmYaFkNJI](https://youtu.be/MZvmYaFkNJI)

------
lmiller1990
If you don't have any coding experience, maybe just do a server-rendered app -
less to learn. For this, RoR will be a great choice.

------
MH15
You don't have any prior coding experience! That may become an issue. Start
small, save your social media project for later.

------
heofizzy
As a php and golang developer I would say if you are starting out and want to
see results quickly - try ruby on rails. Ruby is dynamically typed interpreted
language, you won't need to recompile every time you make a change and
learning curve should be more approachable than rust or go.

~~~
onelastjob
I didn't realize I'd have to recompile Golang code after every change. That's
good to know. Thanks!

~~~
karmakaze
The Go compiler is really fast, effectively hot-reloads on every save.

[https://github.com/cosmtrek/air](https://github.com/cosmtrek/air)

------
crazypython
What are you trying to make? A social network? A highly interactive web app?

Could you build your app by generating HTML on the server, including some
JavaScript and returning it? That's how old reddit, Hacker News, Stack
Overflow, and no-JS Amazon are built.

------
dgb23
You'll be fine with both.

I'm happy to clear up some things but in the end your language/framework
choice doesn't matter as much as long as you are comfortable. Just start
doing.

> I'd like to start making a social media web project and I'm wondering if I
> should use Golang or Ruby/Rails on the back-end?

They are very different things.

RoR is a web-framework. There is a clear path to the whole process of writing
a web-application. Interacting with a database, auth, routing, code-
generation, structure... Using a web-framework you can lean on years of
experience, tutorials, documentation etc.

Go is just a language. Granted it has an extremely useful standard library and
is basically designed with web-servers in mind (among other things). But
you'll need to make decisions yourself as of which libraries you want to pull
in to achieve the same feature set as with a framework. There are also web-
frameworks in Go you can choose from.

> I don't have any prior coding experience.

Both Go and Ruby are very accessible languages. I suggest you go through some
tutorials, look at some code and see which language sparks more interest.

> I've been reading a lot online about how Object Oriented Programming makes
> maintaining code difficult in the long term, which makes me think Golang
> might be a better choice than Ruby.

My opinion: You've been reading the wrong type of articles. OOP is very much a
useful paradigm applied to many, well working, huge code bases. And it is one
of many paradigms that are useful. There are some people who "overdo"
paradigms. Be pragmatic, not dogmatic.

At this stage, just trace along with w/e is "idiomatic" (AKA how most people
write). The code you'll write will be beginner level code anyways, which is
fine.

Programming paradigms like Object Orientation, Functional Programming,
Procedural Programming, Event Driven Programming, Data Driven Programming and
so on are just tools.

You'll learn them along the way as you get a deeper understanding. They are
all useful in the right context, with the right language when solving a
particular problem.

Just write simple code and try to keep it reasonably DRY. Clean up stuff you
don't need from time to time. Write comments so you get why you did a thing in
a particular way. Don't worry about paradigms. They don't matter until you
know they matter and they are not a style attribute but something you use.

> which makes me think Golang might be a better choice than Ruby.

Go is a multi-paradigm language. You can write idiomatic OO code in Go and
many do. Abstraction through interfaces, polymorphism though composition,
message passing through dynamic dispatch (or in some cases channels), local
retention through private fields and error values are all corner stones of
modern OO and Go has a very clean way to use them if needed.

> Also, Golang's speed sounds like it would help to keep my server costs low
> if my site were to get some traffic.

At this stage the bigger money saver will be using a language (and
framework/libraries) that you will be motivated to use (fun) and just jive
with you will have a larger impact on your wallet and productivity. Then, when
you get more experienced you will learn about performance and how to optimize
for certain things. In short: Don't worry about it yet.

> How does Golang's ecosystem for web dev compare to Ruby on Rails currently?
> I know that Ruby has lots of gems (devise, etc) to make web dev faster. Does
> Golang's ecosystem have similar tools at this point?

If your happy with making a lot of decisions on your own then you'll be fine
with "just" Go. Just keep in mind that as a beginner, there are a lot of
things you are not thinking about right now. Using a battle-proven framework
will avoid common pitfalls.

In any case, w/o trying to sound patronizing: start reading articles that
don't want to sell you opinions and products but are actually technical and
useful. Start with these for example:

[https://www.martinfowler.com/articles/web-security-
basics.ht...](https://www.martinfowler.com/articles/web-security-basics.html)

[https://developer.mozilla.org/en-
US/docs/Web](https://developer.mozilla.org/en-US/docs/Web)

These kind of articles are not flowery opinionated things. Just dry,
technical, pragmatic stuff. developer.mozilla.org is a fantastic reference for
people who work with the web.

> On the front-end, I think I'd be most interested in using Vue.js from what
> I've read.

Great idea. Vue.js is very beginner friendly and has has great tooling around
it.

~~~
onelastjob
Thanks! This info is very helpful!

------
runjake
Here is the only useful answer you'll get:

Use whichever you feel more comfortable with and productive in. Either will
work just fine.

