Announcement Announcement Module
Collapse
No announcement yet.
About Exception Types Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • About Exception Types

    Hello, I have two questions :

    First, why does some Spring Batch Interfaces, like ItemWriter and its write() method, use throws clause with Exception, against commonly known good practices ? How would you justify it ?

    Secondly, does it matter if I remove the throws clause in my implementing class or if I modify/refine it (well I guess not) ?

    Thanks for your support !

  • #2
    I would argue that we are following *framework* best practice, which is to allow the application developer maximum fexibility - in other words you can take this signature to mean that you can throw any exception from your business logic. Best practice for *applications* is to be as specific as possible about what exceptions can be thrown by your code, so yes, I would agree that you should feel free to narrow the signature in your implementations.
    Last edited by Dave Syer; Jun 23rd, 2008, 05:20 AM. Reason: spelling

    Comment


    • #3
      ---------------->{}<-----------------

      Comment

      Working...
      X