Inversion of Control Rocks
Inversion of Control Rocks
By: Paul Hammant
Dec. 4, 2003 12:00 AM
Inversion of Control (IoC) is about software components doing what they are told, when they are told. Your OO application could well become unmaintainable without it.
IoC is a pattern that helps teams avoid the dependency hell that results when an application grows into a large pseudo-platform without taking care to adequately decouple logic; that thing that ultimately only a couple of its omnipotent architects or old-lag premium-rate contractors really understand; that system that Heath Robinson and Rube Goldberg might have made together (look them up).
The problem with small working applications that become large is that static-method entanglement does not scale. One part of a system that's otherwise fairly self-contained statically accesses another part of the system and cannot be instantiated without invoking methods in the latter. Thus it can't easily be isolated for unit testing. What's more, it can't be developed as an independent component. Components that are developed separately can have their own development teams and may well be part of a larger design. These components will have their own source control directory and can be developed against mock implementations of their dependent components. All this will help overall development become faster, in terms of both the team's efficiency and the build time.
As an example, let's take a Personal Information Manager (PIM) application that has UI and persistence elements. The naïve implementation might have inline JDBC statements among graphical code. A componentized application would have that persistence logic separated into a persistence component with user interface logic enshrined in a view-controller component. Clearly, if the two teams developing their respective components agree on a slowly evolving interface/implementation-separated API for persistence, they can develop at their own pace and ship versions of their components whenever it's appropriate.
A third piece, which is not a component, would be the bootstrap for the application. That bootstrap may well be entirely contained in a static main method of a simple class and would merely instantiate the two components, passing one into the other's constructor before invoking setVisible(true) or similar. With the introduction of this bootstrap we can see the control aspect of the IoC pattern.
In a noncomponentized version of our example, the view-controller may well have its own main method, might instantiate a fixed version of the PIM store, or access it via an unnecessary singleton factory (public static methods are generally bad), i.e., the control is very much inside the component in question.
The word "inversion" from the pattern name is about getting control back. The containing application (often a true container or a proper framework rather than a main method) controls when a component is instantiated and which implementations of its dependent components it is passed.
IoC also dictates the configuration of components. A JDBC version of the PIM store above would clearly require some JDBC settings. Classically, developers may write a mechanism to retrieve them from a fixed properties file. IoC would insist that the configuration is passed into the component. In our hypothetical example, it would take it via the constructor and be interface/implementation separated. Thus the configuration is a component. It would be tightly coupled to the component that requires it, but subject to multiple implementations, one of which may be the "from properties file".
Inversion of Control has moved to the center stage in the last six months after a five-year gestation period. There are three types of Inversion of Control. Type 1 uses configuration data (Avalon, JContainer); Type 2 uses bean introspection (Spring Framework, WebWork2, HiveMind); Type 3 uses constructor signatures (PicoContainer).
For a componentized system that uses singletons or similar for component resolution, the dependency is obscure. In IoC it is declarative. The application would have loosely coupled components and be more scalable, more maintainable, and more testable. It's a very small investment for a very large return. Inversion of Control rocks.
Reader Feedback: Page 1 of 1
Virtualization Articles & Feature Stories
Latest Virtualization Conference News
Best Recent Articles on Cloud Computing & Big Data Topics
As we enter a new year, it is time to look back over the past year and resolve to improve upon it. In 2014, we will see more service providers resolve to add more personalization in enterprise technology. Below are seven predictions about what will drive this trend toward personalization.
IT organizations face a growing demand for faster innovation and new applications to support emerging opportunities in social, mobile, growth markets, Big Data analytics, mergers and acquisitions, strategic partnerships, and more. This is great news because it shows that IT continues to be a key stakeholder in delivering business service innovation. However, it also means that IT must deliver new innovation despite flat budgets, while maintaining existing services that grow more complex every day.
Cloud computing is transforming the way businesses think about and leverage technology. As a result, the general understanding of cloud computing has come a long way in a short time. However, there are still many misconceptions about what cloud computing is and what it can do for businesses that adopt this game-changing computing model. In this exclusive Q&A with Cloud Expo Conference Chair Jeremy Geelan, Rex Wang, Vice President of Product Marketing at Oracle, discusses and dispels some of the common myths about cloud computing that still exist today.
Despite the economy, cloud computing is doing well. Gartner estimates the cloud market will double by 2016 to $206 billion. The time for dabbling in the cloud is over! The 14th International Cloud Expo, co-located with 5th International Big Data Expo and 3rd International SDN Expo, to be held June 10-12, 2014, at the Javits Center in New York City, N.Y. announces that its Call for Papers is now open. Topics include all aspects of providing or using massively scalable IT-related capabilities as a service using Internet technologies (see suggested topics below). Cloud computing helps IT cut infrastructure costs while adding new features and services to grow core businesses. Clouds can help grow margins as costs are cut back but service offerings are expanded. Help plant your flag in the fast-expanding business opportunity that is The Cloud, Big Data and Software-Defined Networking: submit your speaking proposal today!
What do you get when you combine Big Data technologies….like Pig and Hive? A flying pig? No, you get a “Logical Data Warehouse.” In 2012, Infochimps (now CSC) leveraged its early use of stream processing, NoSQLs, and Hadoop to create a design pattern which combined real-time, ad-hoc, and batch analytics. This concept of combining the best-in-breed Big Data technologies will continue to advance across the industry until the entire legacy (and proprietary) data infrastructure stack will be replaced with a new (and open) one.
While unprecedented technological advances have been made in healthcare in areas such as genomics, digital imaging and Health Information Systems, access to this information has been not been easy for both the healthcare provider and the patient themselves. Regulatory compliance and controls, information lock-in in proprietary Electronic Health Record systems and security concerns have made it difficult to share data across health care providers.
Cloud Expo, Inc. has announced today that Vanessa Alvarez has been named conference chair of Cloud Expo® 2014. 14th International Cloud Expo will take place on June 10-12, 2014, at the Javits Center in New York City, New York, and 15th International Cloud Expo® will take place on November 4-6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
12th International Cloud Expo, held on June 10–13, 2013 at the Javits Center in New York City, featured four content-packed days with a rich array of sessions about the business and technical value of cloud computing led by exceptional speakers from every sector of the cloud computing ecosystem. The Cloud Expo series is the fastest-growing Enterprise IT event in the past 10 years, devoted to every aspect of delivering massively scalable enterprise IT as a service.
Ulitzer.com announced "the World's 30 most influential Cloud bloggers," who collectively generated more than 24 million Ulitzer page views. Ulitzer's annual "most influential Cloud bloggers" list was announced at Cloud Expo, which drew more delegates than all other Cloud-related events put together worldwide. "The world's 50 most influential Cloud bloggers 2010" list will be announced at the Cloud Expo 2010 East, which will take place April 19-21, 2010, at the Jacob Javitz Convention Center, in New York City, with more than 5,000 expected to attend.
It's a simple fact that the better sales reps understand their prospects' intentions, preferences and pain points during calls, the more business they'll close. Each day, as your prospects interact with websites and social media platforms, their behavioral data profile is expanding. It's now possible to gain unprecedented insight into prospects' content preferences, product needs and budget. We hear a lot about how valuable Big Data is to sales and marketing teams. But data itself is only valuable when it's part of a bigger story, made visible in the right context.
Cloud Expo, Inc. has announced today that Larry Carvalho has been named Tech Chair of Cloud Expo® 2014. 14th International Cloud Expo will take place on June 10-12, 2014, at the Javits Center in New York City, New York, and 15th International Cloud Expo® will take place on November 4-6, 2014, at the Santa Clara Convention Center in Santa Clara, CA.
Everyone talks about a cloud-first or mobile-first strategy. It's the trend du jour, and for good reason as these innovative technologies have revolutionized an industry and made savvy companies a lot of money. But consider for a minute what's emerging with the Age of Context and the Internet of Things. Devices, interfaces, everyday objects are becoming endowed with computing smarts. This is creating an unprecedented focus on the Application Programming Interface (API) as developers seek to connect these devices and interfaces to create new supporting services and hybrids. I call this trend the move toward an API-first business model and strategy.
We live in a world that requires us to compete on our differential use of time and information, yet only a fraction of information workers today have access to the analytical capabilities they need to make better decisions. Now, with the advent of a new generation of embedded business intelligence (BI) platforms, cloud developers are disrupting the world of analytics. They are using these new BI platforms to inject more intelligence into the applications business people use every day. As a result, data-driven decision-making is finally on track to become the rule, not the exception.
Virtualization Blogs Live