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

Write grammar to allow dictation and simplify lookup of info #2

Open
CodesAway opened this issue Nov 15, 2020 · 5 comments
Open

Write grammar to allow dictation and simplify lookup of info #2

CodesAway opened this issue Nov 15, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@CodesAway
Copy link
Owner

CodesAway commented Nov 15, 2020

Chain methods, such as stream, using "then".

For example, "stream accounts then map to string then collect to list".

accounts.stream()
.map(Object::toString)
.collect(Collectors.toList());

The goal is to use a simple grammar and focus on code practices to simplify code.

For example, although the following is valid code, it's not the most readable (and would be hard to dictate or describe)

doSomething(new Type("abc"), new BigDecimal ("1.23"));

Instead, it's easier to read and dictate the code by breaking it up into variables and passing the variables.

Type accountType = new Type("abc");
BigDecimal balance = new BigDecimal ("1.23");
doSomething(accountType, balance);
@CodesAway CodesAway added the enhancement New feature or request label Nov 15, 2020
@CodesAway
Copy link
Owner Author

CodesAway commented Nov 15, 2020

Use "invoke" when invoking a method; whereas, "dot" can be used for accessing fields or invoking.

Use "using" to allow multiple consecutive statements with the same variable.

For example, "using account invoke set type to checking then set balance to 17 15". Depending on parameter types, could wrap, such as in BigDecimal.

account.setType("checking");
account.setBalance(new BigDecimal("17.15"));

In this case, since method chaining isn't possible (based on return type), would create two statements that interact with the same variable.

Could then say "invoke set name to my checking account". Since said "using account", would know to invoke on account.

account.setName("my checking account");

@CodesAway
Copy link
Owner Author

Sounds like instead of "using", should use "with", which is what Kotlin calls it.

Instead, "using" should be a try-with-resources, like C# defines it.

@CodesAway
Copy link
Owner Author

Can use "declare" to create new local variable. What should be used to start initializer? "Equals"?

For example, "declare int line number equals 1" to "declare line number as int equals 1"
int lineNumber = 1;

Use "assign" to change the value of an existing variable.

"For example, "assign line number equals / to 2"

lineNumber = 2;

@CodesAway
Copy link
Owner Author

CodesAway commented Nov 30, 2020

Ability to "select" so can select something to change it or to show Javadoc.

Ideally would work on anything in view, but could also limit to current line and expand.

@CodesAway
Copy link
Owner Author

For "for each loop", don't need to specify if using generics since can determine. If not using generics, type would be Object, just like Eclipse would do.

Also, starting in Java 10 could also use var instead of specifying the type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant