As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I am trying to use Spring for the first time in an application. The general issue that comes up repeatedly is how to debug Spring. The framework is configuration heavy so traditional code debugging seems fruitless. I have no real idea how to go about troubleshooting short of turning on the debugging level logs (which are lacking) and scanning through.
Are there any general tips or tools to assist Spring debugging?
If you're using Eclipse, then get hold of the Spring IDE (available from the Eclipse Marketplace within the Help menu of Eclipse). This will provide code-completion, bean visualisation, and hot-linking to your config files.
I don't think Spring debugging should be any different to any other debugging scenario.
What aspects of Spring are you using ? If you're using dependency injection properly, then I wouldn't anticipate any problems.
However if you're dynamically resolving beans via their name (at runtime, using ApplicationContext.getBean()) then I can see that's going to cause you problems anticipating flow of control etc., and would suggest that you revisit your IoC.
EDIT: It's quite useful to have the Spring source code available. It's well put together and quite readable, and therefore possibly of use when debugging.
I generally just use the java debugger in eclipse - it works fine on most classes. Some classes are wrapped at compile/runtime by bytecode changes - for these you generally cannot put breakpoints in methods, however you can set a breakpoint at method entry.
If you have a very specific situation you maybe should elaborate a bit in your question.
I'm generally also ok with the logging levels - what do you think is wrong with them?
As of 09/2011 (Version: 2.6.1.RELEASE, Build Id: 201105041000) a real annoyance is the fact that the debugger doesn't stop inside closures, so you have to remember to put a breakpoint inside the ones you want to examine; that is fine as it is "almost" going to a different class which a lot of time doens't matter, but when it does, you have to remember that.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
Files will ship with bugs, and companies will always want to provide new features. There must
be a way to distribute new files with the hope that the applications will work just fine. And if the application doesn't work fine, there has to be an easy way to restore the application to its last-known good state.
I know this will be general question but I think that is also a general problem.
Comparisons of the solution in different platforms will be amassing.
Dear friends, Actually I am not talking about How to develop software,
Its about How to deploy software with minimum side effects on end users machine
(should be step 0, or -1) use a capable source code management tool, and use it to its full potential: especially branching)
Test Driven Development - always have tests for what you can test, and design code to be testable (to the point it is feasible, of course.)
never do any of these two the same time:
refactoring
introducing new features
fixing a bug
use continuous integration wherever possible
Reverting to "last stable" release in case of emergency
This must be supported by some infrastructural decisions, like keeping around the last stable release compiled and ready to be redeployed if something goes awry despite the efforts (been there, done that)
You should do unit testing. That's a good solution to avoid and track regressions.
But you can't just fast make a change in a big application and build a test unit ensuring everything is OK. You have to make a bunch of test units.
Which is costly, but there is no cheap way to ensure an application is bug free. The only solution is to dedicate a lot of work to testing, be it using unit testing or human testers or both. There's emphasis on that point in Joel Test because a serious team must spend enough in testing.
Restoring an application to an old state is just having a good version control system and not a mess with configuration and data parts. Some VCS have tools to help you find when a bug occured, for example git-bisect.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I already have used the Google CodePro AnalytiX but I never used Findbugs.
My first impression with Findbugs is that it is harder to configure. After that, I believe that both are similar.
What's your opinion?
Just one more question related: None of these plugins sent our code to the servers, right? (for example, if we use CodePro our code isn't sent to Google Servers).
Update in 2016: CodePro Analytix is not available anymore, so go with Findbugs.
Original answer
better in CodePro Analytix:
Issue level (error, warning, info) can be changed for every item. Findbugs can only enable/disable issues.
Many issues can be configured in detail (like the list of blacklisted swear words).
Can show you all the issues in the currently opened editors (and adapts this when opening or closing editors), which is much more convinient then selecting packages, projects or whatever and then to manually trigger a scan on them
Several issues can be fixed automatically (like declaring all parameters final). In Findbugs everything must be done manually.
better in Findbugs:
Is more concentrated on typical Java programming bugs (but does not have the rich selection of issues like CodePro)
does more analysises that need a lot of context information
can be used locally in Eclipse or on an integration server like Hudson/Jenkins
configuration on Hudson/Jenkins and in local IDE can be shared, so you see the exact same results in your IDE and on the server
has a "cloud mode", where distributed teams can share their findings (and the evaluation of the findings), so that they do not all check the same issues again
All of the above was more related to how you can work with the tool. The actual finding of bugs may depend very heavily on the project to be checked. In the past I often suggested to use both, Findbugs first, CodePro afterwards:
Do the first checks with Findbugs, as it finds the more severe issues. But after those have been fixed, you may find yourself in lots of noisy issues (or even false findings). Therefore after working on the most severe issues of Findbugs, I suggest switching to CodePro Analytix as it has less false findings and can be controlled in more detail.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Most of you will probably label this is a very generic question, but still, I feel that I should make it:
What are the best practices while developing an android app so it can handle errors in a way that doesn't Force Close?
I'm asking this because I'm newbie developing android apps and I'm struggling with force closes a lot... I'm guessing that must be a way to design the APP so it can avoid force closes whenever a problem exists (ex:no internet)
Right know I'm using try/catch but it doesn't seem a very programmatic and clean way of doing things, is there other options to handle exceptions besides try/catch ?
If you guys could send links to some good documentation or some sample code on this subject I would be very appreciated! tks!
Force Closes happen in cases of uncaught exceptions. You should be able to avoid them by good coding practices and, in general, cleaning up after yourself. If you have questions about a specific force close scenario, post a question about it and we'll see what we can do.
The very specific answer to your question (which is probably a very bad idea in this case) is that you can use a global default uncaught exception handler which will supersede the Google "force close" dialog. This is usually only a good idea if you have a very well-developed app and are guarding against rare errors in production or want to use some other logging/reporting functionality than the Google market default.
Note that this won't prevent exceptions; it will only pass them somewhere other than the default Google handler.
You may find some use in the Android Activity lifecycle for persisting data or looking at threading (which are two cases where you can get force closes if you don't have your head wrapped around it) if you're new to Android.
Actually force close is just a symptom of something going really bad in your app. Try/catch is the good mechanism to use in java (and on android) to make your app more robust and declare some behavior in case of errors.
I disagree with other comments. It's quite hard to build apps and foresee every possible exceptions/errors that can occur. So don't worry about no getting force close, you should better focus on how you can read them, understand log cat traces and find out bugs that caused there force close.
Programming is error prone and difficult, and it has always been somewhat tinted by a process of trying and getting errors and correcting them. So don't get desperate, you are on the right track.
This is a very broad question, as you said yourself. You should read 'Best practices' section at android developers site. Also for responsiveness see this page.
As for other way of handling exception rather than try/catch, bad news; there is none. BUT what you can do is check before using a resource for its availability. You can check for many things, including internet access, before you actually use it. I cannot list all of them here, but you will learn with time. This post will tell you how to check for internet availability.
Hope this helps.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I am going to work on an complex application.Application is about to create lakhs of form dynamically, on those form rules can be apply dynamically and transactions of that forms.
For this application points that must be keep in mind are below:
1.Fast Loading:
1.1 Intial application load time must be smaller.
1.2 As there are lacs of forms then controls many in count of lakhs of lakhs with all properties.So while fetching forms from DB it should be fast.
2.Control Richness:
Which ever frame work used, It should be rich in controls, Control like:Date, Date Time Picker, Grid,TextBox,TextAera,Combox etc.
3.Browser Comapibilty
It should be compatible with all browser.
4.Resolution Indepedance
Application should be resolution independent.i.e It should work for every resolution and for every browser.
5.Mobile Compatibility
For this purpose I just started with a demo application.For this I selected GWT2.0.3 + gwt-ext,Hibernate
Hibernate is satisfying all the need regarding back end.But I am not satisfied with GWT as there loading issues,Browser issuse.
So I just need assistance for selecting frame work.Please also suggest me about the pattern
i.e. MVP,MVC.
I also searched abut spring framework But not much aware of it.
So please suggest me regarding this.
I am surprised you found issues with GWT. Personally I feel, it is one of the cleanest front-end implementations. (did you face issues integrating it with hybernate maybe?)
Anyways, another framework that is java style based (extends gwt and is richer) is Smart GWT that you can look into. I did a detailed comparison here which answers your questions - GWT,Smart GWT,GWT-ext comparison
If you are not looking for a java style based front end, you should look at jQuery too. http://jquery.com/. It even has a version optimized for touch http://jquerymobile.com/
EDIT -
1) You could even look at flex, which is a flash based. http://www.adobe.com/products/flex/
2) Also, if web based forms is the major area, look at Grails http://www.grails.org/
Point 1. Since you consider using Hibernate try "Extra‐lazy" collection fetching and lazy attribute fetching. The elements of the collection are accessed from the database as needed. I think it is a configuration issue to start up faster.
You will probably get faster startup if you use JDBC instead, but Hibernate will cut a lot of development time.
Also the JavaScript files containing your client application may take a lot of initial time to load, so split your application in smaller parts.
and 2. GWT covers your Control Richness issues and gives you a fairly reasonable Browser Compatibility. Gives you everything you have in a desktop Java Application.
About "all browsers": You can not have GUI Richness and Netscape 1.0 compatibility. JavaScript was not invented before Netscape 2.0
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I've seen internationalization implemented in a classic ASP shopping cart as a most-massive monolithic dictionary of (int,String) key-value pairs, where the calling code passed the dictionary an integer representing which string was to be returned (binary-ORed with the desired language id) and the value for each unique int was the "internationalized" string.
This seems like a very, very, very horrible way to implement i18n.
I'm in the "pre-design" (if there is such a thing) phase for a Java-based Swing application that I would want to be internationalized. Not that I speak anything other than English (ha!) but it would be nice to expand into other languages in the future without having to refactor 20,000 strings.
So, this begs the question: what are the best practices surrounding Java-based i18n (and L10n for that matter)? What sort of classes & structures are used? Obviously, if this winds up as one big com.myproject.i18n package with an "Internationalizer" class as the common gateway for the rest of my code, I would want this to be a singleton class, yes?
Just a request for some food-for-thought here, any nudges in the right direction are greatly appreciated :-)
The idea is to work around properties files. They are easy to work with and you can extend this system easily.
You can find a nice answer here.
Netbeans have also a great sample tutorial.
After you get your languages right, you will need software to switch locales, localize dates and amounts etc. Kai Toedter' tools are very reliable. You can add these beans to your IDE and drag and drop them to your JPanels.
You can create your property file and insert them into iL10Nz.
In order to evoid context issues, it is good to have a scrrenshot for each strings that you are progressively creating. This will pay off with the languages you will translate into
Check http://www.myl10n.net
You can take a look at Gettext Commons. It's i18n in gettext-way for Java. It has Maven plugin for generating, updating and compiling PO files. Personally after some time of use found it's easier to go with standard ResourceBundles.
i using netbeans for developing GUI application based on Swing Application Framework [SAF]
and you can get powerful tools for internationalizing Project on Netbeans IDE.
look at this article : Internationalizing a GUI Form