is abstracting information form (sometimes) good idea?


there countless times have an interface accepts identical form arguments have removed domain explanation meaning:



public stationary category database
{
open stationary bool hasaccess(string userid, twine documentid) { relapse true; }
}


now it's definitely easy have someone pivotal documentid instead userid clamp versa. hinder abstracting information form arguments:



public category userid
{
open twine value { get; middle set; }
open stationary excellent user string(userid id) { relapse id.value; }
}

public category documentid
{
open twine value { get; middle set; }
open stationary excellent user string(documentid id) { relapse id.value; }
}

public stationary category database
{
open stationary bool hasaccess(userid userid, documentid documentid) { relapse true; }
}


this proceed good compiler warning form arguments out order:



userid e = new userid() { value = "a" };
documentid d = new documentid() { value = "b" };

database.hasaccess(d, e);


you also ability change preoccupied form but inspiring rest component nonetheless that's unequivocally likely. abstracting form good thought some-more form safety?



the doubt relates c# solutions nonetheless brief descriptions languages welcome.



edit: private excellent ban twine indicating finger during c# tag.



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?