3 Replies Latest reply on Sep 24, 2008 3:42 AM by Joram Barrez


    Bernd Ruecker Master


      I found a not so nice design detail of the CommandService: The Command.execute throws an Exception, the CommandService.execute not.

      I think either both or none should add "throws Exception" to the signature. But I think it would not be the best idea to change the signature of the CommandService now, what do you guys think?

      Maybe this should be addressed in the PVM?

      Or do you think it is fine like this?


        • 1. Re: add
          Joram Barrez Master

          There is certainly a mismatch between the 2 ... Having the throws clause will make it cumbersome if no real Exception handling is done (95% of the cases) ... but it sure is easy when you need it...

          I'll have to think about it before I can give my final answer :p

          • 2. Re: add
            Tom Baeyens Master

            there is a difference. the command is executed within a environment (read:transaction). an exception there will rollback. in this case it is a convenience so that you don't have to rethrow checked exceptions.

            the service methods are exposed to the client. that is why they are different.

            anyway... that is the reasoning behind it. doesn't mean it's the right thing.

            • 3. Re: add
              Joram Barrez Master

              Tom, I understand the reason for the difference now... damn it's more difficult than I thought :p

              But does that mean that a Command should be an internal class and that clients shouldn't use it (but the CommandService instead)?