Functional analysis methodology was born out of the understanding that most (if not all - this is debated) behavior has a function. Put another way, people do the things they do for a reason.
Behavior analysts actually realized this back in the 1950s. It wasn't until the '80s, however, that they realized that understanding the function of a behavior could be helpful in treating it.
Yeah. I know.
This was actually a great leap forward for clinical behavior analysis. To illustrate just how much of one, let's take a hypothetical kid. For the sake of argument, we can call him "John". John scores 63 on IQ tests and can't speak. Once upon a time, John stubbed his toe and started crying. Not knowing why his son was crying, John's father reassured him, held him, and generally comforted him through the fit. In time, this became a pattern: every time John cried, his father would come in and comfort him.
John liked being comforted.
It didn't take John long to notice the pattern. Soon enough, he was throwing a fit whenever his father was nearby, trying to entice his father to reassure him.
Eventually, however, his father caught on to what John was doing and stopped responding to his son's crocodile tears. As he became desperate for the attention that he was no longer getting, and not knowing any other way to get it, John intensified his tantrums. During the middle of one of these fits, John bumped his head against a wall. Horrified at the possibility that his son might have hurt himself, John's father ran over and checked him for injuries, generally making a big fuss.
To John, however, this was the attention he'd been so desperately craving!
As such, John quickly learned that banging his head against a nearby object would bring his father running. Eventually, his father, desperate for help, ran to a behavior analyst.
Before functional analysis came along, the behavior analyst would have likely chosen what's called a "punishment approach". Given that this specific behavior falls under the umbrella of what are referred to as "self-injurious behaviors", there's a good chance that the specific approach chosen would've been what's politely termed "contingent electrical stimulation".
In other words, they'd have zapped John with a cattle prod every time he banged his head.
Okay, so it wouldn't always have been a cattle prod. There's actually a pretty extensive, if sadistic, collection of technology for doing this, ranging from SIBIS to the Judge Rotenberg Center's GED series of devices. As a note, JRC seems to have used a good bit of it.
That's not to imply, however, that cattle prods haven't been used. A 1995 study by Mudford, Boundy, & Murray is pretty blatant in illustrating this.
Under a functional analysis approach, however, a behavior analyst would ideally have puzzled out the above scenario and taught John a more appropriate way to seek attention.
And yes, things like that have happened. There are plenty of examples in the literature.
This isn't to say, however, that modern functional analysis methods are perfect. One concern (not, by any means, the only one) is that, as conducted in a clinical environment, they tend to have trouble distinguishing between a behavior's function and any relevant motivating operations.
While the above is fairly heavy on the technical jargon (i.e. "behavior", "function", and "motivating operation" all have specific, technical meanings), the problem is fairly easy to illustrate by example.
As such, let's take a second case - let's call him "Bob". Bob is an autistic boy with normal intelligence but poor communication ability. He is insatiably curious, but has poor communication skills.
Periodically, he sees something interesting. Whenever this happens, he desperately wants to ask his mom what it is... but gets extremely frustrated at his inability to do so. He gets so frustrated, in fact, that he bangs his head against a nearby hard object.
The problem that I mentioned earlier is that most functional analysis methods in clinical use today can't distinguish between John and Bob's cases.
Because of this, many behavior analysts would consider John and Bob to have the same problem. More specifically, they'd consider Bob to have John's behavioral problem... and treat him accordingly.
And yes, contingent electrical stimulation is still used. It's not nearly as common as it used to be, but there are places...
Mudford, O., Boundy, K., & Murray, A. (1995). Therapeutic shock device (TSD): clinical evaluation with self-injurious behaviors. Research in Developmental Disabilities, 16, 253-267.