Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

Design Pattern for Java Batch Programs

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am planning to do batch programs in java using POJOs and Unix script for running and scheduling the job.

Which design pattern in java will be better for batch programs?
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is hard to say what design pattern you should use without knowing what problem you actually trying to solve.
However I can give you an idea about your application�s architecture: use Spring as the lightweight container and Quartz as the scheduler and you�ll be able to schedule tasks without running any piece of code. Almost everything could be done through configurations only (no need to use unix crons, Quartz resembles the same syntax).

Second use dependency injection to develop your beans (pojos) and if you follow the ioc paradigm closely with little effort you should be able to deliver testable and easy to maintain code (please notice that there is always a difference between designing a class and designing a testable class). And because you like using design patterns remember about the strategy design pattern (when develop your pojos).

Third use jMock and jUnit in order to fully test and cover your code. For running coverage reports on your code you could use either clover or cobertura. If you apply the strategy design pattern to your pojos you should be able to "inject" mock objects at runtime in order to build test cases that don�t really depend upon any external systems.

Fourth enable PMD and checkstyle when writing code in order to deliver high quality code.

This is probably a lot of work to do but at the end you�ll feel like doing the right things right.

Regards.
 
Anjana Ravindran
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.. thats really a nice reply. Will explore how this will work out.
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're most welcome Ravindran.
 
PI day is 3.14 (march 14th) and is also einstein's birthday. And this is merely a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!