Skip to content

Instantly share code, notes, and snippets.

@cbcwebdev
Created April 30, 2012 22:20
Show Gist options
  • Save cbcwebdev/2563170 to your computer and use it in GitHub Desktop.
Save cbcwebdev/2563170 to your computer and use it in GitHub Desktop.
Use cases
/// <summary>
/// Keep in mind - factories are doing most object construction.
/// Trying to keep the idea simple to cut to the point...
/// </summary>
// when creating a client, we need the primary user (eg. account holder)
// the primary user may be created at the same point in time as the client, or be an existing user of any service
var client = new Client(Guid.NewCombGuid(), "Client Name", user);
// when creating a review on some entity in service ABC, assuming "entity" is present in context from some repository
// review is within the service ABC module, how is he "user" aware?
// no permissions needed to create a review - as far as service ABC is concerned
var review = new Review(title, content, score, user);
entity.Review(review);
// when commenting on some entity in service XYZ, assuming "entity" is present in context from some repository
// comment is within the service XYZ module, how is he "user" aware?
// permissions needed to create a comment, as far as service XYZ is concerned
var comment = new Comment(content, user);
entity.Comment(comment);
// when billing, invoices make their way to any billable contact
// assuming "client" is present in context from some repository
// invoicing logic extracts billable users (billable permission defined by billing module?) from client
var invoice = new Invoice(/* fields omitted for brevity */, client);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment