multiline string/string literal without escape processing

saeed yousefi saeedtej at yahoo.com
Sun Aug 21 03:48:36 PDT 2011


Hi

Yes , I know I can put the text into external resources but it doesn't mean that there shouldn't be such facility in the language itself . 
so for what strings exist ? There are lots of places where I want to return a short JSON response from server and I can do it with this feature.


regards 

saeed


________________________________
From: Tom Ball <tball at google.com>
To: saeed yousefi <saeedtej at yahoo.com>
Cc: "coin-dev at openjdk.java.net" <coin-dev at openjdk.java.net>
Sent: Sunday, August 21, 2011 4:21 AM
Subject: Re: multiline string/string literal without escape processing


There's a great language you should considering using that has built-in support for JS and JSON:  JavaScript.  Just because something can be written in Java doesn't mean that it necessarily should, as real engineers write code in the language most appropriate for the task before them (IMO).


Another option is to put the text you're currently laboriously escaping into external resource files, and just read them in as needed.  The advantage to keeping text in different files is that most editors and IDEs provide syntax-specific formatting, which makes it easier to write and mades errors easier to spot.  JSON?  Use a library to convert your data types instead of doing it by hand, as the overhead is minimal.  Write unit tests for those data classes and you have a much more robust solution that scales much better than hand editing.

Tom



More information about the coin-dev mailing list