Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

General debugging class??

 
Krista Meek
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Krista Meek
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 11887
203
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just one more plug for Log4J.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Krista Meek
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, everybody, for your suggestions and help. I will look into the suggestions and will hopefully come up with something.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic