Novice linux java coder needs help getting progs to run

R

Roedy Green

Why? It looks daft and is more hassle to type on systems which are case
sensitive (ie almost all of them except Windows).

Because most jobs are team programming jobs or jobs where you have to
hand over your source to the client. Other people reading your code
PRESUME the conventions. It is like a pointless little electric shock
every time you violate them. Your attitude would get you fired almost
immediately.

"Let us change our traditional attitude to the construction of
programs. Instead of imagining that our main task is to instruct a
computer what to do, let us concentrate rather on explaining to human
beings what we want a computer to do."
~ Donald Ervin Knuth (born:1938-01-10 age: 71)
 
M

markspace

Lew said:
But of course you really do have many test cases, and showed only one in
order simply to make a point. Why show the entire directory when one
example file suffices?

Yeah, that's the ticket.


There's one additional test case not shown, embedded in the main driver
(RegexTester.java) so that I can "run this file" and it'll produce a
test case. That was my first file so the test case ended up embedded
within the file itself, since it started as a simple bench check.

But really, 90% of this code is generated GUI that you'd have to check
by hand anyway, in an ad hoc manner. I don't think it lends itself well
to automated test suites. And 90% of the debugging I did was devoted to
JTextPane, which true to its name was a pain. That class has got some
weird corner cases.

The driver (controller) in this code is a dead simple application of the
Matcher class. Not much to test.
 
R

Roedy Green

No offense, but any coding conventions that go into such anal detail as
when and how to capitalise names and where to place brackets I'm really not
interested in adhering to.

Posting code that spits on the conventions is like putting a tag line
"**** you". It is similar to using deliberately incorrect spelling,
grammar etc. It shows a deliberate desire to make life difficult for
others. It is symptomatic of a narcissistic selfish personality,
hardly the optimum face to put on oneself when soliciting free advice
from others.

Languages have rules to aid communication between humans. Java,
especially when quoted in newsgroups, has that purpose.

People who babble to others in private languages of their own devising
tend to get treated as mentally defective, sometimes even confined in
protective custody. The same thing happens to a milder degree on a
newsgroup where people plonk you to avoid dealing with the irritation.
 
B

boltar2003

Hopefully you won't tell them that you based this recommendation on your
aversion to Java's coding conventions. Seeing as how every other
language out there has them too, and good programmers follow them.

Nothing to do with coding conventions. If portability between platforms
is required then Java makes a lot of sense. We don't require portability
and most of the staff including me are C++ coders. *shrug*
Considering that 24 hours ago you were stumped when attempting to run a
single compiled class on the command line you might want to learn
something of the language before deciding that it stinks.

That was just learning the quirks of one particular runtime. Most programs
I've worked with are smart enough to attempt to open the filename you gave
them first before appending their own file extension on the end. Not suns
jre it seems. But no excuses , I should have RTFM first.

B2003
 
R

Roedy Green

I'm interested in making life easier for myself first and foremost. Why should
others take priority when I'll be the one writing and no doubt maintaining
the code?

Because you are posting it for others to read and help you.
Several people have told you they find you doing that makes them
annoyed with you, and hence less likely to give you the answers you
crave.

Because the conventions help you too. Because the conventions are a
necessary part of the skill required to program in Java for a living.

If you deliberately develop bad habits, and you later decide you want
to write code for others, or share your efforts, you will have to
clean it up, and break your old bad habits. It is so much easier to do
it correctly the first time.

Because you are an arrogant snotty nosed kid and people who have been
coding long before you were born have discovered from bloody
experience these conventions are VERY important. They are trying to
save you some pain. You see it only as an unwarranted attack on your
freedom.
 
B

boltar2003

Posting code that spits on the conventions is like putting a tag line
"**** you". It is similar to using deliberately incorrect spelling,
grammar etc. It shows a deliberate desire to make life difficult for
others. It is symptomatic of a narcissistic selfish personality,
hardly the optimum face to put on oneself when soliciting free advice
from others.

*yawn* I heard the same old nonsense 20 years ago when ansi C style
started to take over from K&R.

B2003
 
A

Arved Sandstrom

Nothing to do with coding conventions. If portability between platforms
is required then Java makes a lot of sense. We don't require portability
and most of the staff including me are C++ coders. *shrug*

Portability may or may not be a big deal, depending on what your
application domain is. Even if it is, in a particular scenario C++ may
be just as portable as Java, so as a general observation portability
isn't often a major reason who you choose or reject Java.

