I wrote a piece of java code using threads, JDBC, Java Mail API etc. without using any of the frameworks (read Spring). I am frankly not too comfortable learning them first (lots of terminologies to remember!) and use them.开发者_StackOverflow中文版 So, please suggest me some ways to refine my existing code incorporating few of these framework concepts applicable to the aforementioned things without having to learn a lot about them. Is there any quick way to learn some vital framework concepts and use it.. sounds certainly foolish, but still looking for somebody's experiences :)
If you aren't interested in frameworks, your code should at least use interfaces and layering that's appropriate. Your app will be well-layered if you have interfaces for services and repositories whether you use a framework or not.
You should have a front controller servlet that accepts all requests.
You should bind and validate all requests prior to processing in the service tier.
The services should be completely separate from your web tier. If you can't unbolt the web UI and have the rest of the stuff work, you're doing it wrong.
for your simple stuff i dont really see a value add of using framework. u could replace the thread handling with the Java 5 Executors though. And if you want IoC/dependency injection then look into Google Guice
I am not one of those people that can read a book and understand (although, I certainly wish I was that type). I have to learn by doing so I suggest installing an IDE that supports the framework you want to learn and do the tutorials or build something that you can use personally. Couple that with some books/internet for reference and guidance. Good luck!
精彩评论