|
Sponsored Links
Resources
Enterprise Java Research Library
Get Java white papers, product information, case studies and webcasts
|
News
News
News
|
Messages: 15
Messages: 15
Messages: 15
Printer friendly
Printer friendly
Printer friendly
Post reply
Post reply
Post reply
XML
XML
XML
|
 |
Debugger Tips
The blogger Kasia brought up the point that a lot of people aren't using debuggers. Cedric Beust then noted that there isn't a lot of material on good practices for using your debugger, so he posted a couple of good ones including: using conditional breakpoints, using break conditions for println, and running a method until it exits.
Read Kasia in Why use a debugger?
Read Cedric's Debugger Tips
|
|
Message #143550
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Kasia is a women ;)
It sound a bit strange "The blogger Kasia...". Kasia is not a nick (I thik). Kasia is popular girl's name in central Europe (just Catrin). Seems that Kasia has Polish roots thus a bit difficult name and surname. Just FYI.
Artur
|
|
Message #143557
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Debuggers are slow
Although debuggers do help out in certain situations, I would avoid them if I can. Primarily because they slow you down. I'd rather figure out how to test the "non-framework" code using a JUnit test rather than letting it go through the debugger. Failing that I'll see if I can assign the task of creating the test framework to someone else who can program better than myself.
The debugger would still be useful if you suspect something to be wrong in the framework and cannot easily validate using a sanity test against the framework.
Of course this assumes that you are not developing the framework at the same time you are developing your application. If you are its best that you split the work into two groups, one for the framework and one for the application and make sure that application developers do not actually go directly into the framework internals (if possible).
BTW, you can do this without removing Collective Code Ownership. Just allow an application developer to switch to framework developer and vice versa on occassion, but they should not be working on both the framework and the application on the same workspace at the same time.
|
|
Message #143596
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Debuggers are slow
I'd rather figure out how to test the "non-framework" code using a JUnit test rather than letting it go through the debugger. You appear to confuse discovering bugs with locating and fixing them.
|
|
Message #143599
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Debuggers are slow
This was a really good joke.....thou i dont quite understand every bit of it :)))
First of all, u r confusing between testing and debugging. Testing and debugging are not substitues. When ur test case fails, u debug unless its pretty evident whats wrong.
Also i dont see why debugging slows u down.
Although debuggers do help out in certain situations, I would avoid them if I can. Primarily because they slow you down. I'd rather figure out how to test the "non-framework" code using a JUnit test rather than letting it go through the debugger. Failing that I'll see if I can assign the task of creating the test framework to someone else who can program better than myself.The debugger would still be useful if you suspect something to be wrong in the framework and cannot easily validate using a sanity test against the framework.Of course this assumes that you are not developing the framework at the same time you are developing your application. If you are its best that you split the work into two groups, one for the framework and one for the application and make sure that application developers do not actually go directly into the framework internals (if possible).BTW, you can do this without removing Collective Code Ownership. Just allow an application developer to switch to framework developer and vice versa on occassion, but they should not be working on both the framework and the application on the same workspace at the same time.
|
|
Message #143602
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Bugseeker2 from Karmira...
I quite liked Bugseeker2 from Karmira, but the company pretty much dropped off the face of the placent a couple of years ago. Anyone know what happened to them?
http://www.karmira.com
Then again, since moving over to unit testing, I haven't had nearly the need to step through my applications...
|
|
Message #143813
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Bugseeker2 from Karmira...
Then again, since moving over to unit testing, I haven't had nearly the need to step through my applications... i dont know if u read my post above, but i fail to understand why u r trying to compare unit testing with debugging. what happens when ur unit test fails. dont u have to fix it. i agree that there are many problems which are evident and u dont need to step thru ur code to narrow down to the problem. but what abt the tougher problems. unless u r working with simple code, i dont see why a debugger wont help u. i am not saying that a debugger is mandatory but it will definitely decrease the amount of time spent in narrowing down on the problem and fixing it.
|
|
Message #143829
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Debuggers are slow
Although debuggers do help out in certain situations, I would avoid them if I can. Primarily because they slow you down. I dunno.. maybe I'm a bit old school, but I'm influenced by Steve McConnell author of Writing Solid Code and Debugging the Software Development process who suggests that you should step through all your code in the debugger before checking it in.
The rational is that freshly written code most likely has bugs in it, you might as well do the stepping sooner than later then (since repairing the bug sooner is cheaper than later). I'm not sure Unit tests change this.
Since maintenance is a higher cost than initial development, maybe Steve McConnell is right?
|
|
Message #143838
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Debuggers are slow
Thou it may be tough to get into this habit, i think it definitely makes sense...
Although debuggers do help out in certain situations, I would avoid them if I can. Primarily because they slow you down. I dunno.. maybe I'm a bit old school, but I'm influenced by Steve McConnell author of Writing Solid Code and Debugging the Software Development process who suggests that you should step through all your code in the debugger before checking it in. The rational is that freshly written code most likely has bugs in it, you might as well do the stepping sooner than later then (since repairing the bug sooner is cheaper than later). I'm not sure Unit tests change this.Since maintenance is a higher cost than initial development, maybe Steve McConnell is right?
|
|
Message #143841
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Linus Torvalds Does Not Like Debuggers
Linus had posted this message a while back about debuggers. Even though the message is about kernel debuggers, I think there is wisdom in it for debugger use in general.
Enjoy,
> > very nice monologue, thanks. It would be great to know Linus' opinion. I > mean, I knew Linus' opinion of some years' ago but perhaps it changed? He > is a living being and not some set of rules written in stone so perhaps > current stability/highquality of kdb suggests to Linus that it may be > (just maybe) acceptable into official tree?
I don't like debuggers. Never have, probably never will. I use gdb all the time, but I tend to use it not as a debugger, but as a disassembler on steroids that you can program.
None of the arguments for a kernel debugger has touched me in the least. And trust me, over the years I've heard quite a lot of them. In the end, they tend to boil down to basically:
- it would be so much easier to do development, and we'd be able to add new things faster.
And quite frankly, I don't care. I don't think kernel development should be "easy". I do not condone single-stepping through code to find the bug. I do not think that extra visibility into the system is necessarily a good thing.
Apparently, if you follow the arguments, not having a kernel debugger leads to various maladies: - you crash when something goes wrong, and you fsck and it takes forever and you get frustrated. - people have given up on Linux kernel programming because it's too hard and too time-consuming - it takes longer to create new features.
And nobody has explained to me why these are _bad_ things.
To me, it's not a bug, it's a feature. Not only is it documented, but it's _good_, so it obviously cannot be a bug.
"Takes longer to create new features" - this one in particular is not a very strong argument for having a debugger. It's not as if lack of features or new code would be a problem for Linux, or, in fact, for the software industry as a whole. Quite the reverse. My biggest job is to say "no" to new features, not trying to find them.
Oh. And sure, when things crash and you fsck and you didn't even get a clue about what went wrong, you get frustrated. Tough. There are two kinds of reactions to that: you start being careful, or you start whining about a kernel debugger.
Quite frankly, I'd rather weed out the people who don't start being careful early rather than late. That sounds callous, and by God, it _is_ callous. But it's not the kind of "if you can't stand the heat, get out the the kitchen" kind of remark that some people take it for. No, it's something much more deeper: I'd rather not work with people who aren't careful. It's darwinism in software development.
It's a cold, callous argument that says that there are two kinds of people, and I'd rather not work with the second kind. Live with it.
I'm a bastard. I have absolutely no clue why people can ever think otherwise. Yet they do. People think I'm a nice guy, and the fact is that I'm a scheming, conniving bastard who doesn't care for any hurt feelings or lost hours of work if it just results in what I consider to be a better system.
And I'm not just saying that. I'm really not a very nice person. I can say "I don't care" with a straight face, and really mean it.
I happen to believe that not having a kernel debugger forces people to think about their problem on a different level than with a debugger. I think that without a debugger, you don't get into that mindset where you know how it behaves, and then you fix it from there. Without a debugger, you tend to think about problems another way. You want to understand things on a different _level_.
It's partly "source vs binary", but it's more than that. It's not that you have to look at the sources (of course you have to - and any good debugger will make that _easy_). It's that you have to look at the level _above_ sources. At the meaning of things. Without a debugger, you basically have to go the next step: understand what the program does. Not just that particular line.
And quite frankly, for most of the real problems (as opposed to the stupid bugs - of which there are many, as the latest crap with "truncate()" has shown us) a debugger doesn't much help. And the real problems are what I worry about. The rest is just details. It will get fixed eventually.
I do realize that others disagree. And I'm not your Mom. You can use a kernel debugger if you want to, and I won't give you the cold shoulder because you have "sullied" yourself. But I'm not going to help you use one, and I wuld frankly prefer people not to use kernel debuggers that much. So I don't make it part of the standard distribution, and if the existing debuggers aren't very well known I won't shed a tear over it.
Because I'm a bastard, and proud of it!
Linus
|
|
Message #143889
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Linus Torvalds Does Not Like Debuggers
Linus had posted this message a while back about debuggers. Even though the message is about kernel debuggers, I think there is wisdom in it for debugger use in general. Why not avoid the usual development cycle at all? Just figure out the program in your mind with maybe the mildly scorned off use of some scratch paper and avoiding mundane things like development tools (intellisense, debuggers, IDE, etc..). Avoid tests too because there is no need of them, having already thought off all the possibile scenarios and side-effects. Finally just compile it and deploy.
|
|
Message #143927
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
re: Linus Torvalds does not like debuggers
Let me paraphrase Linus:
I hate stupid people. Stupid people have no business making me aware of their existence, much less contributing to the Linux kernel. Debuggers help stupid people find trivial bugs. Finding trivial bugs makes them think that they are not stupid, and consequently they make me aware of their existence and commit the atrocity of trying to commit to the kernel. Also, I don't find debuggers particularly usefule. Therefore, I don't like debuggers. However, if you are an intelligent person, I don't care whether or not you use a debugger. I don't care if you climbed a mountain and God himself told you how to fix the code. All I care about whether you've come up with an intelligent solution to a non-trivial problem, and therefore are not wasting my time.
-----------------------------------
Two Points: 1. I completely agree with Linus's stance on stupid people, even though I suspect he would put me in that group if I submitted a kernel patch.
2. The rest of us mere mortals have to be concerned with those trivial errors that debuggers help us find - and must of us don't enjoy tracking them down so we want to spend as little time on it as possible.
Debuggers are a tool. Most of the anti-debugger posts amount to "I know a lot of stupid programmers who use debuggers. If they didn't have debuggers, maybe they would not longer be able to be programmers and therefore would be unable to cause me headaches. Therefore, I hate debuggers."
Don't bash the tool, bash the people. They're the ones being annoying.
|
|
Message #143951
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Use debuggers even for new code
I dunno.. maybe I'm a bit old school, but I'm influenced by Steve McConnell author of Writing Solid Code and Debugging the Software Development process who suggests that you should step through all your code in the debugger before checking it in. Yes!
This is such an important statement that I wrote another blog entry about it:
http://beust.com/weblog/archives/000202.html
Let me know what you think.
-- Cedric
|
|
Message #144031
Post reply
Post reply
Post reply
Go to top
Go to top
Go to top
|
 |
