JShell & Newbies

Robert Field robert.field at oracle.com
Thu Sep 22 07:22:56 UTC 2016


On 09/21/16 23:07, Ben Evans wrote:
> Some feedback from my wife, who's currently writing some introductory
> material for absolute beginners in Java (& programming as a whole) -
> she uses jshell as the very first thing that learners meet and had
> this to say:

Excellent!  Yes, please, Anna & Ben.

When we launched the JShell project we identified three main audiences:

(1) People learning Java (including learning to program for the first 
time using Java)

(2) Learning a new API or language feature

(3) Prototyping

And it appears this is also significant:

(4) Testing

While we have had some feedback from educators, I think other uses have 
held heavier sway.

I'm particularly interested in making it work well for raw beginners.

>
>> >I really liked in earlier versions where it returned a type as well as a result - helps learners get to grips with java as typed language.
>> >(Also makes it easier for kids who are used to calculators to understand why 4/3 returns 1, not 1.333334!)

The feedback I got was that users of other REPLs would "laugh at JShell" 
if it stayed as verbose as it was.

So, we tried to hit a middle ground of being expressive but concise.

The good news is (to do that) we made the jshell tool extremely 
configurable.

First level of configuration is that you can set the feedback mode. 
Either with a command:

     /set feedback verbose

or with a command-line switch:

     jshell -v

The "verbose" predefined mode will show the type.

(you can also go the other direction: concise or silent)

The second level of configuration is what enables the first.  You can, 
at fine detail, configure what feedback you get.  See the /set 
commands:  /help /set, /help /set mode, /help /set format, , /help /set 
feedback

Weird place to find it (until you think about it), but you can see the 
configuration that creates the default modes here:

langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources --  
startup.feedback = ...

> If the usage of jshell for beginners is a big aim of the project
> (something like Swift Playgrounds), Anna & I would be happy to help
> review features & provide more feedback with that audience in mind.

Absolutely!!

Thanks,
Robert



More information about the kulla-dev mailing list