Very Confused Variable

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Very Confused Variable

joe mcverry-2

The following trace shows a problem with a variable.  It seems to
thinkit's 8 characters long.  But look at the trace, see below, when the
variable is displayed by its value and length the value length is 7 but
the variable thinks its length is 8 Note: there is one space between
the the value and the length "Heading 8".  That space should be the same
one as in the "say" statement.



This error causes the "IF" statement to skip its then clause.  And yes,
a "trim" was called prior to the "say" statement

Any Suggetions?

trace output starts
  326 *=*           trace all
  327 *=*           say grouplevel grouplevel.length()
Heading 8
  328 *=*           if grouplevel = 'Heading'
  329 *=*           else
trace output ends


System:
os/2 warp 4.0
java 1.1.6 - latest
netrexx 1.144 (I was using 1.121 when problem was first noted)
The following trace shows a problem with a variable.  It seems to
thinkit's 8 characters long.  But look at the trace, see below, when the
variable is displayed by its value and length the value length is 7 but
the variable thinks its length is 8 (note: there is one space between
the the value and the length "Heading 8".)  

This error causes the "IF" statement to skip its then clause.  And yes,
a "trim" was called prior to the "say" statement

Any Suggetions?

trace output starts
  326 *=*           trace all
  327 *=*           say grouplevel grouplevel.length()
Heading 8
  328 *=*           if grouplevel = 'Heading'
  329 *=*           else
trace output ends


System:
os/2 warp 4.0
java 1.1.6 - latest
netrexx 1.144 (I was using 1.121 when problem was first noted)

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Joe McVerry
mailto:[hidden email]
http://www.americancoders.com/
American Coders, Ltd.         P.O.Box 97462        Raleigh NC 27624 USA
1-919-846-2014
Home of RexxBase - (dBase Access for Rexx)
Home of xBaseJ - (dBase Access for JAVA)

--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Joe McVerry
mailto:[hidden email]
http://www.americancoders.com/
American Coders, Ltd.         P.O.Box 97462        Raleigh NC 27624 USA
1-919-846-2014
Home of RexxBase - (dBase Access for Rexx)
Home of xBaseJ - (dBase Access for JAVA)

