[ 
http://jira.amdatu.org/jira/browse/AMDATU-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10820#comment-10820
 ] 

Koos Gadellaa commented on AMDATU-208:
--------------------------------------

Just a question: do these all need to be checked exceptions? (I'm not really a 
fan of checked exceptions)

why should delete(id) throw a (checked) exception? after the operation, the 
state is proper (the id is no longer available)

Similarly: should update automaticly create if it's not available? and why not 
have an update function which does this?

Shouldn't this api be almost exceptionless if we had a has(id) function?
(then again, would/could using this pattern create race-conditions?)

I 

> Refactor CRUD API of Tenant services to be consistent with retuning null and 
> throwing checked exceptions
> --------------------------------------------------------------------------------------------------------
>
>                 Key: AMDATU-208
>                 URL: http://jira.amdatu.org/jira/browse/AMDATU-208
>             Project: Amdatu
>          Issue Type: Task
>          Components: Amdatu Core
>    Affects Versions: 0.1.0
>            Reporter: Ivo Ladage - van Doorn
>            Assignee: Bram de Kruijff
>             Fix For: 0.1.0
>
>
> The current CRUD API of the (combined) TenantManagementService and 
> TenantStorageProvider uses the following inconsistent approach:
> create(id)  -> returns null if an entity with that id already exists
> update(id) -> creates a new entity if it didn't exist yet
> delete(id)  -> throws checked exception if it doesn't exist
> get(id)       ->  returns null if it doesn't exist
> I believe this is not consistent and not correct. IMHO this is how a typical 
> CRUD API should look like:
> create(id)  -> throws checked AlreadyExistsException if an entity with that 
> id already exists
> update(id) -> throws checked NotFoundException if an entity with that id does 
> not exist
> delete(id)  -> throws checked NotFoundException if an entity with that id 
> does not exist
> get(id)       -> returns null OR throws checked NotFoundException if it 
> doesn't exist (either of the two seems ok to me) 

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to