decoupling

Avoiding coupling with Strategy pattern

孤者浪人 提交于 2019-12-05 09:03:45
I am attempting to apply the Strategy pattern to a particular situation, but am having an issue with how to avoid coupling each concrete strategy to the context object providing data for it. The following is a simplified case of a pattern that occurs a few different ways, but should be handled in a similar way. We have an object Acquisition that provides data relevant to a specific frame of time - basically a bunch of external data collected using different pieces of hardware. It's already too large because of the amount of data it contains, so I don't want to give it any further

Rails apps that decouple ActiveRecord from Business Logic

荒凉一梦 提交于 2019-12-04 14:26:12
问题 I recently came across Robert Martin's (Uncle Bob) keynote on how to structure a rails app based on use-cases. I found this very interesting. Here is the link to the keynote: Architecture: the Lost Years Here is a sample project that structures the app based on the principles mentioned by Robert Martin in his keynote: Guru Watch I was wondering if there were well established rails applications out there that are structured in such fashion ( Use Case Driven Approach / Entity-Control-Boundary

How to decouple mode switching and commands

邮差的信 提交于 2019-12-03 22:50:23
问题 How to decouple a Mode (normally expressed by enums) from its implementation in commands and their relationship? Is their a good pattern describing the loose binding between a mode switch (int, enum, string, ...) and its command calls? I want to add modes via config, so this must be (dynamically) easy extendable (without programming). I already know the command pattern (ICommand in C#/.Net). It could be an Dictionary of Commands and their related mode number, but what about the switching

Model Using Modules in Rails Application

牧云@^-^@ 提交于 2019-12-03 18:51:10
问题 I have a model that requires loading external data from an auxiliary source. A number of web services exist that my model can fetch the data from (swappable), but I don't want to create code that will make it difficult to change services (costs significantly differ based on variable and fixed usage and it is likely changing will be required). I would like to create a driver to perform the interaction (and then create further custom drivers if the service requires switching). Unfortunately,

Rails apps that decouple ActiveRecord from Business Logic

匆匆过客 提交于 2019-12-03 08:31:47
I recently came across Robert Martin's (Uncle Bob) keynote on how to structure a rails app based on use-cases. I found this very interesting. Here is the link to the keynote: Architecture: the Lost Years Here is a sample project that structures the app based on the principles mentioned by Robert Martin in his keynote: Guru Watch I was wondering if there were well established rails applications out there that are structured in such fashion ( Use Case Driven Approach / Entity-Control-Boundary architecture / decoupling back end from front-end ) Well, I can't share the code, but I can point you to

How is JavaScript library bloat mitigated with Web Components?

廉价感情. 提交于 2019-12-03 06:36:30
问题 As someone who has tried to find a way to help content authors develop and maintain big web sites by creating (HTML) components for years, I'm really excited to see web components gaining tracction at w3c, google and mozilla. But it seems to me that, there is no measure against javascript library bloat in the specifications. Say that I develop component A which has a dependency for underscore.js and want to use components B and C which have dependencies on lodash.js version 1.*, etc. I don't

Cohesion and Decoupling, what do they represent?

房东的猫 提交于 2019-12-03 00:47:45
问题 What are Cohesion and Decoupling? I found information about coupling but not about decoupling. 回答1: That article from Aaron is very good for understanding, also I'd recommend that you read manning publications Spring in Action book, they give very good examples on how the spring solves that problem it will definitely improve your understanding of this. EDIT : I came accross this in this great book called Growing object oriented software guided by tests : Coupling : Elements are coupled if a

How is JavaScript library bloat mitigated with Web Components?

冷暖自知 提交于 2019-12-02 20:13:13
As someone who has tried to find a way to help content authors develop and maintain big web sites by creating (HTML) components for years, I'm really excited to see web components gaining tracction at w3c, google and mozilla. But it seems to me that, there is no measure against javascript library bloat in the specifications. Say that I develop component A which has a dependency for underscore.js and want to use components B and C which have dependencies on lodash.js version 1.*, etc. I don't see any way to flag dependencies and library versions. This could lead to huge library bloat when we

Best practice for Android MVVM startActivity

这一生的挚爱 提交于 2019-12-02 17:29:45
I am building an Android App using MVVM and DataBinding. And I have a function inside my ViewModel that starts an Activity. Is it okay to have an onClick call inside a ViewModel? Like this. public class MyViewModel { public void onClick(View view, long productId) { Context context = view.getContext(); Intent intent = new Intent(context, ProductDetailActivity.class); intent.putExtra("productId", productId); context.startActivity(intent); } } And in my XML: ... android:onClick="@{(v) -> viewModel.onClick(v, viewModel.product.id)}"> Or would it be a best practice to move it to the View and call

Cohesion and Decoupling, what do they represent?

▼魔方 西西 提交于 2019-12-02 14:15:06
What are Cohesion and Decoupling? I found information about coupling but not about decoupling. ant That article from Aaron is very good for understanding, also I'd recommend that you read manning publications Spring in Action book, they give very good examples on how the spring solves that problem it will definitely improve your understanding of this. EDIT : I came accross this in this great book called Growing object oriented software guided by tests : Coupling : Elements are coupled if a change in one forces a change in the other. For example, if two classes inherit from a common parent,