Skip to main content

What Do you Think? A Proposal to Java Language For String

No replies
mijzcx
Offline
Joined: 2004-09-11
Points: 0

Hello Java Community,

As a Java Developer, my concern to Java Language future is this.

I would like to ask your vote and opinion on this?

Target: java language.

Traditionally we wrote:

public static void main( String[] args )
{
String vstat1, vstat2;

vstat1 = "The quick brown " +
"Fox jumps over " +
"The lazy dog. ";

vstat2 = vstat1;

System.out.println( vstat1 + " " + vstat2);
} // main()

My Proposal:

public static void main( String[] args )
{
string
{
The quick brown
Fox jumps over
The lazy dog.
} vstat1, vstat2;

System.out.println( vstat1 + " " + vstat2 );

} // main()

Projected benefit:
1. Easy to cut and paste especially for sql statements
run-checks.
2. Easy to read.
3. Less typing, no quotes and plus sign.
4. Look! Is it it easy, what do you think?

Yes, i am aware of phython multiline string.
http://docs.python.org/tut/node5.html#SECTION005120000000000000000

As To My Proposal: (Fig1)

public static void main( String[] args )
{
string
{
The quick brown
Fox jumps over
The lazy dog.
} vstat1, vstat2;

System.out.println( vstat1 + " " + vstat2 );

} // main()

The "string" here in (Fig1) is a keyword. There shall be distinction between a
String class and a keyword "string" for multiline code presentation.
Inside the brackets is a "message" presented as wordwrap of a long line
message synonymous to message string we traditionally wrote in one line. Resulting to a
long one line output message. The vstat1, and vstat2 variables are String variables
that automatically gets the message assigned.

This I endorsed as a solution to our traditional way of string multiline
presentation - as we all know that it stinks specially on SQL construct
or to some of our embbedded scripting in respect.

Embedded Scripting is a delicate part in programming. One miss or error
in spelling is a big distraction. IDEs are neutral to this string
presentations. This are all treated as raw, same way may it be a script
language embbeded or just a mere "quick brown fox".
We are (The Java Community especially at the DAO side) all
aware that scripts should be tested first before we embbed.

Outside file resources only offer another clumsiness on scripting
side. On one side we would not allow somebody an end user to alter our scripting, a
good example is SQLs. The aim is this, scriptings should be
easy enough to copy and paste from java source to executable scratch pad of the
scripting language of choice. Like for example for MySQL, I need to run first my
console mysql> or any SQL Manager Application and copy paste it to my console
in order to get an assurance that my scripts would run smoothly.
Now in debugging I am already confident that it is not my scripts
who are making some nuisance.

Traditionally we wrote: (Fig2)

public static void main( String[] args )
{
String vstat1, vstat2;

vstat1 = "The quick brown " +
"Fox jumps over " +
"The lazy dog. ";

vstat2 = vstat1;

System.out.println( vstat1 + " " + vstat2);
} // main()

In Fig2 traditionally we wrote like that. In debugging DAO, I first run a notepad or something;
transfer the strings into it; cleanup the quotes and plus signs; then copy and paste it
to the console or sql manager apps; then modify if theres some wringkles; then from
the notepad copy paste again to my java code; then add again a "quotes and a plus sign"
or aStringBuilder.append("again"); aStringBuilder.append("and again and so on"); - just
to envision this good practice. What a worst isnt it?

For embedded xml, yeah you can define also with this kind of construct
(Fig3 below). But not XML embedded language as part of Java language in which
I don't agree, for it will only cause Language Pollution or Confusion. Now vxml1(Fig3 below)
you can now use it like any other strings. And finally (Java)
with its "string" as keyword, Java should be distinct from other language,
especially C# were string and String means the same thing. Isn't it?

(Fig3)

string {
<?xml version="1.0"?>

Some thing like that.

} vxml1;

Sqlj in Oracle and DB2 #sql keyword already has this kind of concept,
but only concentrate to sql construct. You pre-compile first to sqlj
compiler then to javac so to say. As to my concern, I have this strong vibe
that there have been impluse already from the Java Community on kind of
problem I address. As I base this on my experience in programming particularly
in embedding scripting languages; making us like chasing cats and dogs in
debugging stage. Me, particular to SQL Scripting in DAO part.

In My Humble Opinion,

-Melvin