Code generators vs. ORMs vs. Stored Procedures

前端 未结 6 1977
猫巷女王i
猫巷女王i 2020-12-25 15:21

In what domains do each of these software architectures shine or fail?

Which key requirements would prompt you to choose one over the other?

Please assume th

6条回答
  •  爱一瞬间的悲伤
    2020-12-25 15:55

    I'll add my two cents:

    Stored procedures

    • Can be easily optimized
    • Abstract fundamental business rules, enhancing data integrity
    • Provide a good security model (no need to grant read or write permissions to a front facing db user)
    • Shine when you have many applications accessing the same data

    ORMs

    • Let you concentrate only on the domain and have a more "pure" object oriented approach to development
    • Shine when your application must be cross db compatible
    • Shine when your application is mostly driven by behaviour instead of data

    Code Generators

    • Provide you similar benefits as ORMs, with higher maintenance costs, but with better customizability.
    • Are generally superior to ORMs in that ORMs tend to trade compile-time errors for runtime errors, which is generally to be avoided

提交回复
热议问题