• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Combining two definitions

 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Fellow agents,
I have something like:
Now M suggests that I combine these two statements.
All I can think of is something like:

Now that I would definitely put in the SCJP2 "guess what this code does" category.
What on earth is M at? I don't want a solution just a couple of hints.
==================================================
Hmmm, an afterthought. If I change perspective and reorganize a loop I have following these statements then I can eliminate one of these string variables. I wonder if that is what M was driving at?
-Barry
No exceptions, no javadoc, no private constructors, no fancy stuff,... what's the world coming to?
[ October 20, 2002: Message edited by: Barry Gaunt ]
 
whippersnapper
Posts: 1843
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Barry Gaunt:

What on earth is M at? I don't want a solution just a couple of hints.


Cattle Drive participants excel at cryptic hints.
There are numerous reasons for introducing an identifier: reuse, readability, etc. If an identifier doesn't serve a good purpose, why bother with it?
If I change perspective and reorganize a loop I have following these statements then I can eliminate one of these string variables. I wonder if that is what M was driving at?
Don't know. Sometimes a comment from the nitpicker has led to me changing a single space character in my program, other times it's led to sweeping changes that amount to a rewrite.
Decide how to address the nitpicker's comments and resubmit the assignment. Repeat as necessary.
No exceptions, no javadoc, no private constructors, no fancy stuff,... what's the world coming to?
Small steps.
Most (all?) of the earlier assignments tell you how many lines are in the instructor's solution. While I don't think anyone should be concerned with trying to match the number of lines exactly, if your program is dramatically longer (for example, your program is 50 lines but the instructors is only 25), you might want to step back and take another look at your approach.
[ October 20, 2002: Message edited by: Michael Matola ]
 
Michael Matola
whippersnapper
Posts: 1843
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You said that the nitpicker's suggestion was to combine these two "statements," but you named this thread Combining two definitions.
Sure we're all talking about the same thing?
(What's a "definition" by the way? I know what declarations and initializations are in Java.)
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many thanks Michael! Confirms the way I'm starting out to think now... must have hit my head when I landed in the corral (or was a kick from the horse, don't know any more.)
Argh, the term "definition" comes from C/C++. Have to tighten up on terminology there.
What's interesting (aka horrifying) is that the program I took 5 minutes to write (code only) and run correctly is taking 5+ DAYS to get through the "mangle". And I chose the simple one just to get a handle on the coding style.
-Barry
[ October 20, 2002: Message edited by: Barry Gaunt ]
 
Friends help you move. Good friends help you move bodies. This tiny ad will help:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic