Arguments against Create or Update

Posted by Nix on Stack Overflow See other posts from Stack Overflow or by Nix
Published on 2010-05-18T21:13:40Z Indexed on 2010/05/18 21:50 UTC
Read the original article Hit count: 211

Recently someone stated that they thought all Creates should be CreateOrUpdates. Instinctively i thought bad, but now I am trying to find out if I have any grounds.

Situation

  interface IService{
    void Create(Object a);
    void Update(Object a);
  }

or

   interface IService{
       void CreateOrUpdate(Object a);
  }

My first thought is if you implemented everything CreateOrUpdate then you have no control if someone accidentally sends you wrong data, or concurrency issues where someone changes a "primary" field right before you call update....

But if you remove those cases, are there any other cons?

© Stack Overflow or respective owner

Related posts about language-agnostic

Related posts about best-practices