Skip to main content

Coupling....

I've been thinking about coupling for a while now.  It's more than just one class or process knowing about another class or process, that happens all the time.  It's about using the minimum amount of coupling in a program for it's operation.  

Coupling is not a 'one size fits all' issue where there is a right and a wrong way to use it.  It's more of understanding when to use it, when it happens by accident and in general, being aware of the repercussions when too much coupling exists.

In my mind, coupling exists when there is a specific relationship between two classes or processes.  This relationship must be explicit where one class must be coupled by another into for some operation to be viable.  This is not the same as just passing data from one object to another where the data couple be in the form of a third data object (a model, strings, streams, etc) where the two objects are not really bound together but there data is.  This is about objects like a View having access to a model in the MVC pattern but the Model does not have access to the view.   

Coupling can be reduced by providing dynamic patters to abstract away direct coupling, but this has side effects.  Using multiple levels of indirection to avoid coupling can lead to logic that is hard to understand or maintain by other programmers later in the projects lifecycle.  Abstracting connections without a firm business needs may make the code overly complex and hide the classes relationships.   You can see this patten when using reflection that may then load a configuration file that loads a class that...... you get the picture.  Not fun to modify or debug.

On the other side the coin is how indirect coupling can be created by over use of patterns like dependance injection where annotations spread through the source files with little thought on the tangled relationships that ensue throughout the code.  Dependance injections is wonderful but not if it obfuscates the is-a and has-a relationships into a mass of dependancies.  Dependance injection does not replace the design and understanding of the class relationships and operation.

Coupling issue are not limited to source code.  The same could be said of build projects, unit tests and other supporting aspects of a project.  

  

Comments

Popular posts from this blog

There is no "Right" way.

It's not that your way is not the right way, it's that everyone has their own right way.  So which is the right way?  Is there a right way? Software development is full of discussions that revolve about the "right" way of doing something. The terms used in discussing software design, tools and implementation are so undefined as to make them meaningless.  Code is not designed and written in a vacuum, it's designed by real people in real companies, each with their own constraints and issues.  Code that may look like a hack could have been the result of an employee dragged out of bed at 2am by a company shirt that only cared that they they did not lose their personal client the next morning.  Everything must be looked at in context.  A project written to "Best Practices" may never be finished before development funding dries up.   Goals, vision, constraints and thoughts should be somewhat aligned for project to be successful (or at least enjoyable ...

3rd Try is a Charm

I've been trying to draw / paint these barns for a couple of years but never felt or got them right.  This time I think they turned out right. So What went wrong before and what's right now with this drawing?  This time, the light was right.  It's coming from the upper right and the shadows just looked right.  The other thing is the corn field on the left had to "be in season", otherwise it's just a plowed field.  I had taken other photos from different angles but they never felt right.  This angle has the road, power lines, corn field, etc. all leading to the right.  The shadows on the lower right helps fill in that corner (don't forget about the corners!).  The last part is trying to draw (ink paint maybe) the trees in the background.  Not so easy when they are kind of a blob is green shades. So yeah, it's composition that is king.  Many times I just don't see it until the drawing / painting is finished and when it's right it feels goo...

So THIS is My Style?

 If I play around long enough my style will appear.  I'm guessing that this is kind of it.  I'll keep working on other techniques in watercolor but for now this appears to be my style. I do like it and others appear (to my face) to also like this.  Not every one of my paintings is a success.  About 1/3 so far, but when they do I am rather pleased that anything good comes out of it at all. I do love color.  Color is happy and outdoors is full of color, be it the west or back east with the greens.  Color color color. Also doing some painting on hot press paper and see how that goes. Later......