For example, if you're interested in developing large applications that
run on application servers, C++ is probably not your first choice for
other reasons. .NET or Java would be the way to go, and not because of
portability.
That was just learning the quirks of one particular runtime. Most programs
I've worked with are smart enough to attempt to open the filename you gave
them first before appending their own file extension on the end. Not suns
jre it seems. But no excuses , I should have RTFM first.

With a combination of rules concerning locations to search, allowable
extensions, and case sensitivity/insensitivity, any given program could
have a lot of leeway in deciding what files match an input
specification, or very little leeway. Every program is different. Too
much leeway is often worse than none, because you may end up scooping in
a file that you never intended to grab.

It's not a question of being "smart" - it's a design choice.

AHS
 
B

boltar2003

Because you are an arrogant snotty nosed kid and people who have been
coding long before you were born have discovered from bloody
experience these conventions are VERY important. They are trying to

Heh, thats quite amusing. I was a professional programmer for years while
Java was still something in Goslings coffee mug.

B2003
 
B

boltar2003

For example, if you're interested in developing large applications that
run on application servers, C++ is probably not your first choice for
other reasons. .NET or Java would be the way to go, and not because of
portability.

After the debarcle at the LSE recently I wouldn't touch .NET with a
bargepole in a condom. And for unix its a non starter anyway (Mono is a joke).
As for Java vs C++ for big systems - well I guess it depends on your
requirements but this argument has been done to death by thousands around
the world before so lets not go there :)

B2003
 
B

boltar2003


Thats fine by me. I'm quite glad someone who could come up with that piece
of wacko rubbish you call a website disgrees. But hey, perhaps I just need
a bit more Living Luuurrrvvv.

LOL!

B2003
 
J

John B. Matthews

Tom Anderson wrote:
[Pattern one]
When NetBeans does this, it puts your test code in a separate
directory from src:
[Pattern two]
Just pointing out there are at least a couple of patterns here, and
it's probably user preference which one gets chosen. Any given
project should probably be consistent, though, and use one or the
other.

The JUnit FAQ mentions both of these patterns:

<http://junit.sourceforge.net/doc/faq/faq.htm#organize_1>

[It also includes my favorite curly brace joke.]
 
L

Lew

*yawn* I heard the same old nonsense 20 years ago when ansi C style
started to take over from K&R.

But ... but ... But K&R were wrong! So is Sun! You shouldn't put the
opening brace on the same line as the command structure, you should put it on
the next line indented properly all by itself! It's the One True Way!

I only (mostly) follow the conventions because I'm an independent spirit. I
don't need to flout convention to prove myself.

I keep telling myself that. I hope to believe it. Meanwhile, there's that
pesky mortgage to pay.

The name-case convention in Java serves me, and helps others do my will. I
think I'll stick to it for now.
 
A

Arne Vajhøj

That was just learning the quirks of one particular runtime. Most programs
I've worked with are smart enough to attempt to open the filename you gave
them first before appending their own file extension on the end. Not suns
jre it seems. But no excuses , I should have RTFM first.

If you do RTFM you will see that the argument is not
a filename at all but a class name.

Arne
 
A

Arne Vajhøj

I asked one question which had nothing to do with coding styles anyway.

This is a forum where posters get good advice. Both the advice they
asked for and the advice they really need.

Arne
 
M

Mike Schilling

Arne said:
This is a forum where posters get good advice. Both the advice they
asked for and the advice they really need.

You can't always get theadviceyou want
You can't always get theadviceyou want
But if you post sometime, you just might find
You get theadvicethat you need
 
R

RedGrittyBrick

Mike said:
You can't always get theadviceyou want
You can't always get theadviceyou want
But if you post sometime, you just might find
You get theadvicethat you need

Don't give up the day job :)
 
A

Arne Vajhøj

Perhaps if the runtime had returned a more meaningful error I wouldn't
have needed to post in the first place. But thanks for rubbing it in. We all
make silly mistakes so leave off with the patronising replies ok?

It was a pretty good error message.

It clearly stated that it was looking for a class and could
not find it and it showed the class name, where it was easy
to see that "class" was being treated as part of the class
name.

Arne
 
A

Arne Vajhøj

"javac hello.java" -ie with the .java extension - is the only way that
works otherwise:

tantallon$ javac hello
error: Class names, 'hello', are only accepted if annotation processing is explicitly requested
1 error

So it works in the opposite way to the java runtime command line unless you
presumably specify some option.

javac compiles files.

java runs classes.

You specify extension for files.

Classes does not have extensions at all.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top