I took a stab at a very crude draft for the first page or two of a
beginners guide. Does anyone else want to try or does anyone have
any simple examples showing what NetRexx can do or how it works with
Java? What areas need to be discussed for newcomers? The Java
libraries? IDEs? Objects (OO)? Scripting? Tracing? Parsing?
Indexing?
The following is actually a web document so I put it on the web in case it does not come through very well in email format: http://kermitkiser.com/NetRexx/Beginner%27s%20Guide%20to%20NetRexx.html Please pardon the plug for NetRexxScript, but I don't know any easier way for beginners to try things at this time. -- Kermit Beginner's Guide to NetRexxIntroductionNetRexx is the best computer programming language available. You might suspect that the writer is biased and you would be correct. However, if you program for a little while in NetRexx, you may just end up with the same bias! I say that after spending over 30 years writing computer programs in a variety of computer languages including things like COBOL, FORTRAN, various assembly languages, APL, BASIC, REXX, JCL, CLIST, C, PERL, etc, etc. And some NetRexx programmers I know have far more language experience than mine.This guide assumes that the reader has some familiarity with computer programming and knows what computer languages are, as well as why there are compilers or translators for those languages. You may have heard that NetRexx is "compatible" with the Java programming language or that NetRexx is a "dialect" of Java or some similar statement. While there is truth in those statements, they can also be misleading. This document will try to clarify the relationship between NetRexx and Java as well as giving an idea of what can be done with NetRexx. If you want to verify that the examples in this guide actually work, you will need to first wade through the NetRexx installation document to get a minimal development environment running. An easier way to try things if you are familiar with the "jEdit" file editing environment or have a few minutes to try it out, is to install the NetRexxScript plugin from the jEdit Plugin menu and cut and paste the examples into that environment. What is NetRexx?In a practical sense, NetRexx is a completely different language than Java but it just happens to be able to use any Java objects and to run anywhere that Java can run. Under the hood, NetRexx code can be converted into Java code by the NetRexx Translator and compiled to create Java objects that are just like those produced by Java programmers. But NetRexx code can also be directly interpreted as a scripting language by the NetRexx Translator which runs in a Java Virtual Machine (JVM). With a suitable IDE, NetRexx code can even be compiled to run in environments similar to the JVM such as the Dalvik VM used on Android devices like cellular phones and tablets.Why NetRexx instead of Java?The NetRexx language was inspired by the REXX scripting language and follows the same principles. The main principle is that the language should be easy for programmers to read and write without regard for how difficult it might be for a computer to understand. That is why NetRexx does not use special characters or indentations to signal program structure to the Translator like other languages such as Java may use. NetRexx was created by Mike Cowlishaw, who was working for IBM at the time and who also wrote the primary NetRexx book ("The NetRexx Language") as well as the NetRexx Translator.What can you do with NetRexx?The short answer is: Anything! More precisely, because NetRexx can produce Java programs and run in most Java environments, you can do anything with NetRexx that a Java programmer could do in Java. Can you write GUI (graphical user interface) programs with NetRexx? Yes! Can you write major applications in NetRexx? Yes! Can you write NetRexx programs which call Java code? Yes - all of the Java classes and objects in any Java libraries available can be used by NetRexx programs.What can you NOT do with NetRexx?Not much. But you cannot mix Java source code with NetRexx source code - they are different animals and the translators for each language will choke if they see code from the other language.Enough propaganda - show meEvery programming language intro is obligated to start with the traditional "Hello World" program so here it is in NetRexx:say "Hello World"
OK, no big deal - lots of languages can do that program in one line. But how many can do an Internet browser in one line? Here is one in NetRexx (Pass a web address to this program): say URL(arg).getcontent
Granted, that program is of limited use since it only tells you if a web document exists but that is more than enough to do stress testing or access verification for web sites, so it can be considered a practical application and an interesting NetRexx example. Let's get graphicalMaybe you want to know how easy it is to do something more complex, perhaps with a GUI interface. Try this program (move your mouse pointer in the window while pressing the mouse button):class pencilapp extends Applet x =int 0 ; y =int 0 method mouseDrag(e=event,i=int,j=int) public returns boolean getGraphics.drawLine(x,y,i,j) x = i ; y = j return 1 method mouseDown(e=event,i=int,j=int) public returns boolean x = i ; y = j return 1 method main(argv=String[]) public static p=pencilapp() f=Frame("pencil test") f.resize(400,300) f.add("Center",p) f.show()The above graphical drawing program can run all by itself or can be imbedded in a web document. What about Java objects?The examples above make use of various Java classes or objects, such as the URL class, the Applet class and the Frame class. Java items like these can be used directly in NetRexx program without doing anything special. (The assumption here is that you have a valid Java environment available to run programs in, of course.)For example, the Java library documentation tells us that there is a "Date" class which can be used to create a Date object for the current time: Date()
Allocates a Date object and initializes it
so that it represents the time at which it was allocated, measured
to the nearest millisecond.This Java object can be created and displayed as a string by NetRexx with the following statement: say Date() In fact that one line is a complete NetRexx program that creates and then displays a Java object in a text format . The conclusion that you should draw is that it is very easy to work with Java items from within NetRexx. Often easier than it would be from Java itself. _______________________________________________ Ibm-netrexx mailing list [hidden email] |
I was just getting excited when the document came to an end :-( However this is an excellent start, and I commend you for it. We really should have a Wiki where we could collaborate on things like this. What we have here is an example of C.A.R. Hoare's "Communicating Serial Processes." Nice job, Tom. _______________________________________________ Ibm-netrexx mailing list [hidden email] |
In reply to this post by Kermit Kiser
On 10/30/2010 2:58 AM, Kermit Kiser wrote:
I took a stab at a very crude draft for the first page or two of a beginners guideI forgot to mention: it might be nice if your hyperlinks -- at least the ones for Java objects -- pointed to the online Java doc, like so: Date() That would really enhance the value of the Guide, and expose beginners to the API documentation at an early stage -- hopefully removing the fear (or awe) that sometimes comes on first glimpse of the doc. "Where do I start?!" "What is all this stuff!?" etc. But, if you're "backed" into the doc while unraveling a NetRexx example I think it's an excellent introduction. does anyone have any simple examples showing what NetRexx can doDavid Requena has the NetRexx FAC on his wiki ... I've been sifting through it and there are some really nice examples there. I need to find my copy of "Java in a Nutshell" so I can put all the code in the proper order. What areas need to be discussed for newcomers? The Java libraries? IDEs? Objects (OO)? Scripting? Tracing? Parsing? Indexing?Um ... yes. <g> I'm going to have to spend some time in the wayback machine to remember what I stumbled over when I began. My first Java program was purely imperative code (not counting the required class/main statements) ... I was quite proud of it. Objects came next. Tom. _______________________________________________ Ibm-netrexx mailing list [hidden email] |
Tradition has it: Say "Hello World" . . .
Bob H On Sat, Oct 30, 2010 at 12:20 PM, Tom Maynard <[hidden email]> wrote:
_______________________________________________ Ibm-netrexx mailing list [hidden email] |
In reply to this post by Kermit Kiser
My comments in the text....
On 30 Oct 2010, at 08:58, Kermit Kiser wrote:
To improve brevity, change the above line to: programming in
REXX is a lot more than a scripting language, suggest changing above to: programming
delete:
Sounds about right.
Ho ho! A bit of revisioning here! In addition, this definitely does not follow from the previous sentence, eg using 'special symbol' ÷ for divide rather than / would be easier for a new user but more difficult for the computer, ie using special symbols would be perfectly in accord with that aim of the language. MC has stated why he did not use special characters in REXX. Prior to Tabetha and Python (etc), the idea of functional indentation hadn't been invented. NetRexx simply followed REXX. I'd like to suggest that we keep this factual rather than reinventing the past to suit the author's current position.
Suggest you comment the program; makes it easier for newbies (and everyone else) to understand.
Thanks _______________________________________________ Ibm-netrexx mailing list [hidden email] |
In reply to this post by Kermit Kiser
On Sat, Oct 30, 2010 at 2:58 AM, Kermit Kiser <[hidden email]> wrote:
> What can you NOT do with NetRexx? > > Not much. But you cannot mix Java source code with NetRexx source code - > they are different animals and the translators for each language will choke > if they see code from the other language. I'd recommend flushing this out a bit more -- you can use java code with your netrexx code just fine, but they have to be split apart, compiled at different stages. Pat. -- Defy mediocrity. _______________________________________________ Ibm-netrexx mailing list [hidden email] |
I'm asking for information -- not trying to argue -- but what about:
say date() or Parse Date() ?? Are each of these compiled in two steps?? Bobh
On Tue, Nov 2, 2010 at 7:13 AM, Patrick Forhan <[hidden email]> wrote: On Sat, Oct 30, 2010 at 2:58 AM, Kermit Kiser <[hidden email]> wrote: _______________________________________________ Ibm-netrexx mailing list [hidden email] |
Bob,
On 2 November 2010 06:20, Robert Hamilton <[hidden email]> wrote: -- I'm asking for information -- not trying to argue -- but what about: That's what started this whole thread; you're confusing/conflating Java the library with Java the language. Date (java.util.Date) is a class in the Java library; it's not part of the Java language per se. As with all (or most all) of the Java library you're at liberty to use the classes freely within NetRexx programs but you must use NetRexx syntax to invoke their methods. Alan Can't tweet, won't tweet! _______________________________________________ Ibm-netrexx mailing list [hidden email]
Alan
-- Needs more cowbell. |
In reply to this post by Robert L Hamilton
Bob,
Now that you have a working NetRexxDE you can check easily for yourself. Use the button with the java icon (the coffee cup) and you'll be presented the corresponding intermediate java code in a new buffer. - Saludos / Kind regards, David Requena -----Original Message----- From: Robert Hamilton <[hidden email]> Sender: [hidden email] Date: Tue, 2 Nov 2010 08:20:01 To: IBM Netrexx<[hidden email]> Reply-To: IBM Netrexx <[hidden email]> Subject: Re: [Ibm-netrexx] Beginner's Guide to NetRexx _______________________________________________ Ibm-netrexx mailing list [hidden email] _______________________________________________ Ibm-netrexx mailing list [hidden email] |
Thank you; I stumbled across it by mistake.
bobh On Tue, Nov 2, 2010 at 10:39 AM, David Requena <[hidden email]> wrote: Bob, _______________________________________________ Ibm-netrexx mailing list [hidden email] |
In reply to this post by alansam
This is very good!
It seems that in spite of our best efforts, we still cannot clarify the difference between Java, NetRexx and the Java libraries that are provided with the JVM well enough for Bob. That's good info if we don't let it discourage us. Perhaps a few more iterations would help. How do we show that the external functions/objects that you can call from NetRexx don't need to be compiled and are simply part of the run time environment that can be called as if they were BIFs? And what background info do I have that Bob is lacking that makes it hard for me to understand what his question is? Objects? Compilers? Libraries? BTW: I have updated the draft document with some of the suggestions so far and have added a link to a page to allow trying the GUI example in a browser since it looks like this will be primarily a web document anyway. Do we have a WIKI area yet to allow easier collaborative work on this? http://kermitkiser.com/NetRexx/Beginner%27s%20Guide%20to%20NetRexx.html -- Kermit On 11/2/2010 8:15 AM, Alan Sampson wrote: Bob, _______________________________________________ Ibm-netrexx mailing list [hidden email] |
In reply to this post by alansam
This is a downside of having things automatically translated from NetRexx usage to Java usage (eg, classes and types): the newcomer is left in a state of confusion about the precise meaning of what he has written.
I wonder if some illuminating demonstrations could be built around Options StrictAssign StrictImport? On Tue, Nov 2, 2010 at 11:15 AM, Alan Sampson <[hidden email]> wrote: Bob, _______________________________________________ Ibm-netrexx mailing list [hidden email] |
Which is true to a large extent. I remember being confused by when there was a 'new' done and when not. But in defence of NetRexx I must say: look at the generated Java source (which I always -keep and rename to .java myself, for use in JavaDoc) and it all becomes clear. This is just like not understanding COBOL move behaviour until you see the assembly listing. I can truly say I learned Java workings through NetRexx and not the other way around.
Personally, I think clear definitions of what constitutes a language, a compiler, a library, a class file, should help. There are probably lots of things you can do before knowing these intimately, but it requires great powers of imagination what these are, because when you know, your mental image of these concepts is changed forever. René. On 3 nov 2010, at 01:47, George Hovey wrote: This is a downside of having things automatically translated from NetRexx usage to Java usage (eg, classes and types): the newcomer is left in a state of confusion about the precise meaning of what he has written. _______________________________________________ Ibm-netrexx mailing list [hidden email] |
IMHO it would be much easier if the tspecification explicitly stated tha in the reference implementation: 1 - automatic conversion is performed between String and Rexx types and vice versa. 2 - in the context of "say" and "parse" instructions any type (class) will get its toString() method called (via String.valueOf() in parse's case). Then the resulting String representation will be converted to Rexx as per rule 1 above. 3 - No other conversions are implicitly performed by the language processor. As things are now, nothing in the specification explains why or how things like "say Date()" or "parse Date() foo bar" do actually work. Again IMHO peeking at the java intermediate code, while being a worthy exercise, shouldn't be the only way to know what's going on. - Saludos / Kind regards, David Requena -----Original Message----- From: René Jansen <[hidden email]> Sender: [hidden email] Date: Wed, 3 Nov 2010 10:03:42 To: IBM Netrexx<[hidden email]> Reply-To: IBM Netrexx <[hidden email]> Subject: Re: [Ibm-netrexx] Beginner's Guide to NetRexx _______________________________________________ Ibm-netrexx mailing list [hidden email] _______________________________________________ Ibm-netrexx mailing list [hidden email] |
I second that. . .
Is there a way to change the formatting of the JAVA code -- If that's what you call the -KEEP stuff ??? bobh PS: also got Exception in thread "main" java.lang.NullPointerException at COM.ibm.netrexx.process.NetRexxC.process(NetRexxC.nrx:212) at COM.ibm.netrexx.process.NetRexxC.main2(NetRexxC.nrx:123) at COM.ibm.netrexx.process.NetRexxC.main(NetRexxC.nrx:82) from the red flashing msg tab after the abort msg appeared bobh. On Wed, Nov 3, 2010 at 5:11 AM, David Requena <[hidden email]> wrote:
_______________________________________________ Ibm-netrexx mailing list [hidden email] |
Found 'noformat' so I check noformat to get formatting. I guess that's not weird to JAVA folks, but it confusing to me.
Bobh On Wed, Nov 3, 2010 at 5:27 AM, Robert Hamilton <[hidden email]> wrote: I second that. . . _______________________________________________ Ibm-netrexx mailing list [hidden email] |
Yes, Bob
The default option is to nicely format the resulting java. This makes it more readable. On the other hand line numbers in stack traces won't correspond to line numbers in you NetRexx source code. When you use noformat the outcome is the inverse. --- Saludos / Kind regards. David Requena El 03/11/2010 11:34, Robert Hamilton escribió: Found 'noformat' so I check noformat to get formatting. I guess that's not weird to JAVA folks, but it confusing to me. _______________________________________________ Ibm-netrexx mailing list [hidden email] |
In reply to this post by Kermit Kiser
On Sat, Oct 30, 2010 at 4:58 AM, Kermit Kiser <[hidden email]> wrote:
> I took a stab at a very crude draft for the first page or two of a beginners > guide. Does anyone else want to try or does anyone have any simple examples > showing what NetRexx can do or how it works with Java? What areas need to be > discussed for newcomers? The Java libraries? IDEs? Objects (OO)? Scripting? > Tracing? Parsing? Indexing? Web page scrapping. :) With sugar on top, please. :) FC _______________________________________________ Ibm-netrexx mailing list [hidden email] |
In reply to this post by Kermit Kiser
On Sat, Oct 30, 2010 at 2:58 AM, Kermit Kiser <[hidden email]> wrote:
> I took a stab at a very crude draft for the first page or two of a beginners > guide. I read through your revised document, and it is definitely moving in the right direction. I'm a long-time Java programmer who used to script REXX code on a MUSIC/SP system. I'm sad to say I haven't done anything serious with NetRexx, but I've been watching it for years now. So, I am a newcomer to the language still. I'm not entirely sure who your audience is for this guide, however. If you are trying to attract Java developers, it's definitely too chatty and is missing some common terms that they would recognize. If it is for REXX folks, it seems to pay little heed to the older language. Perhaps that's what the first page should be: a quick description of the language, followed by links to sections or other pages with titles like "NetRexx for Java/JVM Developers" and "NetRexx for REXX developers". Maybe one for folks new to programming if we have the time. OK, some things to consider: General: - I'd recommend getting to the Hello World code sooner. Perhaps even without mentioning that it is powered by the JVM. - You've misspelled "imbedded" (should start with an E) - recommend one "Hello, XX" sample where you read from args or standard in and use that value in the output. Just another common sample program. The say URL... example is great. For a Java track: - I'd collapse a lot of the description text into a simple summary: NetRexx is a JVM language. This is common parlance for Java developers, and instantly brings with it a wealth of information. The Java Libraries are available, it's deployable as JAR files, etc. You could also say it is a language that targets the JVM. It's worth mentioning, in passing, that the compiler can emit java code. - We should discuss whether this is a scripting language (can interpret new rexx code at runtime), a compiler, or both. Examples in the java world would be BeanShell as an interpreted scripting language, Groovy as both interpreted or compiled. - Especially in cases where you're highlighting the terse readability of NetRexx, show the equivalent java code side-by-side. This should show some big wins. - So, while NetRexx interoperates with Java just fine, the language of the guide seems a bit charged, e.g., "Why NetRexx instead of Java". This should be reworded along the lines of "how to integrate NetRexx into your project". Many projects are polyglot in this fashion. - discuss performance implications of things like automatic conversions, etc, if noteworthy. - discuss the typing system - dynamic (an object's type is based on what was last assigned to it) or static For a REXX track: - lightly talk on the differences and similarities between REXX and NetRexx. Show side-by-side code here, too, if possible. -- Defy mediocrity. _______________________________________________ Ibm-netrexx mailing list [hidden email] |
In reply to this post by David Requena
But when I check noformat do I get formatted JAVA or do I get UNFormatted JAVA. When I check NoComments I get Comments. This is illogical to me; maybe not to JAVA people.
BobH
On Wed, Nov 3, 2010 at 7:56 AM, David Requena <[hidden email]> wrote:
_______________________________________________ Ibm-netrexx mailing list [hidden email] |
Free forum by Nabble | Edit this page |