-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Appium V2 Architecture #3911
Comments
Changed title, this should ultimately be spec. |
Goals:
|
|
There will already be lot's of extra syntax sugar in ES6/ES7. |
Best if people edit the description with new items, then keep comments for comments. |
re: typescript, from http://stackful-dev.com/typescript-nodejs-vim-and-linux-oh-my.html:
also, from @dshaw (https://twitter.com/dshaw/status/527143090809618432):
|
There is already classes in ES6 http://javascriptplayground.com/blog/2014/07/introduction-to-es6-classes-tutorial/ |
in terms of increasing OO cleanliness, looks like ES6 is also getting native support for classes: http://javascriptplayground.com/blog/2014/07/introduction-to-es6-classes-tutorial/ in terms of greater type safety, it's not yet a part of the spec I don't think but there's a strawman up for type annotations: http://wiki.ecmascript.org/doku.php?id=strawman:types&s=types we can access both of these right now with traceur as well. so far i'm feeling like moving forward with JS's future rather than a "compiles to JS" language. I have a bad feeling about pegging ourselves to a different language. as atscript and dart indicate in addition to typescript, microsoft and google are doing their best to help out the community but it's not clear yet what will catch on and what will be left by the wayside in a year (dart). ES6/ES7 on the other hand are always going to be around because it's part of the core language. i'm therefore more happy to do some transpiling now and eventually remove traceur entirely. my vote is for getting what we need by moving into the future of JS (and thereby having the ability to speak into that future as well) rather than relying on tools of unknown worth and longevity. |
👍 |
@jlipps It sounds to me like you misunderstand AS and TS. Unlike Dart, On Tue, Oct 28, 2014 at 1:14 PM, Jonathan Lipps notifications@github.com
|
from @seanhess via twitter on typescript:
|
Yes, I was speaking loosely. They're different languages in that what they provide on top isn't necessarily going to be identical to what ES6/7 do. Or if it is, then there's no benefit in using it in the first place since its goal is the same as traceur. But my understanding was that they were providing new features on top of the existing language---type checking, classes, etc... And that they are adding this in their own way, which may or may not be the same way the JS standards body decides to go. But in general, I just don't see what the main benefit of Typescript would be over just using ES6/ES7 features via traceur. Given that I don't see the benefit, I don't see anything worth taking even the slightest risk that TypeScript goes by the wayside. Maybe you can help me see the benefit. |
You accidentally mentioned me via my twitter handle, so I'm butting in, but... Strict types are awesome. I mean, obviously TS and AS don't provide any benefit over Traceur unless you want strict typing. But having put several large javascript applications into production I can tell you it greatly benefits from a little love from the compiler. It's so nice to see what you broke when you change something. You don't need to worry about Typescript going away. Facebook's Flow and Google's AtScript are adopting the same annotations syntax. Once those projects are more developed, you should be able to pass typescript code more or less straight through the flow or at script compilers. (Or with minimal modifications.) Anyway, best of luck with your project! |
thanks @seanhess! |
I think the single biggest benefit is what seanhess mentioned:
We already use static analysis, but JSHint isn't that helpful for error checking. TS gives you powerful compile-time checks (sounds like AS provides powerful run-time checks). That alone equals a huge wins for the quality of our project since there are that many more issues that will be resolved before code even hits review. Good static analysis also allows for much better dev tooling. My IDE, from JetBrains, has support for TS and I think there are plugins available for a number of other code editors. Good tooling means better refactoring support, better dev-time error catching, and shorter dev cycles. Being able to do things like quickly find where a function is defined makes the code much easier to understand and bugs much less likely to occur in the first place. Since I wasn't familiar with Traceur until your post, the only other features I know TS offers are a different module api (which I have no idea is better or worse) and generics/templates. Generics are freaking awesome and impossible without static transpilation. AS promises run-time reflection and the ability to attach metadata to properties, both of which make it easier to use patterns such as Inversion of Control. We could use IoC in a number of ways, but most obviously for implementing a plugin system. I don't know much about Traceur, so I'm def open to it. However, I don't believe Traceur affords the level of static analysis as TS. That alone is enough to make me think even if we restricted ourselves to ES6/7 lowest common denominators of TS, AS, and Traceur, using TS tooling still provides big wins for us and, more importantly, our users. When taken together, I think the benefits of TS outweigh what appear to be fairly minor risks. If the project dies, then migrating to ES3 or Traceur or what have you shouldn't be too difficult (but deserves further study). Anyway, I'll be excited to implement any of the 3, as I think stronger typing will be a big help. |
I'd also like to add terminal assertions by 2.0. |
these should be much, much easier with async/await |
The TS reasoning makes sense when you are building a big FE application in a browser. However If I were to carry on this reasoning on the server side, where we are not tied to Javascript, I'll probably conclude that we should use another programming language. |
wasn't appium written in python at one point? |
Yes, but even python don't cut those criteria. |
what language would? |
C++/Java would, I am not even sure Go would, most go programmer use vim like editors. When you use dynamic languages, it's becomes hard to write good editor for it. We have chosen to write code in JS, either embrace it or dump it. Bottom line, it is a dynamic language based on event loop (i.e. not oroutines, even if they are becoming part of the picture). Don't try to make it what it is not. |
We've already made JS what it is not by writing a large application with it. However, I don't think dumping JS is practical at this point, especially if there are tools available that mitigate some of its weaknesses. TS doesn't mean giving up JS's dynamic capabilities--all JS is valid TS--it means better static analysis. There's nothing anti-JS about that. We already do static analysis, it's just not very useful for error catching. TS gives us the ability to enforce static types when we think it's beneficial. |
The goal of TS/AtScript is to become JavaScript via some eventual future ECMAScript standard, it's not a new language. The question isn't JS vs some other language, it's about how far in the future do we want to go in selecting the version of JS to use. Traceur seems like a safe bet however it doesn't address static typing. |
Ok let's go to the extreme and compile Doom to run on the browser, and then you want to use tools like mocha to test it. Do you think it is going to work well? You see, ultimately it's not about what is the language is compiled to, it's all about the stage where humans write it. What you gain in design/tooling, you'll loose it in testing/flexibility. This is an old arguments and to write server code, dynamic language have an history of being better. To write front end app the balance tends to be in favor of Strongly typed language, but even in this space the tendency is reversing with languages like Rust. I would agree that JS is not the easiest language to work with on server side, but in spirit, using transpilers like TS and to a less measure CoffeeScript is using a different language. The subset of generated Javascript is smaller than what you can write in pure JS. |
Ok. If we focus only on Traceur then with no TS, any objection? |
👍 |
I 'll definitely use most of the syntax sugar, there is no reason for them to be unstable, it's straightforward to implement in traceur. |
I see the legit use of spread now. Here's what the first examples I saw did: var wu = function (foo, bar = "baz", ...args) {
// do stuff
};
wu(someObj, ...["a", "b", "c"]); That's terrible, tho can be dealt with in code review. |
What's terrible? this is for when the array is dynamic, like |
look at the signature of |
Yeah, to use the 2 feature together is probably not great, nevertheless both feature are useful. |
I think we need to add to the style guide that parameters with default values must come last in the function sig: |
@bootstraponline Do you think we should rename this thread and create a new one for 2.0 features? |
FWIW, I asked one of our non-core, regular contributors if static typing would discourage him from contributing. I don't think we really need to worry about the regulars--their skill level is quite high and are obviously motivated. It's the one- and two-offs who are really the question. Hopefully Angular gets there first so we can gauge the reaction. Anyway, we'll hash it out later. |
I think once there's IDE support (ex: jetbrains) then static typing will probably be helpful to people. In terms of the thread, I'm not sure why this one was closed. It'd kind of long so maybe a new one with a summary would help. |
@bootstraponline I'll live with @jlipps suggested scope if we can agree that sticking a default parameter in the middle of a function signature
I'll probably think of some other things later. |
Late night mis-click. Reopened. |
Another way of saying this is default parameters should always be last. |
Too much details.... |
Not sure what you mean. |
After much more conversation in chat, I think I've convinced @0x1mason that confusion because of misuse of rest/spread is unlikely. My main point is that we should use them as follows:
There really shouldn't be a lot of reason to use them in other cases. It'd be nice if ES6 implemented named args (like Python's And I think if someone comes up with a use that is different than one of these, we should discuss it in code review and adjust the style guide as necessary with any resulting decisions. |
I think this makes sense. 👍 |
\o/ we have finished rewriting appium |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
discussion link
Goals:
Use monocle-js, or ES7 async/await syntax (both use generators under the hood).
promises (with async await syntax)
Links:
The text was updated successfully, but these errors were encountered: