Programming Theory & Fundamentals: Coupling

Published on Wednesday, November 28, 2012

Description

If you want to know how to make a program that's actually reusable, flexible, and easier to test, the best tip I can give you is this: write loosely coupled code. This is one of the most basic of all programming fundamentals, yet one of the least taught amongst beginner software development tutorials. You should always strive to have loosely coupled code because it will allow you to have more flexible code, more reusable, easier to test, and easier to maintain code. A good way to decouple your code is to use dependency injection. Generally, if you have components (classes or functions) that create concrete objects internally, chances are that you are making the coupling between those two units far too tight. If you cannot easily change the behavior of a function, for example, from within your client code, then you most likely have a coupling issue that would improve your program if handled properly (in other words, if you break the coupling problem, the program will be of higher quality). For more programming theory video tutorials, check out the complete playlist at http://www.youtube.com/playlist?list=PLGJDCzBP5j3wrKpj55pvjv9vUiZADhjXe Other links of interest: -- Our YouTube channel http://www.youtube.com/user/easylearntutorial -- Visit our website http://www.easylearntutorial.com for more text and video tutorials, updates, and upcoming tutorial articles and events -- Like us on Facebook http://www.facebook.com/easylearntutorialonline -- Follow us on Twitter http://www.twitter.com/easylearntuts

Copyright © 2014-2017 EasyLearnTutorial. All rights reserved.