Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile to JS or Vanilla JS #8

Closed
gnehapk opened this issue Sep 22, 2016 · 3 comments
Closed

Compile to JS or Vanilla JS #8

gnehapk opened this issue Sep 22, 2016 · 3 comments

Comments

@gnehapk
Copy link
Member

gnehapk commented Sep 22, 2016

Compiling to JS means: writing JS in another scripting language (for higher development flexibility and efficiency), then compile them into JavaScript for serving the application.

Compile to JS Vanilla JS
Higher learning curve, added overhead No extra learning curve or overhead
More readable code, easy to debug Less readable code, harder to debug
Generally produces less LoC Generally produces more LoC
Easier ECMAScript version migration Harder ECMAScript version migration
Easier discovery of possible errors during compile time No compilation, hence no preemptive discovery of errors

TypeScript and LiveScript are the two most popular and feature rich superset of JavaScript(i.e. compile to JS). Spared CoffeeScript, as LiveScript does everything CoffeeScript does, but better.

TypeScript LiveScript
Primarily OO programming style Primarily functional programming style
Allows static typing (lost on compile) Dynamic typing, same as JS
Needs TSD to work with JS code Allows even in-line JS (with <code>)
More lines of codes, in general Less lines of codes, in general
Imposes conventions Allows flexibility
Loses information after compiling Doesn’t lose information after compiling
@debloper
Copy link
Contributor

debloper commented Oct 3, 2016

After some follow up discussion, it appears, using TypeScript is only essential when using along with angular. Please follow #4 for the AngularJS viability discussion.

LiveScript is overall more generic choice, and depending on the modularity and maintainability of code, often essential. However, for the time being, we can keep things manageable within vanilla JS realm, without losing any feature or performance.

If managing JS becomes tough, in future, we can painlessly migrate into any of the aforementioned abstractions, as they're superset of JS anyway. Also, the current set of developers working on this project have common/shared consensus about using JS as well.

@nthomas-redhat
Copy link
Contributor

@debloper so the decision is to use vanilla JS and not TypeScript/LiveScript? Or is it a combination of both

@debloper
Copy link
Contributor

debloper commented Nov 2, 2016

@nthomas-redhat for now, it's a mix of both. New modules will have increasing amount of vanilla JS codes, as new team members are really comfortable with it. At the same time, the existing code is in TS, and will stay as such unless they have to be migrated.

In short, TS works well together with JS, so it's not a choice of either-this-or-that. As we've started with existing codebase, TS will be there for a while, but going forward, we're gonna use vanilla JS as much as possible without breaking anything (and it ideally shouldn't break anything).

@debloper debloper closed this as completed Nov 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants