Article View: aus.computers.java
Article #977Re: Can somebody help with mine too!? I'm desperate!
From: Darren Latham
Date: Thu, 04 Nov 1999 00:00
Date: Thu, 04 Nov 1999 00:00
54 lines
2436 bytes
2436 bytes
Hi John.
I'm not going to answer your question unless I get carried away, but, I do have
some observations about your style of code. If you are serious about
programming get yourself a copy of Code Complete by Steve McConnel - its the
best discussion of good programming style I've read so far (whether you agree
with has comments or not).
Comment 1 - which will not help you in anyway
---------------------------------------------
Firstly, its well worth making your braces line up. I personally hate the Java
style
try {
}
catch {
}
and much prefer
try
{
}
catch
{
}
as I find it much clearer. That's a personal preference, but which ever style
of bracing you choose be consistent about it. It makes debugging programs much
easier.
Comment 2 - which may help you (I've just spotted your problem I think)
-----------------------------
You spend a lot of time within a while loop changing the value of a flag which
then controls what happens within the loop. This style of coding is really hard
to maintain and it can be very difficult to see what is going on (as you have
found as your code doesn't work and you can't see why
You are obviously trying to find keywords enclosed in '<' and '>' characters, so
it would seem reasonable to create a new method on the class which is called
once a '<' character was found to read in the keyword stopping either at the end
of the file (probably error condition), or, when a '>' was encountered.
Comment 3 - Of less help than the others
----------------------------------------
Calling a class junk.java doesn't exactly put you in a good frame of mind to
write quality code.
Cheers,
Darren
--
www.soft.net.uk/briarlea
www.salmon.ltd.uk
Technical Details
Message-ID:
<7vs1le$2j5$3@lure.pipex.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<38217153.BD675400@tig.com.au>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d6db,a209a3ce5748943 X-Google-Attributes: gid10d6db,public From: "Darren Latham" <dlatham@salmon.ltd.uk> Subject: Re: Can somebody help with mine too!? I'm desperate! Date: 1999/11/04 Message-ID: <7vs1le$2j5$3@lure.pipex.net> X-Deja-AN: 544377927 References: <38217153.BD675400@tig.com.au> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 X-Complaints-To: abuse@uk.uu.net X-Trace: lure.pipex.net 941722094 2661 193.149.70.129 (4 Nov 1999 13:28:14 GMT) Organization: UUNET WorldCom server (post doesn't reflect views of UUNET WorldCom NNTP-Posting-Date: 4 Nov 1999 13:28:14 GMT Newsgroups: aus.computers.java