|By Matt Osbun||
|May 15, 2007 06:30 PM EDT||
Business Rule Validation
Validating input against business rules is generally more in depth than validating data types. It helps to think of this as giving context to your data. A name, address, and date of birth are nothing more than a set of unrelated data. Once you have applied business rules, however, you have a customer. If business rules give your data meaning, business rule validation ensures that your data is given the correct meaning.
Datatype validation objects are much easier to share than business rule validation objects. This sort of validation is very specific to a given task or application. However, since we are breaking validation into two parts, we can rewrite our business rule validation objects as necessary and reuse our datatype validation objects. Object-oriented applications are really nothing more than a group of objects that are communicating with each other. You, the developer, are free to determine which objects will be a part of a given application. Since our validation objects are loosely coupled, meaning one object doesn't rely on another, we can change out objects as we see fit.
As an example, let's assume that in this particular application our customers need to be between the ages of 13 and 18, and they also need to be citizens of the United States. I would create a Validate() method, perhaps in a customer.cfc object, to check to make sure that the birthdate and citizenship fit the specified parameters. Although this has some similarities to our Validate() method above, the differences are worth pointing out. When validating datatypes, the formBean has no idea how the data will be used. It just knows which form the data is to take. A Customer object, however, is not so much concerned with the representation of the data, but whether or not the data presented can be used to create a valid customer for this application.
Putting It All Together
How you put this all together is really up to you and how you construct your applications. Are you a procedural developer who includes a validation template on a form page once a form submission has been detected? No problem. Your validation template might look something like this:
<cfset datatype = CreateObject("component","myApp.formBean").init(argumentcollection=form)>
<cfset customer = CreateObject("component","myApp.customer").init()>
<cfset validationBean = CreateObject("component","myApp.validationBean").init()>
<!--- Do something to display the error messages --->
<!--- No errors. Continue the application --->
Since I use Mach-II for most of my development needs, I would have an event-bean declared in the mach-ii.xml configuration file for this event, and I would use that bean's Validate() method in an event filter, which is where I would also create my validationBean and, if necessary, any object needed for business rule validation.
Form validation isn't one of those tasks that I look forward to in the morning. Not that I particularly dislike it, but it's just one of those chores of Web development. The object then (no pun intended!) is to make form validation as easy, flexible, and reusable as possible without sacrificing accuracy or functionality.
This is one of the strengths of object-oriented programming. Rather than building one monolithic, interdependent application, it's more like building a house with Legos. This allows you to spend less time on development chores, like form validation, and more time deciding how the Legos should fit together for your application.
|Kevin Penny 05/17/07 01:16:50 AM EDT|
Excellent - I've used some validation methods before but this one makes good sense.
My only comment would be to add another method to the validator that would return true/false if there were errors in it like 'HasErrors()' or 'isEmpty()' vs. using the arraylen() - then you could possily change out how you're returning those errors and your checking code won't have to chanage that much. I suppose the code that loops through it would have to be modified if you went from an array to a query type object anyway - but thought I'd mention it.
SYS-CON Events announced today that Streamlyzer will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Streamlyzer is a powerful analytics for video streaming service that enables video streaming providers to monitor and analyze QoE (Quality-of-Experience) from end-user devices in real time.
Oct. 28, 2016 07:15 AM EDT Reads: 1,112
You have great SaaS business app ideas. You want to turn your idea quickly into a functional and engaging proof of concept. You need to be able to modify it to meet customers' needs, and you need to deliver a complete and secure SaaS application. How could you achieve all the above and yet avoid unforeseen IT requirements that add unnecessary cost and complexity? You also want your app to be responsive in any device at any time. In his session at 19th Cloud Expo, Mark Allen, General Manager of...
Oct. 28, 2016 07:15 AM EDT Reads: 1,117
SYS-CON Events announced today that 910Telecom will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Housed in the classic Denver Gas & Electric Building, 910 15th St., 910Telecom is a carrier-neutral telecom hotel located in the heart of Denver. Adjacent to CenturyLink, AT&T, and Denver Main, 910Telecom offers connectivity to all major carriers, Internet service providers, Internet backbones and ...
Oct. 28, 2016 07:00 AM EDT Reads: 3,748
Established in 1998, Calsoft is a leading software product engineering Services Company specializing in Storage, Networking, Virtualization and Cloud business verticals. Calsoft provides End-to-End Product Development, Quality Assurance Sustenance, Solution Engineering and Professional Services expertise to assist customers in achieving their product development and business goals. The company's deep domain knowledge of Storage, Virtualization, Networking and Cloud verticals helps in delivering ...
Oct. 28, 2016 07:00 AM EDT Reads: 1,170
Intelligent machines are here. Robots, self-driving cars, drones, bots and many IoT devices are becoming smarter with Machine Learning. In her session at @ThingsExpo, Sudha Jamthe, CEO of IoTDisruptions.com, will discuss the next wave of business disruption at the junction of IoT and AI, impacting many industries and set to change our lives, work and world as we know it.
Oct. 28, 2016 07:00 AM EDT Reads: 586
The IoT industry is now at a crossroads, between the fast-paced innovation of technologies and the pending mass adoption by global enterprises. The complexity of combining rapidly evolving technologies and the need to establish practices for market acceleration pose a strong challenge to global enterprises as well as IoT vendors. In his session at @ThingsExpo, Clark Smith, senior product manager for Numerex, will discuss how Numerex, as an experienced, established IoT provider, has embraced a ...
Oct. 28, 2016 06:45 AM EDT Reads: 1,262
Cloud based infrastructure deployment is becoming more and more appealing to customers, from Fortune 500 companies to SMEs due to its pay-as-you-go model. Enterprise storage vendors are able to reach out to these customers by integrating in cloud based deployments; this needs adaptability and interoperability of the products confirming to cloud standards such as OpenStack, CloudStack, or Azure. As compared to off the shelf commodity storage, enterprise storages by its reliability, high-availabil...
Oct. 28, 2016 06:15 AM EDT Reads: 1,305
DevOps is being widely accepted (if not fully adopted) as essential in enterprise IT. But as Enterprise DevOps gains maturity, expands scope, and increases velocity, the need for data-driven decisions across teams becomes more acute. DevOps teams in any modern business must wrangle the ‘digital exhaust’ from the delivery toolchain, "pervasive" and "cognitive" computing, APIs and services, mobile devices and applications, the Internet of Things, and now even blockchain. In this power panel at @...
Oct. 28, 2016 06:00 AM EDT Reads: 2,198
The Quantified Economy represents the total global addressable market (TAM) for IoT that, according to a recent IDC report, will grow to an unprecedented $1.3 trillion by 2019. With this the third wave of the Internet-global proliferation of connected devices, appliances and sensors is poised to take off in 2016. In his session at @ThingsExpo, David McLauchlan, CEO and co-founder of Buddy Platform, discussed how the ability to access and analyze the massive volume of streaming data from millio...
Oct. 28, 2016 05:00 AM EDT Reads: 3,200
In the next forty months – just over three years – businesses will undergo extraordinary changes. The exponential growth of digitization and machine learning will see a step function change in how businesses create value, satisfy customers, and outperform their competition. In the next forty months companies will take the actions that will see them get to the next level of the game called Capitalism. Or they won’t – game over. The winners of today and tomorrow think differently, follow different...
Oct. 28, 2016 04:15 AM EDT Reads: 1,159
“Media Sponsor” of SYS-CON's 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. CloudBerry Backup is a leading cross-platform cloud backup and disaster recovery solution integrated with major public cloud services, such as Amazon Web Services, Microsoft Azure and Google Cloud Platform.
Oct. 28, 2016 04:15 AM EDT Reads: 1,561
According to Forrester Research, every business will become either a digital predator or digital prey by 2020. To avoid demise, organizations must rapidly create new sources of value in their end-to-end customer experiences. True digital predators also must break down information and process silos and extend digital transformation initiatives to empower employees with the digital resources needed to win, serve, and retain customers.
Oct. 28, 2016 02:45 AM EDT Reads: 1,796
SYS-CON Events announced today that SoftNet Solutions will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. SoftNet Solutions specializes in Enterprise Solutions for Hadoop and Big Data. It offers customers the most open, robust, and value-conscious portfolio of solutions, services, and tools for the shortest route to success with Big Data. The unique differentiator is the ability to architect and ...
Oct. 28, 2016 02:30 AM EDT Reads: 1,197
You think you know what’s in your data. But do you? Most organizations are now aware of the business intelligence represented by their data. Data science stands to take this to a level you never thought of – literally. The techniques of data science, when used with the capabilities of Big Data technologies, can make connections you had not yet imagined, helping you discover new insights and ask new questions of your data. In his session at @ThingsExpo, Sarbjit Sarkaria, data science team lead ...
Oct. 28, 2016 02:00 AM EDT Reads: 4,400
A completely new computing platform is on the horizon. They’re called Microservers by some, ARM Servers by others, and sometimes even ARM-based Servers. No matter what you call them, Microservers will have a huge impact on the data center and on server computing in general. Although few people are familiar with Microservers today, their impact will be felt very soon. This is a new category of computing platform that is available today and is predicted to have triple-digit growth rates for some ...
Oct. 28, 2016 02:00 AM EDT Reads: 34,375
In past @ThingsExpo presentations, Joseph di Paolantonio has explored how various Internet of Things (IoT) and data management and analytics (DMA) solution spaces will come together as sensor analytics ecosystems. This year, in his session at @ThingsExpo, Joseph di Paolantonio from DataArchon, will be adding the numerous Transportation areas, from autonomous vehicles to “Uber for containers.” While IoT data in any one area of Transportation will have a huge impact in that area, combining sensor...
Oct. 28, 2016 01:00 AM EDT Reads: 1,214
SYS-CON Events announced today that Transparent Cloud Computing (T-Cloud) Consortium will exhibit at the 19th International Cloud Expo®, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. The Transparent Cloud Computing Consortium (T-Cloud Consortium) will conduct research activities into changes in the computing model as a result of collaboration between "device" and "cloud" and the creation of new value and markets through organic data proces...
Oct. 28, 2016 12:45 AM EDT Reads: 1,538
SYS-CON Events announced today that Niagara Networks will exhibit at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. Niagara Networks offers the highest port-density systems, and the most complete Next-Generation Network Visibility systems including Network Packet Brokers, Bypass Switches, and Network TAPs.
Oct. 28, 2016 12:00 AM EDT Reads: 1,463
Everyone knows that truly innovative companies learn as they go along, pushing boundaries in response to market changes and demands. What's more of a mystery is how to balance innovation on a fresh platform built from scratch with the legacy tech stack, product suite and customers that continue to serve as the business' foundation. In his General Session at 19th Cloud Expo, Michael Chambliss, Head of Engineering at ReadyTalk, will discuss why and how ReadyTalk diverted from healthy revenue an...
Oct. 27, 2016 10:30 PM EDT Reads: 3,095
SYS-CON Media announced today that @WebRTCSummit Blog, the largest WebRTC resource in the world, has been launched. @WebRTCSummit Blog offers top articles, news stories, and blog posts from the world's well-known experts and guarantees better exposure for its authors than any other publication. @WebRTCSummit Blog can be bookmarked ▸ Here @WebRTCSummit conference site can be bookmarked ▸ Here
Oct. 27, 2016 10:30 PM EDT Reads: 9,817