ConventionsMark Seemann  @ploeh
Agenda• Convention over Configuration• Demo  – DI container  – Unit tests
Convention over Configuration• Addresses bureaucracy (in code)• Mechanisms  – Enabling  – Constraining
Demo• ASP.NET MVC Controllers  – (known case)
Demo• Total manual complexity
Demo• Controllers by convention  – Using a DI Container (Castle Windsor)
Demo• Dependency constraints  – Automated tests that protect against accidental    use of Castle Windsor from other projects
Demo• Extension by convention
Demo• Directory by convention  – Match on name
Demo• Services by convention  – Scan all assemblies and register all concrete types    against their interfaces  – That’s ...
Demo• Dispatchers by convention
Demo• Services by convention in daemon
What more?• Convention-based unit tests  – Protocol specifications     • Grensesnitt (NUnit)  – Guard clauses     • AutoFi...
Convention over Configuration• Without conventions there is no consistency• Conventions are implemented by a  mechanism• I...
http://blog.ploeh.dk/                  @ploehMARK SEEMANN
Upcoming SlideShare
Loading in …5
×

Conventions

842 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
842
On SlideShare
0
From Embeds
0
Number of Embeds
280
Actions
Shares
0
Downloads
4
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Conventions

  1. 1. ConventionsMark Seemann @ploeh
  2. 2. Agenda• Convention over Configuration• Demo – DI container – Unit tests
  3. 3. Convention over Configuration• Addresses bureaucracy (in code)• Mechanisms – Enabling – Constraining
  4. 4. Demo• ASP.NET MVC Controllers – (known case)
  5. 5. Demo• Total manual complexity
  6. 6. Demo• Controllers by convention – Using a DI Container (Castle Windsor)
  7. 7. Demo• Dependency constraints – Automated tests that protect against accidental use of Castle Windsor from other projects
  8. 8. Demo• Extension by convention
  9. 9. Demo• Directory by convention – Match on name
  10. 10. Demo• Services by convention – Scan all assemblies and register all concrete types against their interfaces – That’s probably going to register ‘too many’ services, but is that really a problem?
  11. 11. Demo• Dispatchers by convention
  12. 12. Demo• Services by convention in daemon
  13. 13. What more?• Convention-based unit tests – Protocol specifications • Grensesnitt (NUnit) – Guard clauses • AutoFixture
  14. 14. Convention over Configuration• Without conventions there is no consistency• Conventions are implemented by a mechanism• If you can describe the convention, you can implement it
  15. 15. http://blog.ploeh.dk/ @ploehMARK SEEMANN

×