Need advice about which tool to choose?Ask the StackShare community!
Go vs TypeScript: What are the differences?
Go is a statically typed, compiled programming language developed by Google, while TypeScript is a superset of JavaScript that adds static typing to the language. Let's explore the key differences between them.
Syntax and Typing: Go uses a C-like syntax with a minimalistic approach, making it easy to read and write. It has a strong static typing system, meaning that variables must have their types declared explicitly. On the other hand, TypeScript uses a JavaScript-like syntax and introduces static typing through type annotations. TypeScript allows developers to write strongly typed code, providing better tooling and catching errors during compile-time.
Concurrency Models: Go is designed with concurrency in mind and has native support for concurrent programming. It provides lightweight goroutines and channels, which make it easy to write concurrent code. Go's concurrency model allows for efficient utilization of system resources and simplifies the development of highly concurrent applications. In contrast, TypeScript does not have built-in concurrency primitives. However, it can leverage JavaScript's event-driven and asynchronous programming capabilities, making it suitable for web development.
Performance and Execution: When it comes to performance, Go is known for its fast execution speed. It is a compiled language that produces native machine code, allowing it to achieve high performance. Go's runtime also includes a garbage collector that manages memory automatically. On the other hand, TypeScript is a scripting language that runs on top of JavaScript engines. While it offers the productivity of a dynamically typed language, it may not provide the same level of performance as Go.
Tooling and Ecosystems: Go has a simple and powerful toolset that comes out-of-the-box. It includes the go command, which provides a seamless development experience with features such as building, testing, and formatting code. Go's standard library is well-documented and encompasses a wide range of functionalities. On the other hand, TypeScript benefits from its rich ecosystem of JavaScript libraries and tools. It can leverage the vast collection of JavaScript packages available through npm, which makes it easy to integrate with existing JavaScript projects.
Error Handling: Go has a distinctive error handling mechanism based on return values. It encourages the use of explicit error checks, which makes the code more robust and reliable. Go's error handling approach helps developers identify and handle errors effectively. TypeScript, being a superset of JavaScript, follows JavaScript's error handling paradigm using try-catch blocks. While this approach is familiar to JavaScript developers, it may not be as strict and explicit as Go's error handling mechanism.
Infrastructure and DevOps: Go has gained popularity in the field of infrastructure and DevOps due to its simplicity, efficiency, and performance. It offers a single statically linked binary that can be easily deployed and executed on various platforms without dependency issues. Go programs can be compiled into self-contained binaries, making them easier to package and deploy in cloud-native environments. TypeScript, on the other hand, is commonly used for web development and does not have the same level of focus on infrastructure and DevOps use cases.
In summary, Go, also known as Golang, is a statically typed language designed for simplicity, efficiency, and concurrency, making it well-suited for building scalable and high-performance systems, particularly in the realm of server-side programming and distributed systems. TypeScript, on the other hand, is a superset of JavaScript that adds static typing, allowing developers to catch errors early in the development process and write more maintainable and scalable codebases, making it a popular choice for building large-scale web applications.
I've been juggling with an app idea and am clueless about how to build it.
A little about the app:
- Social network type app ,
- Users can create different directories, in those directories post images and/or text that'll be shared on a public dashboard .
Directory creation is the main point of this app. Besides there'll be rooms(groups),chatting system, search operations similar to instagram,push notifications
I have two options:
- React Native, Python, AWS stack or
- Flutter, Go ( I don't know what stack or tools to use)
Currently, I have decided to use Python and JavaScript (especially React and Node.js) for any of my projects. Well, I have used Python with Django for a lot of things, and I would certainly recommend Django to anyone, due to its high secure authentication and authorization inbuilt system, a ready to use admin platform, template tags, and many more. Well, I guess that you would like to use Python to create the backend of your application, an API, and React Native for the frontend. Python and JavaScript (React) are on the trend these days and have a huge community, so there are many resources, tutorials, great documentation. I have not really heard anyone using Flutter and Go for applications these days, so I would not recommend it to you, it would make your life much more difficult.
Hope that helps, and good luck with your project!
I'm typically agnostic when it comes to picking languages. Whatever gets the job done, but, in this case, to figure out what's involved with what you want to do, it's going to be much more than just picking programming languages for your client and backend interfaces.
So, I'm recommending you use Flutter+Firebase as a way to figure out what you need to get done. It supports both iOS and Android out of the box, introduces you to a bunch of components you will need to think about in the future (whether you stick with Firebase or not), and the key here, is that there are tons of articles, youtube videos, and other courses you can take to pick it up pretty quickly. You could even clone an Instagram knockoff from github. Guess what else, it's all free. You might not need to worry as much about the backend since there are client libraries for Flutter/Dart for Firebase.
Some might have different opinions, and like I said, I'm usually agnostic, but in this case, you have a lot to consider. Where are you going to store the data? Are people going to need to login? Will there but customized settings the will save even if I close the app? Yeah, that's just a few questions.
Those are just a few. Lots to consider, so if you want to get something in your hand as soon as possible, try a search for flutter + firebase + chat + Instagram or something like that and have a look.
If this is for learning about how to design the system, then pick the tools are you are confortable with.
Often times, I get stuck picking the tools (and trying to learn about them) vs actually trying to design the system itself.
If you are familiar with React (check out Expo) and Django then I would recommend going with that.
For deploying your backend, I would go with a provider like https://zeit.co/ that automates a whole bunch of deployment steps with their cli tools that you might have to do with AWS.
The above listed tools will do the job, you just need to figure out your architecture(e.g models). How they will all connect. Then you can use a tool you are comfortable with to implement them.
What you need to take a look at is Apache OpenMeetings. It already does what you want, it is open source and well documented and only requires that you design the UI and plumbing required to serve you application.
Let's select right tool you feel you are good at. And selecting tools are used by large community to solve your stuck if encounter
We are converting AWS Lambdas from Java due to excessive cold start times. Usage: These lambdas handle XML and JSON payloads, they use s3, API Gateway, RDS, DynamoDB, and external API's. Most of our developers are only experienced in java. These three languages (Go, Node.js, and Python) were discussed, but no consensus has been reached yet.
I've worked with all three of these languages and also with Java developers converting to these languages and far and away Go is the easier one to convert to. With the improved cold-start times and the ease of conversion for a Java developer, it is a no-brainer for me.
The hardest part of the conversion though is going to be the lack of traditional Classes so you have to be mindful of that, but Go Structs and interfaces tend to make up for what is lost there.
Full Disclosure: I'm a 95% Go convert (from Python) at this point in time.
Although I am primarily a Javascript developer myself, I used Go to build AWS lambda in a similar scenario to yours. AWS libraries felt better integrated on the Go side, I believe due to the language itself (e.g. how JSON objects are handled in go). Besides that performance of Go is much superior. But on the cons side; community is far smaller around Go, compared to Javascript. That is easy notice if you look at repos of community-maintained libraries for Go. That can feel a bit unreliable.
Go would provide the easiest transition for Java programmers -- its IDE/tooling is second to none (just install Goland) and the deploy/distribution story is extremely clean and lends itself to work well in lambda: single, static binaries with quick startup. No need to set up a full environment or package dependencies on your lambda AMIs, just copy a file.
If you want to prioritise language familiarity, JavaScript is more like Java than the other choices; and it can be optimised to run very fast. However if you need really fast cold-start times, you can't beat Go since it's compiled. There are other things to consider, such as the massive amount of community packages and help/documentation in the JavaScript ecosystem. Go is newer but seems to be quite popular if you need something that runs fast in a single binary.
I was initially going to suggest JavaScript due to the smaller size needs of AWS Lambdas code and the larger range of libraries and community available (and to avoid Python for this). But I have to agree with the recommendations and rationale of @ayildirim above and I think you should choose any reasonable language that is low-overhead, fast startup, and best supported by AWS Lambda, and that is probably Go. I don't think you are likely to go wrong with that, while you can potentially with the others.
So I'd agree, on the strength of AWS Lambda support and the solid performance of Go, it seems like your best choice here for Lambdas (and I'm going to need to consider that myself going forward... pardon the pun).
Finding the best server-side tool for building a personal information organizer that focuses on performance, simplicity, and scalability.
performance and scalability get a prototype going fast by keeping codebase simple find hosting that is affordable and scales well (Java/Scala-based ones might not be affordable)
I've picked Node.js here but honestly it's a toss up between that and Go around this. It really depends on your background and skillset around "get something going fast" for one of these languages. Based on not knowing that I've suggested Node because it can be easier to prototype quickly and built right is performant enough. The scaffolding provided around Node.js services (Koa, Restify, NestJS) means you can get up and running pretty easily. It's important to note that the tooling surrounding this is good also, such as tracing, metrics et al (important when you're building production ready services).
You'll get more scalability and perf from go, but balancing them out I would say that you'll get pretty far with a well built Node.JS service (our entire site with over 1.5k requests/m scales easily and holds it's own with 4 pods in production.
Without knowing the scale you are building for and the systems you are using around it it's hard to say for certain this is the right route.
From a StackShare community member: "We are looking to rewrite our outdated front-end with TypeScript. Right now we have a mix of CoffeeScript and vanilla JavaScript. I have read that adopting TypeScript can help enforce better code quality, and best practices. I also heard good things about Flow (JS). Which one would you recommend and why?"
I use TypeScript because:
- incredible developer tooling and community support
- actively developed and supported by Microsoft (yes, I like Microsoft) ;)
- easier to make sense of a TS codebase because the annotations provide so much more context than plain JS
- refactors become easier (VSCode has superb support for TS)
I've switched back and forth between TS and Flow and decided a year ago to abandon Flow completely in favor of TS. I don't want to bash Flow, however, my main grievances are very poor tooling (editor integration leaves much to be desired), a slower release cycle, and subpar docs and community support.
I use TypeScript because it isn't just about validating the types I'm expecting to receive though that is a huge part of it too. Flow (JS) seems to be a type system only. TypeScript also allows you to use the latest features of JavaScript while also providing the type checking. To be fair to Flow (JS), I have not used it, but likely wouldn't have due to the additional features I get from TypeScript.
We originally (in 2017) started rewriting our platform from JavaScript to Flow (JS) but found the library support for Flow was lacking. After switching gears to TypeScript we've never looked back. At this point we're finding that frontend and backend libraries are supporting TypeScript out of the box and where the support is missing that the commuity is typically got a solution in hand.
I use TypeScript because the tooling is more mature (the decision to discontinue TSLint in favor of moving all its checks to ESLint is a thoughtful and mature decision), there's a ton of examples and tutorials for it, and it just generally seems to be where the industry is headed. Flow (JS) is a fine tool, but it just hasn't seen the uptake that TS has, and as a result is lacking a lot of the nicer small things, like thorough Visual Studio Code integration, offered by TS.
We currently use TypeScript at work. Previously we used Flow (JS) but it was sometimes really difficult to make the types work the way you want. Especially non-trivial types were problematic. And the IDE support wasn't good, Flow took too much resources and sometimes remain stuck and do not show errors (I use Visual Studio Code). With TypeScript we almost do not have these problems. IDE support is superb, working with types is much easier and typing system seems more mature and powerful. There are some downsides (like partion inheritance etc.), but TS team is still pushing it forward. So for me TypeScript is clear winner.
We use Underscore because it's a reasonable library for providing all the reasonable helper functions missing from JavaScript ES5 (or that perform poorly if you use the default ES5 version).
Since we're migrating the codebase to TypeScript , we'll likely end up removing most usage of it and ultimately no longer needing it, but we've been very happy with the library.
I use TypeScript for Web Applications and for both frontend and backend because it has a lot of tooling around it and they really got the types and type safety right. Flow (JS) on the other hand lacks tooling and most of the times I scramble to find the right way of building my contracts in which TypeScript is very intuitive and natural. Additionally TypeScript is very similar to Java so your backend engineers and full stack engineers can work with it without much of context switch.
The only time I think Flow shines is (based on probably my outdated knowledge) Flow is/was the only option if you want/wanted to build a React Native application mainly because React Native transpiler at the time I was working with it would only work with flow.
I use TypeScript because it's adoption by many developers, it's supported by many companies, and it's growth. AngularJS, React, @ASP.NET Core. I started using it in .NET Core, then for a job. Later I added more Angular experience and wrote more React software. It makes your code easier to understand and read... which means it makes other people's code easier to understand and read.
If you will start a project from scratch I recommend to use TypeScript. But, If you work with legacy projects written in JavaScript I recommend Flow (JS). Both tools have the same objective: reduce the bad code (which create illegible code, generate bugs e problems to maintenance). Flex helps you to avoid fall in bad codes, but TypeScript prevent you to c you to create bad codes. I believe cause this some JavaScript fans don't like TS, because TS block you to write some types o code. This is the fundamental difference between TS and Flow: Flow avoid problems, but no force. TS force you to prevent problems.
I use TypeScript because it's the most mature/issue-free Javascript type-checker available, as far as I've seen.
I use TypeScript because of broad support, on tools, repos, community ... the only reason to consider flow is if you're a facebook employee
I use TypeScript because I tried both on a Meteor project, and found the quantity of errors it enabled us to catch and the simplification of code it allowed was higher than Flow (JS).
I recommend TypeScript. When used correctly, TypeScript can enable your application to be scalable, easy to refactor, safe, and stable. One of the biggest draws of working with any typed language is that it forces you to think about your functions' inputs and outputs. This is invaluable as it can lead to more declarative, functional style code that ultimately can be easier to reason about.
TypeScript is however not a silver bullet. Just like anything new it takes time to fully understand the concepts of types, interfaces, abstract classes, and enums. In my experience engineers who excel when using TypeScript are those who have experience working with a statically typed language.
I use TypeScript because i love to program in Angular and used in node as well
Telegram Messenger has frameworks for most known languages, which makes easier for anyone to integrate with them. I started with Golang and soon found that those frameworks are not up to date, not to mention my experience testing on Golang is also mixed due to how their testing tool works. The natural runner-up was JS, which I'm ditching in favor of TS to make a strongly typed code, proper tests and documentation for broader usage. TypeScript allows fast prototyping and can prevent problems during code phase, given that your IDE of choice has support for a language server, and build phase. Pairing it with lint tools also allows honing code before it even hits the repositories.
1. Type safety and inferred types
Go is type safe by default, which allows you to right more reliable code and have better developer tooling, plus with the :=
operator, you can initialize a variable without having to define its type because it automatically gets its type from the initial value.
2. Performance
There isn't much to be said here, but on most counts go beats both Python and Node.js on performance.
3. Documentation
I'm not talking about the Go language itself, although it does have good docs. I'm talking about Go's auto generated documentation tool, which allows people to document their packages easily and works amazingly with Go's type system.
4. Compiles to binary
If you are making a local program for somebody and they don't want to download the Go compiler, you can make Go into a native binary.
5. Built for the web
Go has built in Http libraries to rival Express.js and has a HTML/Text templating system.
6. Great Concurrency
Go utilizes Goroutines to help developers utilize multiple threads easily.
Conclusion
Go is an excellent choice for any system code, especially http networking and web backends.
C# and .Net were obvious choices for us at LiveTiles given our investment in the Microsoft ecosystem. It enabled us to harness of the .Net framework to build ASP.Net MVC, WebAPI, and Serverless applications very easily. Coupled with the high productivity of Visual Studio, it's the native tongue of Microsoft technology.
Node.js has been growing in popularity, and the ability to access the global pool of Javascript developers is great. There is a decreased amount of effort for people to work across the frontend and backend, and the language itself is easy and works well for many common use cases.
Go was the other serious candidate, but it just hasn't been implemented in as many Production systems yet, and the best Go engineers I've known have been hackers, whereas we're building a robust analytics platform that requires more caution. Type safety is easily added with TypeScript, and NPM is awesomely handy.
When developing a new blockchain, we as a team chose Go lang over Java and other candidates, due to Go being (a) natively suited to concurrency - there are primitives in the language itself (goroutines, channels) that really help with reasoning about concurrency (b) super fast - build time, running, testing are all much faster that Java, this gives a far superior developer experience (c) shorter and stricter than Java - code is much shorter (less verbose), and there is usually one good way to do things, and even the code formatter that is bundled with Go is very opinionated - over a short time this makes reading other people's code far smoother than having to deal with different styles.
You should be aware that Go presently (v1.13) lacks Generics.
I chose Golang as a language to write Tango because it's super easy to get started with. I also considered Rust, but learning curve of it is much higher than in Golang. I felt like I would need to spend an endless amount of time to even get the hello world app working in Rust. While easy to learn, Golang still shows good performance, multithreading out of the box and fun to implement.
I also could choose PHP and create a phar-based tool, but I was not sure that it would be a good choice as I want to scale to be able to process Gbs of access log data
We decided to use python to write our ETLs and import them into metabase via a lambda. Before python we tried using Go, but overall go was way more verbose than Python when writing the ETLs. Go also had some issues managing memory when using the S3 upload manager library. This was a deal breaker for us that made us switch to Python.
In the end the solution was much cleaner and maintainable.
This language, even in early dev stages is to put it simply, fantastic! It is small, fast, and types a lot like go. It feels complete even though coming out less than a year ago in first early stages. I love it, it works anywhere and everywhere plus making binaries and GUI applications is just super easy!
A number of years ago; I had done python for a long time prior to learning about Go. Most of what I wrote was system-like things and web-things in python, and I got tired of running into the lack-of-a-type-system problems that python gave me. I wanted to switch to a compiled, strongly-typed system that wasn't C/C++ (been there, done that, got the "shoot yourself in the foot" t-shirt). I looked into both Rust/Go, and for what I wanted to do (system/web) stuff ... at the time, Go was the strongest candidate, so I switched and never went back. Recently I started to re-look at Rust for system things, but for anything I do that I have to touch the web with, it will be Go from now on.
As a personal research project I wanted to add post-quantum crypto KEM (key encapsulation) algorithms and new symmetric crypto session algorithms to openssh. I found the openssh code and its channel/context management extremely complex.
Concurrently, I was learning Go. It occurred to me that Go's excellent standard library, including crypto libraries, plus its much safer memory model and string/buffer handling would be better suited to a secure remote shell solution. So I started from scratch, writing a clean-room Go-based solution, without regard for ssh compatibility. Interactive and token-based login, secure copy and tunnels.
Of course, it needs a proper security audit for side channel attacks, protocol vulnerabilities and so on -- but I was impressed by how much simpler a client-server application with crypto and complex terminal handling was in Go.
$ sloc openssh-portable Languages Files Code Comment Blank Total CodeLns Total 502 112982 14327 15705 143014 100.0% C 389 105938 13349 14416 133703 93.5% Shell 92 6118 937 1129 8184 5.7% Make 16 468 37 131 636 0.4% AWK 1 363 0 7 370 0.3% C++ 3 79 4 18 101 0.1% Conf 1 16 0 4 20 0.0% $ sloc xs Languages Files Code Comment Blank Total CodeLns Total 34 3658 1231 655 5544 100.0% Go 19 3230 1199 507 4936 89.0% Markdown 2 181 0 76 257 4.6% Make 7 148 4 50 202 3.6% YAML 1 39 0 5 44 0.8% Text 1 30 0 7 37 0.7% Modula 1 16 0 2 18 0.3% Shell 3 14 28 8 50 0.9%
Pros of Golang
- High-performance552
- Simple, minimal syntax396
- Fun to write363
- Easy concurrency support via goroutines303
- Fast compilation times273
- Goroutines195
- Statically linked binaries that are simple to deploy181
- Simple compile build/run procedures151
- Great community137
- Backed by google137
- Garbage collection built-in53
- Built-in Testing47
- Excellent tools - gofmt, godoc etc44
- Elegant and concise like Python, fast like C40
- Awesome to Develop37
- Used for Docker26
- Flexible interface system26
- Great concurrency pattern25
- Deploy as executable24
- Open-source Integration21
- Easy to read19
- Fun to write and so many feature out of the box17
- Go is God17
- Powerful and simple14
- Easy to deploy14
- Its Simple and Heavy duty14
- Concurrency14
- Best language for concurrency13
- Safe GOTOs11
- Rich standard library11
- Clean code, high performance10
- Easy setup10
- High performance10
- Simplicity, Concurrency, Performance9
- Cross compiling8
- Single binary avoids library dependency issues8
- Hassle free deployment8
- Used by Giants of the industry7
- Simple, powerful, and great performance7
- Gofmt7
- Garbage Collection6
- WYSIWYG5
- Very sophisticated syntax5
- Excellent tooling5
- Keep it simple and stupid4
- Widely used4
- Kubernetes written on Go4
- No generics2
- Looks not fancy, but promoting pragmatic idioms1
- Operator goto1
Pros of TypeScript
- More intuitive and type safe javascript174
- Type safe106
- JavaScript superset80
- The best AltJS ever48
- Best AltJS for BackEnd27
- Powerful type system, including generics & JS features15
- Compile time errors11
- Nice and seamless hybrid of static and dynamic typing11
- Aligned with ES development for compatibility10
- Angular7
- Structural, rather than nominal, subtyping7
- Starts and ends with JavaScript5
- Garbage collection1
Sign up to add or upvote prosMake informed product decisions
Cons of Golang
- You waste time in plumbing code catching errors42
- Verbose25
- Packages and their path dependencies are braindead23
- Google's documentations aren't beginer friendly16
- Dependency management when working on multiple projects15
- Automatic garbage collection overheads10
- Uncommon syntax8
- Type system is lacking (no generics, etc)7
- Collection framework is lacking (list, set, map)5
- Best programming language3
- A failed experiment to combine c and python1
Cons of TypeScript
- Code may look heavy and confusing5
- Hype4