Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.
Domain Driven Design 101<br />
Agenda<br />Why<br />Building blocks<br />Repositories, entities, specifications etc<br />Putting it to practice<br />Depe...
Software is complicated<br />
We solve complexity in software by distilling our problems<br />
publicboolCanBook(Cargocargo, Voyagevoyage)<br />{<br />doublemaxBooking = voyage.Capacity * 1.1;<br />if (voyage.BookedCa...
Domain Model<br />
Ubiquitous language<br />
publicinterfaceISapService<br />{<br />doubleGetHourlyRate(intsapId);<br />}<br />û<br />A poor abstraction<br />publicint...
publicclassEmployee<br />{<br />voidApplyForLeave(DateTime start,<br />DateTime end,<br />ILeaveService leaves)<br />    {...
Domain Expert<br />
Entities<br />
Value Types<br />
publicclassEmployee : IEquatable&lt;Employee&gt;<br />{<br />publicbool Equals(Employee other)<br />    {<br />returnthis....
publicclassColour<br />{<br />publicint Red { get; privateset; }<br />publicint Green { get; privateset; }<br />publicint ...
Aggregates<br />
Aggregate root<br />*<br />
Repositories<br />
publicinterfaceIEmployeeRepository<br />{<br />EmployeeGetById(int id);<br />void Add(Employeeemployee);<br />void Remove(...
Domain Services<br />
publicinterfaceITripService<br />{<br />floatGetDrivingDistanceBetween(Location a, Location b);<br />}<br />
Specifications<br />
classGoldCustomerSpecification : ISpecification&lt;Customer&gt;<br />{<br />publicboolIsSatisfiedBy(Customer candidate)<br...
Specifications can be used…<br />to construct objects<br />
var spec = newPizzaSpecification()<br />              .BasedOn(newMargaritaPizzaSpecification())<br />              .WithT...
Specifications can be used…<br />for querying<br />
publicinterfaceICustomerRepository<br />{<br />IEnumerable&lt;Customer&gt; GetCustomersSatisfying(<br />ISpecification&lt;...
Anticorruption Layer<br />
Your subsystem<br />Anti-corruption layer<br />Other subsystem<br />
Any 3rd party system that I have to integrate with was written by a drunken monkey typing with his feet.<br />Oren Eini ak...
Bounded Context<br />
publicclassLead<br />{<br />publicIEnumerable&lt;Opportunity&gt; Opportunities { get; }<br />publicPerson Contact { get; }...
Dependency Injection<br />
publicinterfaceINotificationService<br />{<br />void Notify(Employeeemployee, string message);<br />}<br />An interface de...
publicclassLeaveService<br />{<br />privatereadonlyINotificationService notifications;<br /> <br />publicLeaveService(INot...
Persistence Ignorance<br />
…ordinary  classes where you focus on the business problem at hand without adding stuff for infrastructure-related reasons...
publicclassCustomer<br />{<br />publicint Id { get; privateset; }<br />publicstringFirstName { get; set; }<br />publicstri...
[global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName=&quot;AdventureWorksLTModel&quot;, Name=&quo...
Architecture<br />
Traditional Architecture<br />Presentation<br />Business Logic (BLL)<br />Infrastructure<br />Data Access (DAL)<br />
Onion Architecture<br />User Interface<br />G<br />Application Services<br />M<br />Domain Services<br />Database<br />Dom...
Onion Architecture<br />EmployeeController<br />User Interface<br />G<br />Application Services<br />M<br />IEmailSender<b...
Validation<br />
Validation Examples<br />Input validation<br />Is the first name filled in?<br />Is the e-mail address format valid?<br />...
publicclassPersonRepository : IPersonRepository<br />{<br />publicvoid Save(Person customer)<br />    {<br />if (!customer...
The golden rule for validation:<br />The Domain Model is always <br />in a valid state<br />
publicclassNewUserFormValidator : AbstractValidator&lt;NewUserForm&gt;<br />{<br />IUsernameAvailabilityServiceusernameAva...
Where validation fits<br />EmployeeController<br />User Interface<br />G<br />Application Services<br />M<br />IEmailSende...
Making Roles Explicit<br />
Challenges<br />
When DDD isn’t appropriate<br />
Benefits<br />
Books<br />
Links<br />Domain Driven Design mailing list<br />http://tech.groups.yahoo.com/group/domaindrivendesign/<br />ALT.NET mail...
Prochain SlideShare
Chargement dans…5
×

Traditional Architecture<br />Presentation<br />Business Logic Domain Driven Design 101

42 987 vues

Publié le

Traditional ArchitecturePresentationBusiness Logic (BLL)InfrastructureData Access (DAL)

Publié dans : Technologie, Business
  • Identifiez-vous pour voir les commentaires

×