aspose file tools*
The moose likes Cattle Drive and the fly likes Combining two definitions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Combining two definitions" Watch "Combining two definitions" New topic
Author

Combining two definitions

Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
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 ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Michael Matola
whippersnapper
Ranch Hand

Joined: Mar 25, 2001
Posts: 1746
    
    2
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
Ranch Hand

Joined: Mar 25, 2001
Posts: 1746
    
    2
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

Joined: Aug 03, 2002
Posts: 7729
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 ]
 
Consider Paul's rocket mass heater.
 
subject: Combining two definitions