|By Samuel Neff||
|April 3, 2003 12:00 AM EST||
Components bring to ColdFusion MX developers much of the power and practices of object-oriented programming. The component implementation in ColdFusion MX introduces us to many of the principles of OOP, including encapsulation and inheritance. One aspect of these features is the ability to create new components that inherit or extend the functionality of other components.
In order to effectively extend functionality, developers often require the ability to override existing component functions as well as still call the original functions to incorporate their programming logic. Since ColdFusion MX doesn't currently provide this ability, we'll explore a technique to work around this limitation that enables us to call a parent component's overridden method.
With component-based development, related code can easily be grouped together in a consolidated entity, giving us the ability to encapsulate data and functionality. This consolidation can be further expanded with the ability to inherit functionality from a parent component, also called extension. When one component extends another, it can both reuse the functionality of the original component and add its own functionality.
Often, the new functionality added to a component will replace its original functionality. This is an advantage to developers who utilize the component in their code since the parent and child components will each have a similar call interface, or function names. By maintaining a consistent interface, developers can write code that can use either the parent or child component interchangeably without modifying the calling code.
For an example of this, see Listing 1, which sets up two components, GreetingBase.cfc and GreetingChild.cfc. GreetingChild extends the functionality of GreetingBase, and both provide a single function, sayGreeting, which returns a greeting to the caller. The caller can use either component and call the same function to retrieve the result appropriate for the component being used, a feature known in OOP as polymorphism.
Calling Overridden Parent Component Functions
We run into a limitation when we try to utilize the parent component functionality for a function that we've overridden, in this case sayGreeting. We want to add a function sayAllGreetings, which returns the results of both the parent and the child components' sayGreeting functions. While you can create an instance of the parent component and call the new instance's sayGreeting method, this would not return accurate results in cases where the call depends on data in the component instance. Unfortunately, there is no mechanism in ColdFusion MX to call an overridden parent method and have it run in the context of the calling component instance.
Many other OOP languages, such as Java and even ActionScript, allow calling a parent class's methods through the keyword Super. While ColdFusion MX does not provide this ability, there is an often-overlooked feature that we can use to achieve the desired effect.
ColdFusion stores function references and variables equally. A function can be called by referring to the function name followed by parentheses, as you are accustomed. Additionally, the function reference can also be utilized by simply referring to the function name. The most common utilization of this feature is to copy a function to another scope, and here we'll use this ability to make a parent component's functions available to its children.
Any code that exists within the cfcomponent tags and outside of any cffunction tags is executed when the component is instantiated. This code is most often used to set up or initialize the component and is called the Constructor in OOP terms.
<!--- constructor code goes here --->
In Listing 2 we added some code to our original components. GreetingBase.cfc now has two lines of code in the constructor.
<cfset super = structNew()>
<cfset super.sayGreeting = sayGreeting>
What we've done here is set up a structure called "super", which we'll use as a holder for our parent component methods. After creating the structure we use cfset to copy a reference to the function to our structure. It's important to note here that when this code is run, the component will exist only as the parent component, so any functionality that is overridden in the child component has not yet been incorporated.
With this structure created and our parent functions safely stored, we can utilize them in the child, GreetingChild.cfc, as follows:
<cfset var greetings="Parent says '" &
"', Child says '" &
sayGreeting() & "'">
In this code we put together a string in which we call our parent component's sayGreeting function, through our super structure, and also call the current sayGreeting function as we normally would.
Super Structure Limitations
Through a little creative utilization of obscure features, we've been able to implement a very important feature common to OOP. However, our implementation is not comprehensive and does have limitations.
This technique can only be used to implement one level of parent-component calls. Since each component in the inheritance chain does not have its own data location where we can store the parent component's methods, we can only store the methods from a single parent component.
Additionally, we must recognize that this is a workaround to provide for functionality missing from ColdFusion MX. Since this feature is standard for OOP and commonly requested from developers, Macromedia will probably implement this functionality natively in a future version of ColdFusion.
When adding support for parent-component calls, Macromedia is likely to use the keyword "super" in their own implementation since this is used in both Java and ActionScript. With this change, our code will stop working since "super" will become a keyword. While this may seem like a problem, it is actually an advantage.
Since we no longer need our workaround once parent component calls are implemented in ColdFusion, we want to ensure that we can easily remove this workaround when it becomes obsolete. To accomplish this, wrap all of the super workaround code, the parent-component constructor, inside consistent comments as shown in Listing 3.
With these comments, we can utilize the Regular Expression replace in either ColdFusion Studio or Dreamweaver to remove all of the super structures from our code. As long as the keyword super is used for this functionality natively, the rest of our code will continue to work.
Component-based development brings to ColdFusion MX many of the features of OOP. By using a structure and function references, we were able to bring a common feature of OOP to ColdFusion, albeit with limitations. In recognizing these limitations, we can write our code in a forward-thinking manner and facilitate future changes to the code when they come in conflict with possible new functionality.
IoT is rapidly changing the way enterprises are using data to improve business decision-making. In order to derive business value, organizations must unlock insights from the data gathered and then act on these. In their session at @ThingsExpo, Eric Hoffman, Vice President at EastBanc Technologies, and Peter Shashkin, Head of Development Department at EastBanc Technologies, discussed how one organization leveraged IoT, cloud technology and data analysis to improve customer experiences and effi...
Jun. 30, 2016 11:30 AM EDT Reads: 588
Basho Technologies has announced the latest release of Basho Riak TS, version 1.3. Riak TS is an enterprise-grade NoSQL database optimized for Internet of Things (IoT). The open source version enables developers to download the software for free and use it in production as well as make contributions to the code and develop applications around Riak TS. Enhancements to Riak TS make it quick, easy and cost-effective to spin up an instance to test new ideas and build IoT applications. In addition to...
Jun. 30, 2016 11:15 AM EDT Reads: 699
The idea of comparing data in motion (at the sensor level) to data at rest (in a Big Data server warehouse) with predictive analytics in the cloud is very appealing to the industrial IoT sector. The problem Big Data vendors have, however, is access to that data in motion at the sensor location. In his session at @ThingsExpo, Scott Allen, CMO of FreeWave, discussed how as IoT is increasingly adopted by industrial markets, there is going to be an increased demand for sensor data from the outermos...
Jun. 30, 2016 11:00 AM EDT Reads: 430
CenturyLink has announced that application server solutions from GENBAND are now available as part of CenturyLink’s Networx contracts. The General Services Administration (GSA)’s Networx program includes the largest telecommunications contract vehicles ever awarded by the federal government. CenturyLink recently secured an extension through spring 2020 of its offerings available to federal government agencies via GSA’s Networx Universal and Enterprise contracts. GENBAND’s EXPERiUS™ Application...
Jun. 30, 2016 11:00 AM EDT Reads: 456
The cloud market growth today is largely in public clouds. While there is a lot of spend in IT departments in virtualization, these aren’t yet translating into a true “cloud” experience within the enterprise. What is stopping the growth of the “private cloud” market? In his general session at 18th Cloud Expo, Nara Rajagopalan, CEO of Accelerite, explored the challenges in deploying, managing, and getting adoption for a private cloud within an enterprise. What are the key differences between wh...
Jun. 30, 2016 11:00 AM EDT Reads: 1,069
Presidio has received the 2015 EMC Partner Services Quality Award from EMC Corporation for achieving outstanding service excellence and customer satisfaction as measured by the EMC Partner Services Quality (PSQ) program. Presidio was also honored as the 2015 EMC Americas Marketing Excellence Partner of the Year and 2015 Mid-Market East Partner of the Year. The EMC PSQ program is a project-specific survey program designed for partners with Service Partner designations to solicit customer feedbac...
Jun. 30, 2016 10:45 AM EDT Reads: 640
The IoT is changing the way enterprises conduct business. In his session at @ThingsExpo, Eric Hoffman, Vice President at EastBanc Technologies, discussed how businesses can gain an edge over competitors by empowering consumers to take control through IoT. He cited examples such as a Washington, D.C.-based sports club that leveraged IoT and the cloud to develop a comprehensive booking system. He also highlighted how IoT can revitalize and restore outdated business models, making them profitable ...
Jun. 30, 2016 10:30 AM EDT Reads: 549
There are several IoTs: the Industrial Internet, Consumer Wearables, Wearables and Healthcare, Supply Chains, and the movement toward Smart Grids, Cities, Regions, and Nations. There are competing communications standards every step of the way, a bewildering array of sensors and devices, and an entire world of competing data analytics platforms. To some this appears to be chaos. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, Bradley Holt, Developer Advocate a...
Jun. 30, 2016 10:15 AM EDT Reads: 971
SYS-CON Events has announced today that Roger Strukhoff has been named conference chair of Cloud Expo and @ThingsExpo 2016 Silicon Valley. The 19th Cloud Expo and 6th @ThingsExpo will take place on November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. "The Internet of Things brings trillions of dollars of opportunity to developers and enterprise IT, no matter how you measure it," stated Roger Strukhoff. "More importantly, it leverages the power of devices and the Interne...
Jun. 30, 2016 10:00 AM EDT Reads: 526
The cloud promises new levels of agility and cost-savings for Big Data, data warehousing and analytics. But it’s challenging to understand all the options – from IaaS and PaaS to newer services like HaaS (Hadoop as a Service) and BDaaS (Big Data as a Service). In her session at @BigDataExpo at @ThingsExpo, Hannah Smalltree, a director at Cazena, provided an educational overview of emerging “as-a-service” options for Big Data in the cloud. This is critical background for IT and data profession...
Jun. 30, 2016 09:33 AM EDT Reads: 174
Whether your IoT service is connecting cars, homes, appliances, wearable, cameras or other devices, one question hangs in the balance – how do you actually make money from this service? The ability to turn your IoT service into profit requires the ability to create a monetization strategy that is flexible, scalable and working for you in real-time. It must be a transparent, smoothly implemented strategy that all stakeholders – from customers to the board – will be able to understand and comprehe...
Jun. 30, 2016 09:02 AM EDT Reads: 184
Cloud Expo, Inc. has announced today that Andi Mann returns to 'DevOps at Cloud Expo 2016' as Conference Chair The @DevOpsSummit at Cloud Expo will take place on November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. "DevOps is set to be one of the most profound disruptions to hit IT in decades," said Andi Mann. "It is a natural extension of cloud computing, and I have seen both firsthand and in independent research the fantastic results DevOps delivers. So I am excited t...
Jun. 30, 2016 09:00 AM EDT Reads: 365
In addition to all the benefits, IoT is also bringing new kind of customer experience challenges - cars that unlock themselves, thermostats turning houses into saunas and baby video monitors broadcasting over the internet. This list can only increase because while IoT services should be intuitive and simple to use, the delivery ecosystem is a myriad of potential problems as IoT explodes complexity. So finding a performance issue is like finding the proverbial needle in the haystack.
Jun. 30, 2016 09:00 AM EDT Reads: 425
Apixio Inc. has raised $19.3 million in Series D venture capital funding led by SSM Partners with participation from First Analysis, Bain Capital Ventures and Apixio’s largest angel investor. Apixio will dedicate the proceeds toward advancing and scaling products powered by its cognitive computing platform, further enabling insights for optimal patient care. The Series D funding comes as Apixio experiences strong momentum and increasing demand for its HCC Profiler solution, which mines unstruc...
Jun. 30, 2016 08:45 AM EDT Reads: 577
The Internet of Things will challenge the status quo of how IT and development organizations operate. Or will it? Certainly the fog layer of IoT requires special insights about data ontology, security and transactional integrity. But the developmental challenges are the same: People, Process and Platform and how we integrate our thinking to solve complicated problems. In his session at 19th Cloud Expo, Craig Sproule, CEO of Metavine, will demonstrate how to move beyond today's coding paradigm ...
Jun. 30, 2016 08:00 AM EDT Reads: 551
Internet of @ThingsExpo has announced today that Chris Matthieu has been named tech chair of Internet of @ThingsExpo 2016 Silicon Valley. The 6thInternet of @ThingsExpo will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
Jun. 30, 2016 07:00 AM EDT Reads: 439
"We work in the area of Big Data analytics and Big Data analytics is a very crowded space - you have Hadoop, ETL, warehousing, visualization and there's a lot of effort trying to get these tools to talk to each other," explained Mukund Deshpande, head of the Analytics practice at Accelerite, in this SYS-CON.tv interview at 18th Cloud Expo, held June 7-9, 2016, at the Javits Center in New York City, NY.
Jun. 29, 2016 04:15 PM EDT Reads: 483
UAS, drones or unmanned aircraft, no matter what you call them — this was their week. Our news stream was flooded with updates on the newly announced rules and regulations for commercial UAS from the FAA. So, naturally we have dedicated this week’s top news round up to highlight some of our favorite UAS stories.
Jun. 29, 2016 03:02 PM EDT Reads: 336
When people aren’t talking about VMs and containers, they’re talking about serverless architecture. Serverless is about no maintenance. It means you are not worried about low-level infrastructural and operational details. An event-driven serverless platform is a great use case for IoT. In his session at @ThingsExpo, Animesh Singh, an STSM and Lead for IBM Cloud Platform and Infrastructure, will detail how to build a distributed serverless, polyglot, microservices framework using open source tec...
Jun. 29, 2016 12:30 PM EDT Reads: 588
IoT offers a value of almost $4 trillion to the manufacturing industry through platforms that can improve margins, optimize operations & drive high performance work teams. By using IoT technologies as a foundation, manufacturing customers are integrating worker safety with manufacturing systems, driving deep collaboration and utilizing analytics to exponentially increased per-unit margins. However, as Benoit Lheureux, the VP for Research at Gartner points out, “IoT project implementers often ...
Jun. 29, 2016 10:45 AM EDT Reads: 584