Functional decomposition refers broadly to the process of resolving a functional relationship into its constituent parts in such a way that the original function can be reconstructed from those parts.
It happens when a non-OO design (possibly from legacy code) is coded in OO language and notation, but not using OO idioms. Imagine a C program being migrated to C++ using one class and a lot of private methods. The solution is to essentially re-design and re-write the code.
Functional decomposition is the process of identifying functionally distinct but independent computations. The focus here is on the type of computation rather than on the data manipulated by the computation.
Hierarchical model induction techniques such as Logic circuit minimization, decision trees, grammatical inference, hierarchical clustering, and quadtree decomposition are all examples of function decomposition.
Functional Decomposition is the process of taking a complex process and breaking it down into its smaller, simpler parts.
For instance, think about using an ATM. You could decompose the process into:
Walk up to the ATM
Insert your bank card
Enter your pin
well...you get the point.
You can think of programming the same way. Think of the software running that ATM:
Code for reading the card
PIN verification
Transfer Processing
Each of which can be broken down further. Once you've reached the most decomposed pieces of a subsystem, you can think about how to start coding those pieces. You then compose those small parts into the greater whole. Check out this Wikipedia Article:
Decomposition (programming)
The benefit of functional decomposition is that once you start coding, you are working on the simplest components you can possibly work with for your application. Therefore developing and testing those components becomes much easier (not to mention you are better able to architect your code and project to fit your needs).
The obvious downside is the time investment. To perform functional decomposition on a complex system takes more than a trivial amount of time BEFORE coding begins.
Personally, I think that amount of time is well worth it.
It's the same as WorkBreakDown Structures (WBS), mindMapping and top down development - basically breaking a large problem into smaller, more comprehensible sub-parts.
Pros
Cons - there are no real CONS in doing a decomposition, however there are some common mistakes
Here's an example: your C compiler.
First there's the preprocessor: it handles #include
and #define
and all the macros. You give it a file name and some options and it returns a really long string. Let's call this function preprocess(filename)
.
Then there's the lexical analyzer. It takes a string and breaks it into tokens. Call it lex(string)
. The parser takes tokens and turns them into a tree, call it parse(tokens)
. Then there's a function for converting a tree to a DAG of blocks, call it dag(tree)
. Call the code emitter emit(dag)
, which takes a DAG of blocks and spits out assembler.
The compiler is then:
emit(dag(parse(lex(preprocess(filename)))));
We've decomposed a big, difficult to understand function (the compile
function) into a bunch of smaller, easier to understand functions. You don't have to do it as a pipeline, you could write your program as:
process_data(parse_input(), parse_config())
This is more typical; compilers are fairly deep programs, most programs are broad by comparison.
Functional decomposition is a way of breaking down the complex problem into simpler problems based on the tasks that need to be performed rather than the the data relationships. This term is usually associated with the older procedure-oriented design.
A short description about the difference between procedure-oriented and object-oriented design.
Functional decomposition is helpful prior to creating functional requirements documents. If you need software for something, functional decomposition answers the question "What are the functions this software must provide". Decomposing is needed to define fine-grain functions. "I need software for energy efficiency measurement" is too general. That's why we break this into smaller pieces until the point where we clearly understand all the functions the systems need to provide. This can be later used as a checklist for completeness of a system.
A functional requirements document (FD) is basically a textual representation of functional decomposition. Coding directly from the FD may be ok for procedural languages, but it is not good enough for object-oriented solutions, because it doesn't identify objects. Neither is good for usability planning and testing.
My opinion is that you should take some time to create a FD, but not to use it too much of the time. Consult every person that knows the process you are following with your system to find all the functions needed.
I have a lot of experience in software design, development, and selling, and I use functional decomposition as the first step of development. I use it as a base for the contract, so the client knows what they will get and I know what I must provide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With