News for hackers. Stuff that matters.
Re:How We Went from 30 Servers to 2: Go by trungonnews on Tuesday March 12, 2013 @09:40PM (#5366262)
Go as of today doesn't have too many libraries available. So there is really nothing to learn besides the language itself.
Re:How We Went from 30 Servers to 2: Go by jlarocco on Tuesday March 12, 2013 @10:41PM (#5366470)
That's not really true.

Granted Go doesn't have as many libraries as the more established languages, but to say there aren't many and there's "nothing to learn besides the language" is just flat out wrong.

Just for starters there's http://code.google.com/p/go-wiki/wiki/Projects

Re:How We Went from 30 Servers to 2: Go by trungonnews on Tuesday March 12, 2013 @11:36PM (#5366661)
A seasoned Java developer is expected to have worked with one of the mainstream ORM like Hibernate or Ebean. But a Go developer gets away with not having to know an ORM because there is no mainstream ORM in Go. :)
Re:How We Went from 30 Servers to 2: Go by burntsushi on Wednesday March 13, 2013 @02:02AM (#5367082)
So what, the lack of a mainstream ORM implies "So there is really nothing to learn besides the language itself"? I don't think so.

And there's probably more to a lack of an ORM other than "Go is immature." It's a fairly common opinion among the Go community that ORMs are not worth their complexity. I tend to share that opinion myself, after having worked with a few in a couple different languages.

Re:How We Went from 30 Servers to 2: Go by pestaa on Wednesday March 13, 2013 @02:57AM (#5367210)
Not sure why you were downvoted, I tend to agree ORMs are not the best ways to communicate with databases.

As to only the lack of ORM would make Go immature? Honestly I don't know. There are tons of software written in JavaScript; do they make JavaScript mature? Hell no.

Re:How We Went from 30 Servers to 2: Go by coldtea on Wednesday March 13, 2013 @05:28AM (#5367548)
>If the language is strictly OO (as Java and C# are) then an ORM is pretty much required.

Really? Because we managed to get just fine without one for decades...

Re:How We Went from 30 Servers to 2: Go by flyinRyan on Wednesday March 13, 2013 @05:18AM (#5367517)
If the language is strictly OO (as Java and C# are) then an ORM is pretty much required. What is the preferred solution in Go? And please don't say writing out raw SQL.
Re:How We Went from 30 Servers to 2: Go by virmundi on Wednesday March 13, 2013 @09:37AM (#5368243)
I've moved away from ORMs in Java because they don't really solve the problem faced. Hibernate could be a really good solution to providing a blanket system for SQL interaction except for the performance issues. If one was really using Domain objects (not pojos, or dumb DTOs) the typing ability of Hibernate would be great. Unfortunately for simple CRUD apps the issues presented by Hibernate (like loading it in an EAR) are such that it requires too much maintenance time on complex projects.

I know that I've used Hibernate for years. I've used it with DTOs. I know that it does provide a certain benefit for simple reads and writes. Unfortunately, Hibernate was designed to work in a disconnected manner like the Web. As a result you get into complications of session management. This is just one example of Hibernate maintenance costs.

Now I use Spring JDBC. This removes the noise of the checked exceptions, connection management, transactions, just like Hibernate. But I write simple or complex SQL in one place and map in and out contently.

Re:How We Went from 30 Servers to 2: Go by flyinRyan on Wednesday March 13, 2013 @10:19AM (#5368519)
Well, I can't speak to Java here but NHibernate works fantastic. I've checked the generated SQL on complex joins and it always ended up writing what I would have by hand.

In C# the session management is no big deal: you access everything via the Repository pattern, turn on trait injection and just make sure any repository method that will need a session has a transaction attribute. If you need to do a series of read/writes in one transaction you throw that whole method into the repository class and put a transaction trait on that method.

Re:How We Went from 30 Servers to 2: Go by socceroos on Thursday March 14, 2013 @12:12AM (#5373045)
That's a helluvu lot of abstraction for writing to a database.
Re:How We Went from 30 Servers to 2: Go by flyinRyan on Friday March 15, 2013 @08:53AM (#5380290)
It's not. I create a DTO and I set up an exact mapping of how that appears in the database. Then I create a type generic Repository pattern that makes the DB access explicit as opposed to NHibernate's magic database access. Then the rest is just one time wiring I set up so I don't have to worry about actually connecting to the DB in my code.

In any solution you come up with you'll either need a repository that handles sessions and so on, or you'll have to explicitly connect to the db every time you need it. Either case will be more work than what I've done with this solution.

Re:How We Went from 30 Servers to 2: Go by Luyt on Wednesday March 13, 2013 @08:30AM (#5367970)
What's wrong with using SQL in your program? As long as your database layer is able to perform parameter substitutions to avoid SQL injection, this is a pretty efficient way to get stuff out of the database (and only the stuff you want). Why would using an ORM be a 'requirement' for OO-oriented languages?
Re:How We Went from 30 Servers to 2: Go by flyinRyan on Wednesday March 13, 2013 @09:33AM (#5368213)
There are quite a few problems using SQL directly in your program. Separation of concern issues, typing issues (e.g. the compiler can't tell you the USER table isn't appropriate here because it has no way to see what you're doing).

In a multi-paradigm language you wouldn't be tied to using an ORM but you should still use something that provides some kind of anti-corrupt support. In an OO language you can have nothing but objects so there is nothing else your database library can return. It may as well return objects that represent the records rather than, say a list of strings.

Re:How We Went from 30 Servers to 2: Go by voidlogic on Wednesday March 13, 2013 @10:06AM (#5368394)
Even though it is terribly out of fashion, the performance of database interface classes (a database access layer) that wraps and abstracts SQL prepared statements and/or stored procedure calls is almost always much more efficient than ORM when the SQL written by someone minimally SQL competent. ORM can be much faster to implement, ah- classic tradeoffs.
Re:How We Went from 30 Servers to 2: Go by redbad on Wednesday March 13, 2013 @04:11AM (#5367377)
ORMs are broadly considered antipatterns in Go.
Re:How We Went from 30 Servers to 2: Go by Xion on Wednesday March 13, 2013 @08:45AM (#5367996)
Source? I have never heard that claim. And contrary to that, Go has facilities for implementing ORMs, like field annotations in structs for specifying column bindings.
Re:How We Went from 30 Servers to 2: Go by smrtinsert on Thursday March 14, 2013 @02:49PM (#5376905)
A seasoned java developer stays away from orm anyway ;)