Before you even write new code....
I dunno.. maybe I'm a bit old school, but I'm influenced by Steve McConnell author of Writing Solid Code and Debugging the Software Development process who suggests that you should step through all your code in the debugger before checking it in. Yes!This is such an important statement that I wrote another blog entry about it: http://beust.com/weblog/archives/000202.htmlLet me know what you think.-- Cedric
You can go one step further with hotswap and full speed debugging and not event write the code before you hit the breakpoint:
http://www.orablogs.com/gdavison/archives/000146.html
That way you have a full understanding of the parameters as you build up the method. It can be quite usefull in certain cases where the API you are using is unfamiliar. Definitely much faster than having to rebuild.
|
|
 |
New content on TheServerSide.comNew content on TheServerSide.comNew content on TheServerSide.com |
 |
 |
Reza Rahman explores the features of the proposed JSR 299, Contexts and Dependency Injection for Java EE (CDI). When approved, it promises to be a key feature of Java EE 6.
(November 2, Article)
SAML is an XML-based standard for exchanging authentication and authorization data between security domains. The single most important problem that SAML was created to solve is the Web browser Single Sign-On problem. Many organizations are debating whether to stay with version 1.1 or move to 2.0. This article makes observations about both options.
(September 28, Article)
Joe Ottinger takes a look at how people learn, and applies it to the practice of programming. He notes that understanding how people learn is an essential part of working in a programming team.
(September 22, Article)
Stephen Maryka gave us an article about the Asynchronous Web and posed a number of questions that get examined like an approach to delivering Asynchronous Web capabilities through extensions to existing Java EE technologies.
(July 14, Article)
JavaServer Faces Flex goal is to provide users capability in creating standard Flex components, part of flexSDK which is open sourced through MPL license, as normal JSF components. This article by Ji Hoon Kim will provide an overview of creating a simple multilingual JSF page consisting of JSF Flex tags.
(June 29, Article)
In this session Jeff explores the key characteristics of successful SOA projects. He covers some of the patterns, and anti-patterns, tool sets, and strategies that he himself learned the hard way. Last, he provides a strategy and blueprint for achieving a high likelihood of success in your SOA project.
(June 23, Tech Talk)
Ari Zilka, CTO of Terracotta, Inc., talks about the new features in Terracotta 3.1, announced during JavaOne and available now.
(June 15, Tech Talk)
In this Tech Talk, Josh Long explores an integration challenge using Spring Integration and walks through the implementation, employing and expanding on the basic patterns of Enterprise Application Integration to tie together components into a function integration solution, and then demonstrates how Spring Integration helps address the integration requirements.
(June 15, Tech Talk)
In this Tech Talk, David Geary teaches you: The basics of Google Web Toolkit; How to implement Ajax-enabled applications in Java; Internationalization; Hooking into the browser history mechanism; Remote procedure calls.
(June 4, Tech Talk)
Jon Kern discusses the best architecture/technical solutions and ensure that they are repeated by all developers. By tackling the architecture up-front in a serial manner, subsequent parallel development will be much more manageable and predictable.
(May 28, Tech Talk)
This keynote describes the frustrations of modern knowledge workers in their quest to actually get some work done, and solutions for how to guard yourself against all those distractions. Neal Ford talks about environments, coding, acceleration, automation, and avoiding repetition as ways to defeat the misguided attempts to sap your ability to produce good work.
(May 26, Tech Talk)
Gil demonstrates how new, aggressive uses of already abundant compute capacity by common applications offer competitive value for application designers.
(May 21, Tech Talk)
Chris Keene introduces WaveMaker as a new way to automate the ability to generate Hibernate classes in order to more quickly bring OR mapping into an application.
(May 19, Article)
In this session Nati Shalom demonstrates how to take a standard Java EE web application and scale it out or down dynamically without changes to the application code. Seeing as most web applications are over-provisioned to meet infrequent peak loads, this is a dramatic change because it enables growing your application as needed, when needed, without paying for unutilized resources.
(May 19, Tech Talk)
Mastering EJB was one of the original and most influential EJB books in the industry. Mastering EJB III now returns with two new expert co-authors, updated for EJB 2.1 and 30% new chapters including security, integration, best practices, open source, and more.
(Book PDF Download)
The Application Server Matrix is a detailed listing of J2EE vendors and their application server products, with information on latest version numbers, J2EE spec support and licensing, pricing, platform support, and links to product downloads and reviews.
(Application Server Comparison Matrix)
|
|