loose-coupling

Why is tightly coupled bad but strongly typed good?

强颜欢笑 提交于 2019-12-03 09:41:23
问题 I am struggling to see the real-world benefits of loosely coupled code. Why spend so much effort making something flexible to work with a variety of other objects? If you know what you need to achieve, why not code specifically for that purpose? To me, this is similar to creating untyped variables: it makes it very flexible, but opens itself to problems because perhaps an unexpected value is passed in. It also makes it harder to read, because you do not explicitly know what is being passed in

How to Implement Loose Coupling with a SOA Architecture

青春壹個敷衍的年華 提交于 2019-12-03 00:21:48
I've been doing a lot of research lately about SOA and ESB's etc. I'm working on redesigning some legacy systems at work now and would like to build it with more of a SOA architecture than it currently has. We use these services in about 5 of our websites and one of the biggest problems we have right now with our legacy system is that almost all the time when we make bug fixes or updates we need to re-deploy our 5 websites which can be a quite time consuming process. My goal is to make the interfaces between services loosely coupled so that changes can be made without having to re-deploy all

Is it a leaky abstraction if implementation of interface calls Dispose

空扰寡人 提交于 2019-11-29 13:39:11
Consider this code: public class MyClass() { public MyClass() { } public DoSomething() { using (var service = new CustomerCreditServiceClient()) { var creditLimit = service.GetCreditLimit( customer.Firstname, customer.Surname, customer.DateOfBirth); } } } We now want to refactor it to loosely couple it. We end up with this: public class MyClass() { private readonly ICustomerCreditService service; public MyClass(ICustomerCreditService service) { this.service= service; } public DoSomething() { var creditLimit = service.GetCreditLimit( customer.Firstname, customer.Surname, customer.DateOfBirth);

Why should a web architecture be loosely coupled?

北城余情 提交于 2019-11-28 16:46:48
问题 When I look at ASP.NET MVC projects I everytime see loose coupled architecture. For what do I need a loose coupling in a web architecture (if I do not make unit tests)? What are advantages and disadvantages of this? What is the main reason to decouple layers/classes? What if I do not want to change my DAL for example? I mean when shall I change my whole DAL?! So I could couple my DAL to the UI. What is bad with this? 回答1: It will save you a lot of time for any project that isn't trivially

Is it a leaky abstraction if implementation of interface calls Dispose

狂风中的少年 提交于 2019-11-28 07:15:17
问题 Consider this code: public class MyClass() { public MyClass() { } public DoSomething() { using (var service = new CustomerCreditServiceClient()) { var creditLimit = service.GetCreditLimit( customer.Firstname, customer.Surname, customer.DateOfBirth); } } } We now want to refactor it to loosely couple it. We end up with this: public class MyClass() { private readonly ICustomerCreditService service; public MyClass(ICustomerCreditService service) { this.service= service; } public DoSomething() {

Construct testable business layer logic

可紊 提交于 2019-11-28 02:28:34
I am building an applications in .net/c#/Entity Framework that uses a layered architecture. The applications interface to the outside world is a WCF service Layer. Underneath this layer I have the BL, Shared Library and the DAL. Now, in order to make the business logic in my application testable, I am trying to introduce separation of concerns, loose coupling and high cohesion in order to be able to inject dependencies while testing. I need some pointers as to if my approach described below is good enough or if I should be decoupling the code even further. The following code snippet is used to

What is “loose coupling?” Please provide examples

夙愿已清 提交于 2019-11-26 12:35:37
I can't seem to grok the concept of "loose coupling." I suppose it doesn't help that the word "loose" usually has a negative connotation, so I always forget that loose coupling is a good thing. Will somebody please show some "before" and "after" code (or pseudocode) that illustrates this concept? Wedge Consider a simple shopping cart application that uses a CartContents class to keep track of the items in the shopping cart and an Order class for processing a purchase. The Order needs to determine the total value of the contents in the cart, it might do that like so: Tightly Coupled Example:

What is “loose coupling?” Please provide examples

馋奶兔 提交于 2019-11-26 03:00:13
问题 I can\'t seem to grok the concept of \"loose coupling.\" I suppose it doesn\'t help that the word \"loose\" usually has a negative connotation, so I always forget that loose coupling is a good thing. Will somebody please show some \"before\" and \"after\" code (or pseudocode) that illustrates this concept? 回答1: Consider a simple shopping cart application that uses a CartContents class to keep track of the items in the shopping cart and an Order class for processing a purchase. The Order needs