aspose file tools*
The moose likes Java in General and the fly likes General debugging class?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "General debugging class??" Watch "General debugging class??" New topic
Author

General debugging class??

Krista Meek
Greenhorn

Joined: Oct 24, 2005
Posts: 12
Hi,

I am new to this forum thing so please let me know if I am doing anything wrong.

My question involves debugging classes for java. I am wondering if anyone could start me off on which way to go for the following:

"Create a debugging class that can be utilized in future assignments. The class will encapsulate exceptions, and offer the ability to output debugging information about any class, or a simple textual message."

I am doing an online course with no specified book or software. I have no idea where to start with this. Could someone help me out?

Thanks in advance.

K.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

Hi Krista,

Welcome to JavaRanch!

First, a bit of business: you may not have read our naming policy on the way in. It requires that you use a full, real (sounding) first and last name for your display name. Initials aren't enough for a last name. You can change your display name here. Thanks!

Now, as to your assignment: wow. No idea, really. Does the assignment build in some way on something the instructor covered in lecture? This really doesn't sound like any standard programming practice -- it really sounds like something the lecturer would have specifically come up with in some context. Can you ask for clarification?

I can tell you that, for example, the technical programming term "encapsulate" as it's used in a Java context has absolutely nothing to do with exceptions; and debugging information is something that you get in context from a particular object, not from a class in general. So this really makes very little sense as-is.


[Jess in Action][AskingGoodQuestions]
Krista Meek
Greenhorn

Joined: Oct 24, 2005
Posts: 12
This is an online course that I am doing. I have tried several times to contact the instructor to no avail. There's no text specified and I cannot find anything in the online notes relating to this.

I have been searching the net for examples but can find nothing related to a general debugging class.

I'm sooo frustrated.
Krista Meek
Greenhorn

Joined: Oct 24, 2005
Posts: 12
Also, this is the first exercise that he gave us. He hasn't lectured at all, so I don't think that he has made this to extend anything that he has taught...'cause he has taught nothing.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

This is really hard to answer not knowing where you are in the course -- i.e., what you already know, or not. My best guesses -- but these are just guesses:

1) For the exceptions part, perhaps what you're building is a driver program that can invoke some other code while catching all exceptions and reporting them? This actually isn't needed at all in Java -- it's entirely redundant -- but maybe something like



Or maybe this is a class about some particular API, and your general debugging program is supposed to serve as a harness for programs that use some specific API? What's the course about?

2) For the debugging info class, again, this isn't needed at all because it's redundant, but something like



Does any of this ring any bells?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24184
    
  34

Originally posted by Krista Meek:
He hasn't lectured at all, so I don't think that he has made this to extend anything that he has taught...'cause he has taught nothing.


Oh my goodness. Well, how can you create any kind of utility code to use throughout the course if you haven't learnt anything yet?
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11460
    
  94

Hi Krista,

Hmmm - I am wondering if something similar to the Logger APIs would achieve the required effect. Logger's need to be able to output whatever sort of information is provided in the method, whether it is plain text, debuging information, or an exception - pretty much the same as what you seem to need.

If your instructor was planning on having a class / application that could be used to attach to a running program, then you might be looking at the Java Platform Debugger Architecture (JPDA). Personally I suspect that this is too advanced though.

Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

I'm wondering the same thing. Krista, is it possible for you to post the actual requirements?

It sounds like the old pre-log4j Debugging classes:



Note: this is ugly. You should always use log4j rather than this, but you may even be able to merge the two by getting the Debugger Class to call Log4J

You enable logging by setting debugging=true and recomiling, you stop debugging by setting it to false and recompiling. Or you can use Log4J.

You call it in code like this:


I haven't included all of the correct code as well as being able to log at particular levels (like Log4J) and logging Objects, primitives, etc, and logging to different locations (System.out, File, both, other) but I hope this helps.

Dave
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Just one more plug for Log4J.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by David O'Meara:
Just one more plug for Log4J.

Or perhaps it would be easier to start out with JDK's own Logging API.

Then again, I wonder if we're now talking about the right thing at all--whether Krista's requirements really imply creating a logger or something completely different...


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Krista Meek
Greenhorn

Joined: Oct 24, 2005
Posts: 12
Thanks, everybody, for your suggestions and help. I will look into the suggestions and will hopefully come up with something.
 
wood burning stoves
 
subject: General debugging class??