views:

88

answers:

3

What are the most important patterns you should know, when developing testable n-tier line of business web applications?

  • Repository pattern
  • Model View Controller
  • Dependency Injection Pattern
  • Factory Pattern
  • Singleton

What else?

+1  A: 

"most" important?

The problem domain's patterns -- whatever they are. Accounts Payable, General Ledger, Accounts Receivable, Organizational Hierarchy.

http://www.businessanalysisbooks.com/0471295515.html

http://www.amazon.com/Analysis-Patterns-Reusable-Addison-Wesley-Technology/dp/0201895420

Technical patterns (MVC, Repository, etc.) are a dim second place.

S.Lott
+1  A: 

Since you asking about the connection between design patterns and best practice for business, there is a bit of subjectivity you have to deal with. I would focus entirely on making your code easy to understand and reuse.

I would focus less on design patterns (no single pattern is better than another) and instead focus on some basic tenets of design:

  • Use self-documenting coding conventions (so you don't have to document at all, the code is just understandable).
  • Don't repeat yourself (DRY)
  • Use Object Oriented Programming techniques (don't just use objects as a container for functions)

If you must know the patterns that are most effective in almost every business situation, here they are:

  • MVC - This gives you the ability to separate your code into easily maintainable pieces
  • Factory Pattern - Provides the ability to use logic in determining how an object should be created
  • Singleton - Particularly useful with database connection objects
  • Active Object - Makes life much easier when you don't have to worry about state persistence.
mylesmg
A: 

short answer: it depends

dfa