且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

传统日志记录与AOP日志记录

更新时间:2022-11-26 09:42:42

为了提高性能,AOP方法肯定比传统方法有一些开销.

For performance, AOP approach certainly has a little overhead against the traditional one.

AOP的众多优势之一是,它使您可以将非业务问题与业务逻辑分开.它还可以帮助您完成一些繁琐的任务,例如在每个方法中放置日志记录逻辑或在每个方法上放置try-catch语句.

One of the many strengths of AOP is that it allows you to separate your non-business concerns from your business logic. It also helps you in mundane tasks such putting a logging logic in each of your method or place a try-catch statement on each method.

我认为真正的问题是,如果性能开销(根据我的经验,这只是最小的)将补偿您在开发时必须完成的平凡任务.

I think the real issue is that if the performance overhead (in my experience which is only minimal) would compensate on the mundane tasks that you have to go through while developing.

之前有个朋友告诉我,拥有一个可维护且可扩展的较慢的应用程序比拥有一个使您陷入困境的较快的应用程序更好.可以通过许多方式来补偿速度缓慢,例如升级硬件等.

A friend told me before that it's better to have a slower app that is maintainable and scalable than having a faster app that would give you hell in maintenance. Slowness could be compensated in many ways, such as upgrading hardware and etc.

这只是我的两分钱,希望对您有所帮助.

This is just my two cents, hope this helps.