nsmailKD.TMP (314 bytes) Download Attachment
vcard.vcf (464 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Very Confused Variable

Mike Cowlishaw-2
Possibly there's a non-displaying character in there, like
backspace -- try displaying the characters in hexadecimal?
(e.g., using a loop and  the c2x method).

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Mike Cowlishaw, IBM Fellow, IBM UK Laboratories
mailto:[hidden email]  --  http://www2.hursley.ibm.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

A performance question...

mcbrides
Would anyone care to share their thoughts concerning...

I tend to write very reusable java, in that for a given project I'll write many
classes that can be reused, over and over in other projects. In fact, its very
often that all I need do is grab a class or two from my "toolkit" and write
some gluecode and I'm done... <G> But lately, I'm wondering of all of this
reusability is costing me anything in the performance of my finished
application.

Basically, is there a performance penalty of any consequence by coding with
many classes (reusing established resources) versus rewriting the code using
fewer classes?

When I worked in C, Basic or even in REXX, each project ended up being
completely new code with very little of it actually being reused from other
projects. They ended up being highly tuned, often very specific in their nature.
Now, in java, I find myself grabbing for a class, even if all I need is a
single method from that class... How "sloppy" is this and what/how do the
professionals handle this?

Just curious how everyone else does their programming I guess...

Cheers,




--

/--------------------\
| Jerry McBride      |
| [hidden email] |
\--------------------/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: A performance question...

Massimiliano Marsiglietti
> Basically, is there a performance penalty of any consequence by coding
> with many classes (reusing established resources) versus rewriting the
> code using fewer classes?

I thought that the main point about o-o programming was reusing
code? I try to reuse as much as I can, while trying to profile and
minimizing impact of o-o slowness on my code.. For example, Ibm
published some neat papers on the subject at the VisualAge
Developer Domain (speeding up loops and things like that); they
are really worth reading.

Max

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: A performance question...

mcbrides
>> Basically, is there a performance penalty of any consequence by coding
>> with many classes (reusing established resources) versus rewriting the
>> code using fewer classes?
>
>I thought that the main point about o-o programming was reusing
>code? I try to reuse as much as I can, while trying to profile and
>minimizing impact of o-o slowness on my code.. For example, Ibm
>published some neat papers on the subject at the VisualAge
>Developer Domain (speeding up loops and things like that); they
>are really worth reading.
>

Max, you happen to have a url to start with? The VADD is a big site. <G>

Thanks,

--

/--------------------\
| Jerry McBride      |
| [hidden email] |
\--------------------/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: A performance question...

dIon Gillard/Multitask Consulting/AU
In reply to this post by mcbrides


"I tend to write very reusable java, in that for a given project I'll write
many
classes that can be reused, over and over in other projects. In fact, its
very
often that all I need do is grab a class or two from my "toolkit" and write
some gluecode and I'm done... <G> But lately, I'm wondering of all of this
reusability is costing me anything in the performance of my finished
application.

Basically, is there a performance penalty of any consequence by coding with
many classes (reusing established resources) versus rewriting the code
using
fewer classes?"

Yes and no. There is a performance penalty for every object creation and
method call at runtime.
There is a performance penalty at development time for rewriting code.

It's a balance.

"When I worked in C, Basic or even in REXX, each project ended up being
completely new code with very little of it actually being reused from other
projects. They ended up being highly tuned, often very specific in their
nature.
Now, in java, I find myself grabbing for a class, even if all I need is a
single method from that class... How "sloppy" is this and what/how do the
professionals handle this?

Just curious how everyone else does their programming I guess..."

If you're really worried about it, when your application is done, run it
through a tool like IBM's JAX.

It strips out unwanted code.

dIon


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: A performance question...

mcbrides
-- snipped my own text --

>Yes and no. There is a performance penalty for every object creation and
>method call at runtime.
>There is a performance penalty at development time for rewriting code.
>
>It's a balance.
>

Yeah. That's about what I figured... Anyway, working with netrexx I've been
whipping the devil out of that balance you mentioned... <G>

-- snipped my own text --

>If you're really worried about it, when your application is done, run it
>through a tool like IBM's JAX.
>
>It strips out unwanted code.
>

Yes. I looked at the Jax product. It works as advertized, but I don't care much
for the AlphsWorks license very much... <G> Anyway, it'll probably be pulled
shortly and tucked into one of those ENTERPRISE development packages... <G>

Thanks, Dion.

--

/--------------------\
| Jerry McBride      |
| [hidden email] |
\--------------------/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: A performance question...

Massimiliano Marsiglietti
In reply to this post by mcbrides
Since "curiosity killed the cat",

I am answering this here:


> >I thought that the main point about o-o programming was reusing
> >code? I try to reuse as much as I can, while trying to profile and
> >minimizing impact of o-o slowness on my code.. For example, Ibm
> >published some neat papers on the subject at the VisualAge
> >Developer Domain (speeding up loops and things like that); they
> >are really worth reading.
> >
>
> Max, you happen to have a url to start with? The VADD is a big site. <G>

There are several papers on the subject in the "technical articles"
section of VADD, and you need to be a subscriber to get there I
think..

If you do a "show all" after having choosed "technical articles" you
will find them (many articles are about products like VA Java,
S.Francisco Framework etc, but nonetheless there are also some
generic articles regarding performance issues).

Max

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: A performance question...

Dr Tony Dahlman-2
In reply to this post by mcbrides
> Basically, is there a performance penalty of any consequence by coding
> with many classes (reusing established resources) versus rewriting the
> code using fewer classes?

As has been said, the performance issues are described (at a fairly
low level) on VADD:

  http://www7.software.ibm.com/vad.nsf   

When I re-use code from other projects, and *if* the code is still
any good, there is one basic consideration and three options:

Basic consideration:  Although disk access is now incredibly fast,
the disk drive has been replaced by the network.  Lowest common
denominator there is the Internet and modems, i.e. 28K/sec., so
size of code still counts, even if you know your clients will be
able to get the code from a .jar file.

Option 1. Cut and Paste the method into your new class and go ahead
and make those two or three little changes you would have put in to
begin with if you had known then what you know now.  ;)

Opetion 2. Make the user load the old class but, for just a few calls
(to the same method ? ), don't make them instantiate the class.
Make the method static so they don't have the overhead of making an
object as well as loading the class.

Opetion 3. Use the old class and code as is.

Hmm... What's wrong with option 1?

- Tony Dahlman

Surgery, Surgeons and You <http://www.jps.net/adahlman/>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>