The Law of Demeter indicates that you should only speak to objects that you know about directly. That is, do not perform method chaining to talk to other objects. When you do so, you are establishing improper linkages with the intermediary objects, inappropriately coupling your code to other code.
That's bad.
The solution would be fo...
I'm trying to tell someone his code is not "coherent" in the sense that it serves multiple purposes. I don't think I can explain it very well, so I'm looking for a good reference and/or definition.
...
I have 2 classes for the game i am making,
gui class and the logic class, for a game of noughts and crosses. The GUI class has a method that uses an array of JButtons and returns them all with the same anonymous inner class action listener
The problem is this, when i click the button i want the text to change to an x or a o dependant ...
Loose coupling, high cohesion for a
maintainable application
This is the battle-cry that I hear over and over. There is plenty of advice on how to loosely couple components.
Base on interfaces and inject all dependencies
Use events
Use a service bus
etc.
However, I feel like I've never really heard any specific suggestions fo...
I have the following method and interface:
public object ProcessRules(List<IRule> rules)
{
foreach(IRule rule in rules)
{
if(EvaluateExpression(rule.Exp) == true) return rule.Result;
}
//Some error handling here for not hitting any rules
}
public interface IRule
{
Expression Exp;
Object Result;
int ...
Can anyone tell me what are Cohesion and Decoupling? I found coupling but there is no Decoupling anywhere. I need to learn their meanings.
Any help will be appreciated. Thanks for replying.
...
I'm trying to implement a PuSH Publisher on rails. To do that I need to send an HTTP POST request to another server (a PuSH Hub) when my model updates and one of the parameters is a url to my feed (the model that changed).
Where in rails (in the MVC) am I able to do this request when my model changes and can build the url to the changed...
I'm making a simple 3D CAD software. in the class diagram, many objects need to distinguish with others by (x,y,z). I create a class so-called "Position", but the problem is it looks highly-coupling because many classese work with position.
Any ideas?
...
I am learning programing and software design and Java in school right now. The class that is getting me mixed up is Software Design. We are using Word to run simple VB code to do simple programs. My instructor says I am losing cohesion by using running totals. I am having a hard time thinking of a way to avoid them. Here is an examp...
Imagine that 90% of your job is merely to triage issues on a very massive, very broken website. Imagine that this website is written in the most tightly coupled, least cohesive PHP code you've ever seen, the type of code that would add the original developers to your "slap on sight" list. Imagine that this web application is made up of 4...
I was reading Robert Martin's Clean Code and in that he mentions about the code being highly cohesive:
Classes should have a small number of
instance variables. Each of the
methods of a class should manipulate
one or more of those variables. In
general the more variable a method
manipulates the more cohesive that
method ...