cross-cutting-concerns

Does groovy provide an include mechanism?

痴心易碎 提交于 2019-12-22 04:41:02
问题 We are searching for an include mechanism for groovy scripts to have space for cross-cutting-concerns. In my example we have, web service endpoints as groovy scripts and want to log to our web service protocol. for that we use our implicit object (getting from our framework) to create the logging statement. But this is boilerplate code if we code this in every web service endpoint. We are searching for something like include() in php, that includes other groovy scripts, are there any ideas

How can we create a callcontext for async .net methods?

久未见 提交于 2019-12-13 18:33:55
问题 In a synchronous environment, it is easy to create a scoped context which allows you to attach out-of-band context to your current thread. Examples of this are the current TransactionScope or thread-static logging context. using (new MyContext(5)) Assert.Equal(5, MyContext.Current); Assert.Equal(null, MyContext.Current); It is easy to implement the context using a combination of IDisposable and a thread-static field. Obviously, this falls apart when using async methods, because the context is

Does groovy provide an include mechanism?

风格不统一 提交于 2019-12-05 05:19:53
We are searching for an include mechanism for groovy scripts to have space for cross-cutting-concerns. In my example we have, web service endpoints as groovy scripts and want to log to our web service protocol. for that we use our implicit object (getting from our framework) to create the logging statement. But this is boilerplate code if we code this in every web service endpoint. We are searching for something like include() in php, that includes other groovy scripts, are there any ideas how to do this? Since you already mentioned “cross-cutting-concerns” I’d say that you need to intercept

Logging as a decorator vs. Dependency Injection - what if I need to log inside the class?

爱⌒轻易说出口 提交于 2019-12-04 16:11:10
问题 (I originally asked this question in this comment, but Mark Seemann asked me to create a new question instead.) I'm starting a new app (.NET Core, if that matters), and right now I'm trying to decide how exactly to do logging. The general consensus seems to be that logging is a cross-cutting concern, so the logger shouldn't be injected directly into the class that is supposed to log. Often, there's an example like the following class how not to do it: public class BadExample : IExample {

Logging as a decorator vs. Dependency Injection - what if I need to log inside the class?

徘徊边缘 提交于 2019-12-03 10:15:27
(I originally asked this question in this comment , but Mark Seemann asked me to create a new question instead.) I'm starting a new app (.NET Core, if that matters), and right now I'm trying to decide how exactly to do logging. The general consensus seems to be that logging is a cross-cutting concern, so the logger shouldn't be injected directly into the class that is supposed to log. Often, there's an example like the following class how not to do it: public class BadExample : IExample { private readonly ILogger logger; public BadExample(ILogger logger) { this.logger = logger; } public void

Cross cutting concern example

≯℡__Kan透↙ 提交于 2019-11-27 10:04:22
What is a good example of a cross-cutting concern ? The medical record example on the wikipedia page seems incomplete to me. Specifically from this example, why would logging lead to code duplication ( scattering )? (Besides simple calls such as log("....") everywhere, which doesn't seem like a big deal). What is the difference between a core concern and a cross-cutting concern ? My end goal is to get a better understanding of AOP. Before understanding the Crosscutting Concern , we have to understand the Concern . A Concern is a term that refers to a part of the system divided on the basis of

Cross cutting concern example

拥有回忆 提交于 2019-11-26 22:19:01
问题 What is a good example of a cross-cutting concern ? The medical record example on the wikipedia page seems incomplete to me. Specifically from this example, why would logging lead to code duplication ( scattering )? (Besides simple calls such as log("....") everywhere, which doesn't seem like a big deal). What is the difference between a core concern and a cross-cutting concern ? My end goal is to get a better understanding of AOP. 回答1: Before understanding the Crosscutting Concern , we have