.NET Coding standards and framework for a web service

主宰稳场 提交于 2019-12-24 04:32:13

问题


I have been given to the task of writing a coding standards document and creating a framework for web services.

I've looked at numerous articles but I am still stumped to what is exactly required especially when developing a framework as it is completely different from application code.

Has anyone got any useful tips or books they can recommend?


回答1:


Check out Framework Design Guidelines by Brad Abrams.




回答2:


If you think about frameworks, the best make repetitive coding tasks easier, DRY, and, if possible, automatic. With that in mind, identify the repetitive tasks in your web service layer. Maybe:

  • Security?
  • Mapping from transport objects to business objects, data objects, others?
  • Special serialization handling?
  • ...

If you have specific use cases or service contracts, pore through them and find things you don't want to code inside every web service method.

From that, cook up a scheme that automates or simplifies code inside the service and, better yet, for service consumers. Maybe:

  • A component that lets you swap out different security approaches with a simple config change
  • A single, generic object mapper versus mapping Property-to-Property every time it's required.
  • An Attribute scheme that tells the service how to handle special serialization versus explicitly handling each case
  • ?

When rolling your own framework, I'd say the most important thing is to start humble. Don't try to be everything to everyone and don't try to anticipate every possibility. Instead, start with tasks that you know are tedious and error-prone and make them automatic.




回答3:


When considering a framework, consider using someone else's. Look at the Service Factory. It's not only a framework and development methodology; it's also customizable.



来源:https://stackoverflow.com/questions/581994/net-coding-standards-and-framework-for-a-web-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!