GO - why to use

I recently heard about GO.
Currently I work on C++ and Java.
I want to know in which cases should I use GO lang. and why?
Can I replace my C++ applications with it?
Can I replace my Java core applications with it?
Does it support web development?

Take a look at https://golang.org/doc/faq#What_is_the_purpose_of_the_project.

That very much depends on the nature of your C++ application. If, for example, you have developed a Qt application, support for Go is rather limited. But for many other applications Go is very well suited.

The same can be said about Java. If your application depends on special libraries like JavaFX or JMX, Go does not support these. But you can probably port any Java application to Go.

That depends on what you mean by ‘web development’. Go is not client-side JavaScript. But any backend server impelented in another language can be implemented in Go.

Please ask a more concrete question: What applications do you think about? How are they used so far?

4 Likes

Welcome to Go!

In addition to the answers above:

If Java/C++ frustrate you then Go will be a breath of fresh air, but to simply replace an existing application would depend on the existing application.

“Does it support web development?” - Oh Yes! See some links here:
Writing Web Applications in Go
Server Programming
There’s also a great Udemy course on Go Web Development

If you want to get a good feel about the language have a look at the online Tour of Go. Coming from C++/Java it will take you not too long to go through

1 Like

Thanks!
I visited -
https://golang.org/doc/faq#What_is_the_purpose_of_the_project.

This is good. Now, i want to know its best suited scope-

  1. System programs development, OR
  2. Desktop application, OR
  3. Web application .

Further, my application has JSP/Java/Spring/Web services.
If I use GO, which of above 4 components can I replace to have better speed.

Your point 1. is very broad. Please be more specific. It is also very difficult to judge speed because this only in small parts depends on the programming language you use.

Regarding 2., as I said above, this may not be the strongest point of Go. But again the speed of a desktop application is not related to the programming language very much.

Your point is 3. can not be answered because “web application” is to broad.

Point 4. is to broad, too.

Please ask more specifc questions. May I recommend http://www.catb.org/esr/faqs/smart-questions.html for inspiraton on how to ask good questions?

1 Like

If your web services are JSON based (e.g., not SOAP), one of those is probably a good place to start because web services are generally isolated and are only interacted with through an external, well-defined interface. Implementing an existing service would allow you to compare the two and see how well Go works for you.

1 Like

Thanks for the link suggesting how to pose questions.

How to make db connectivity in GO?

I am having REST services which produce JSON response.
So, is there any REST client in GO?

There are some links for working with database on the wiki.

I usually write my own using http.Client and encoding/json. The code is usually pretty short and allows you to deal with the specifics of your REST service (e.g., authentication, discovery, data types) and let your Go code that uses the client to work with custom types.

Sadly, you deciced not to read it but to continue to ask broad questions without doing any work yourselve :frowning:

@Priyank,

The purpose is asking better questions is to get better answers.

If you look back at the answers @lutzhorn I and gave, they are all pretty generic and have contingencies.

For example, my response pushed you toward implementing web services, if your existing ones were JSON based. Since I have experience in all the options you listed, the one I suggested was completely arbitrary. One of the other options could be better for you depending on your background and interests, which I have no way of knowing.

I like answering questions and helping people. I don’t want to discourage you from asking questions. Just know that by asking better questions, you help me help you.

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.