Programmer's Guide To Text Blocks

Tagir Valeev amaembo at gmail.com
Mon Aug 12 06:08:33 UTC 2019


> *Guideline:* *It is sometimes reasonable to fully left justify a wide
string in order to avoid horizontal scrolling or line wrapping.*

If lines are too long and make reading the source file harder, I'd
recommend externalizing the string instead (putting into the resource
file). If this is hard to do, I would leave it as is. Horizontal scrolling
is not a big problem, but left indentation breaks the flow in the common
case when you actually don't need to read the text block content. Well
"sometimes reasonable" looks ok to me, but I would not agree with Alex that
this should be "recommended".

With best regards,
Tagir Valeev.

On Mon, Aug 12, 2019 at 1:01 PM Tagir Valeev <amaembo at gmail.com> wrote:

> Hello!
>
> In general, looks good, thanks!
>
> > *Guideline:* *Avoid aligning the opening and closing delimiters and the
> text block's left margin. This requires reindentation of the text block if
> the variable name or modifiers are changed.*
>
> I'm not sure about this recommendation. Reindentation could be necessary
> in other cases as well, e.g. if you move this declaration to the nested
> block. I think every IDE will take care of any necessary reindentation for
> you. It's similar to a method declaration that contains several parameters
> one per line. E.g. (from OpenJDK Collectors class):
>
> public static Collector<CharSequence, ?, String> joining(CharSequence
> delimiter,
>                                                              CharSequence
> prefix,
>                                                              CharSequence
> suffix)
>
> Here three parameters are indented in the same way: if method name,
> modifiers, return type or type parameters ever change, this would require
> the reindentation of second and third lines (and IDEs do this
> automatically). Is such a code style acceptable for Java? If yes, then
> indenting opening and closing delimiters of the text block should also be
> acceptable, in my opinion.
>
> With best regards,
> Tagir Valeev.
>
> On Mon, Aug 5, 2019 at 7:38 PM Jim Laskey <james.laskey at oracle.com> wrote:
>
>> The enclosed PDF is the content of the proposed "Programmer's Guide To
>> Text Blocks".  Document source is located at
>> http://cr.openjdk.java.net/~jlaskey/Strings/TextBlocksGuide_v8.md
>>
>> http://cr.openjdk.java.net/~jlaskey/Strings/TextBlocksGuide_v8.html
>>
>> Please review and comment back to this mailing list.
>>
>> Cheers,
>>
>> -- Jim
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20190812/4a8bc8f3/attachment.html>


More information about the amber-spec-experts mailing list